llvm.org GIT mirror llvm / 3ffe113
Turn cl::values() (for enum) from a vararg function to using C++ variadic template The core of the change is supposed to be NFC, however it also fixes what I believe was an undefined behavior when calling: va_start(ValueArgs, Desc); with Desc being a StringRef. Differential Revision: https://reviews.llvm.org/D25342 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@283671 91177308-0d34-0410-b5e6-96231b3b80d8 Mehdi Amini 2 years ago
41 changed file(s) with 99 addition(s) and 164 deletion(s). Raw diff Collapse all Expand all
354354 clEnumVal(g , "No optimizations, enable debugging"),
355355 clEnumVal(O1, "Enable trivial optimizations"),
356356 clEnumVal(O2, "Enable default optimizations"),
357 clEnumVal(O3, "Enable expensive optimizations"),
358 clEnumValEnd));
357 clEnumVal(O3, "Enable expensive optimizations")));
359358
360359 ...
361360 if (OptimizationLevel >= O2) doPartialRedundancyElimination(...);
400399 clEnumValN(Debug, "g", "No optimizations, enable debugging"),
401400 clEnumVal(O1 , "Enable trivial optimizations"),
402401 clEnumVal(O2 , "Enable default optimizations"),
403 clEnumVal(O3 , "Enable expensive optimizations"),
404 clEnumValEnd));
402 clEnumVal(O3 , "Enable expensive optimizations")));
405403
406404 ...
407405 if (OptimizationLevel == Debug) outputDebugInfo(...);
435433 cl::values(
436434 clEnumValN(nodebuginfo, "none", "disable debug information"),
437435 clEnumVal(quick, "enable quick debug information"),
438 clEnumVal(detailed, "enable detailed debug information"),
439 clEnumValEnd));
436 clEnumVal(detailed, "enable detailed debug information")));
440437
441438 This definition defines an enumerated command line variable of type "``enum
442439 DebugLev``", which works exactly the same way as before. The difference here is
497494 clEnumVal(dce , "Dead Code Elimination"),
498495 clEnumVal(constprop , "Constant Propagation"),
499496 clEnumValN(inlining, "inline", "Procedure Integration"),
500 clEnumVal(strip , "Strip Symbols"),
501 clEnumValEnd));
497 clEnumVal(strip , "Strip Symbols")));
502498
503499 This defines a variable that is conceptually of the type
504500 "``std::vector``". Thus, you can access it with standard vector
557553 clEnumVal(dce , "Dead Code Elimination"),
558554 clEnumVal(constprop , "Constant Propagation"),
559555 clEnumValN(inlining, "inline", "Procedure Integration"),
560 clEnumVal(strip , "Strip Symbols"),
561 clEnumValEnd));
556 clEnumVal(strip , "Strip Symbols")));
562557
563558 To test to see if ``constprop`` was specified, we can use the ``cl:bits::isSet``
564559 function:
5757 clEnumValN(Reloc::RWPI, "rwpi",
5858 "Read-write data relocatable, accessed relative to static base"),
5959 clEnumValN(Reloc::ROPI_RWPI, "ropi-rwpi",
60 "Combination of ropi and rwpi"),
61 clEnumValEnd));
60 "Combination of ropi and rwpi")));
6261
6362 static inline Optional getRelocModel() {
6463 if (RelocModel.getNumOccurrences()) {
7574 cl::values(clEnumValN(ThreadModel::POSIX, "posix",
7675 "POSIX thread model"),
7776 clEnumValN(ThreadModel::Single, "single",
78 "Single thread model"),
79 clEnumValEnd));
77 "Single thread model")));
8078
8179 cl::opt
8280 CMModel("code-model",
9189 clEnumValN(CodeModel::Medium, "medium",
9290 "Medium code model"),
9391 clEnumValN(CodeModel::Large, "large",
94 "Large code model"),
95 clEnumValEnd));
92 "Large code model")));
9693
9794 cl::opt
9895 ExceptionModel("exception-model",
107104 clEnumValN(ExceptionHandling::ARM, "arm",
108105 "ARM EHABI exceptions"),
109106 clEnumValN(ExceptionHandling::WinEH, "wineh",
110 "Windows exception model"),
111 clEnumValEnd));
107 "Windows exception model")));
112108
113109 cl::opt
114110 FileType("filetype", cl::init(TargetMachine::CGFT_AssemblyFile),
119115 clEnumValN(TargetMachine::CGFT_ObjectFile, "obj",
120116 "Emit a native object ('.o') file"),
121117 clEnumValN(TargetMachine::CGFT_Null, "null",
122 "Emit nothing, for performance testing"),
123 clEnumValEnd));
118 "Emit nothing, for performance testing")));
124119
125120 cl::opt
126121 EnableFPMAD("enable-fp-mad",
164159 "the sign of a flushed-to-zero number is preserved "
165160 "in the sign of 0"),
166161 clEnumValN(FPDenormal::PositiveZero, "positive-zero",
167 "denormals are flushed to positive zero"),
168 clEnumValEnd));
162 "denormals are flushed to positive zero")));
169163
170164 cl::opt
171165 EnableHonorSignDependentRoundingFPMath("enable-sign-dependent-rounding-fp-math",
183177 clEnumValN(FloatABI::Soft, "soft",
184178 "Soft float ABI (implied by -soft-float)"),
185179 clEnumValN(FloatABI::Hard, "hard",
186 "Hard float ABI (uses FP registers)"),
187 clEnumValEnd));
180 "Hard float ABI (uses FP registers)")));
188181
189182 cl::opt
190183 FuseFPOps("fp-contract",
196189 clEnumValN(FPOpFusion::Standard, "on",
197190 "Only fuse 'blessed' FP ops."),
198191 clEnumValN(FPOpFusion::Strict, "off",
199 "Only fuse FP ops when the result won't be affected."),
200 clEnumValEnd));
192 "Only fuse FP ops when the result won't be affected.")));
201193
202194 cl::opt
203195 DontPlaceZerosInBSS("nozero-initialized-in-bss",
268260 clEnumValN(JumpTable::Simplified, "simplified",
269261 "Create one table per simplified function type."),
270262 clEnumValN(JumpTable::Full, "full",
271 "Create one table per unique function type."),
272 clEnumValEnd));
263 "Create one table per unique function type.")));
273264
274265 cl::opt EABIVersion(
275266 "meabi", cl::desc("Set EABI type (default depends on triple):"),
278269 "Triple default EABI version"),
279270 clEnumValN(EABI::EABI4, "4", "EABI version 4"),
280271 clEnumValN(EABI::EABI5, "5", "EABI version 5"),
281 clEnumValN(EABI::GNU, "gnu", "EABI GNU"), clEnumValEnd));
272 clEnumValN(EABI::GNU, "gnu", "EABI GNU")));
282273
283274 cl::opt
284275 DebuggerTuningOpt("debugger-tune",
288279 clEnumValN(DebuggerKind::GDB, "gdb", "gdb"),
289280 clEnumValN(DebuggerKind::LLDB, "lldb", "lldb"),
290281 clEnumValN(DebuggerKind::SCE, "sce",
291 "SCE targets (e.g. PS4)"),
292 clEnumValEnd));
282 "SCE targets (e.g. PS4)")));
293283
294284 // Common utility function tightly tied to the options listed here. Initializes
295285 // a TargetOptions object with CodeGen flags and returns it.
2525 cl::values(clEnumValN(MCTargetOptions::AsmInstrumentationNone, "none",
2626 "no instrumentation at all"),
2727 clEnumValN(MCTargetOptions::AsmInstrumentationAddress, "address",
28 "instrument instructions with memory arguments"),
29 clEnumValEnd));
28 "instrument instructions with memory arguments")));
3029
3130 cl::opt RelaxAll("mc-relax-all",
3231 cl::desc("When used with filetype=obj, "
555555 //===----------------------------------------------------------------------===//
556556 // Enum valued command line option
557557 //
558 #define clEnumVal(ENUMVAL, DESC) #ENUMVAL, int(ENUMVAL), DESC
559 #define clEnumValN(ENUMVAL, FLAGNAME, DESC) FLAGNAME, int(ENUMVAL), DESC
560 #define clEnumValEnd (reinterpret_cast(0))
558
559 // This represents a single enum value, using "int" as the underlying type.
560 struct OptionEnumValue {
561 StringRef Name;
562 int Value;
563 StringRef Description;
564 };
565
566 #define clEnumVal(ENUMVAL, DESC) \
567 cl::OptionEnumValue { #ENUMVAL, int(ENUMVAL), DESC }
568 #define clEnumValN(ENUMVAL, FLAGNAME, DESC) \
569 cl::OptionEnumValue { FLAGNAME, int(ENUMVAL), DESC }
561570
562571 // values - For custom data types, allow specifying a group of values together
563 // as the values that go into the mapping that the option handler uses. Note
564 // that the values list must always have a 0 at the end of the list to indicate
565 // that the list has ended.
566 //
567 template class ValuesClass {
572 // as the values that go into the mapping that the option handler uses.
573 //
574 class ValuesClass {
568575 // Use a vector instead of a map, because the lists should be short,
569576 // the overhead is less, and most importantly, it keeps them in the order
570577 // inserted so we can print our option out nicely.
571 SmallVector>, 4> Values;
572 void processValues(va_list Vals);
573
574 public:
575 ValuesClass(StringRef EnumName, DataType Val, StringRef Desc,
576 va_list ValueArgs) {
577 // Insert the first value, which is required.
578 Values.push_back(std::make_pair(EnumName, std::make_pair(Val, Desc)));
579
580 // Process the varargs portion of the values...
581 while (const char *enumName = va_arg(ValueArgs, const char * )) {
582 DataType EnumVal = static_cast(va_arg(ValueArgs, int));
583 auto EnumDesc = StringRef(va_arg(ValueArgs, const char * ));
584 Values.push_back(std::make_pair(StringRef(enumName), // Add value to value map
585 std::make_pair(EnumVal, EnumDesc)));
586 }
587 }
578 SmallVector Values;
579
580 public:
581 ValuesClass(std::initializer_list Options)
582 : Values(Options) {}
588583
589584 template void apply(Opt &O) const {
590 for (size_t i = 0, e = Values.size(); i != e; ++i)
591 O.getParser().addLiteralOption(Values[i].first, Values[i].second.first,
592 Values[i].second.second);
593 }
594 };
595
596 template
597 ValuesClass LLVM_END_WITH_NULL
598 values(StringRef Arg, DataType Val, StringRef Desc, ...) {
599 va_list ValueArgs;
600 va_start(ValueArgs, Desc);
601 ValuesClass Vals(Arg, Val, Desc, ValueArgs);
602 va_end(ValueArgs);
603 return Vals;
585 for (auto Value : Values)
586 O.getParser().addLiteralOption(Value.Name, Value.Value,
587 Value.Description);
588 }
589 };
590
591 /// Helper to build a ValuesClass by forwarding a variable number of arguments
592 /// as an initializer list to the ValuesClass constructor.
593 template ValuesClass values(OptsTy... Options) {
594 return ValuesClass({Options...});
604595 }
605596
606597 //===----------------------------------------------------------------------===//
3838 "display a graph using the raw "
3939 "integer fractional block frequency representation."),
4040 clEnumValN(GVDT_Count, "count", "display a graph using the real "
41 "profile count if available."),
42 clEnumValEnd));
41 "profile count if available.")));
4342
4443 cl::opt
4544 ViewBlockFreqFuncName("view-bfi-func-name", cl::Hidden,
5353 clEnumValN(Region::PrintBB, "bb",
5454 "print regions in detail with block_iterator"),
5555 clEnumValN(Region::PrintRN, "rn",
56 "print regions in detail with element_iterator"),
57 clEnumValEnd));
56 "print regions in detail with element_iterator")));
5857
5958
6059 //===----------------------------------------------------------------------===//
2323 clEnumValN(TargetLibraryInfoImpl::Accelerate, "Accelerate",
2424 "Accelerate framework"),
2525 clEnumValN(TargetLibraryInfoImpl::SVML, "SVML",
26 "Intel SVML library"),
27 clEnumValEnd));
26 "Intel SVML library")));
2827
2928 StringRef const TargetLibraryInfoImpl::StandardNames[LibFunc::NumLibFuncs] = {
3029 #define TLI_DEFINE_STRING
8585 cl::desc("Output prototype dwarf accelerator tables."),
8686 cl::values(clEnumVal(Default, "Default for platform"),
8787 clEnumVal(Enable, "Enabled"),
88 clEnumVal(Disable, "Disabled"), clEnumValEnd),
88 clEnumVal(Disable, "Disabled")),
8989 cl::init(Default));
9090
9191 static cl::opt
9393 cl::desc("Output DWARF5 split debug info."),
9494 cl::values(clEnumVal(Default, "Default for platform"),
9595 clEnumVal(Enable, "Enabled"),
96 clEnumVal(Disable, "Disabled"), clEnumValEnd),
96 clEnumVal(Disable, "Disabled")),
9797 cl::init(Default));
9898
9999 static cl::opt
101101 cl::desc("Generate DWARF pubnames and pubtypes sections"),
102102 cl::values(clEnumVal(Default, "Default for platform"),
103103 clEnumVal(Enable, "Enabled"),
104 clEnumVal(Disable, "Disabled"), clEnumValEnd),
104 clEnumVal(Disable, "Disabled")),
105105 cl::init(Default));
106106
107107 enum LinkageNameOption {
116116 "Default for platform"),
117117 clEnumValN(AllLinkageNames, "All", "All"),
118118 clEnumValN(AbstractLinkageNames, "Abstract",
119 "Abstract subprograms"),
120 clEnumValEnd),
119 "Abstract subprograms")),
121120 cl::init(DefaultLinkageNames));
122121
123122 static const char *const DWARFGroupName = "DWARF Emission";
3232 cl::values(clEnumValN(RegBankSelect::Mode::Fast, "regbankselect-fast",
3333 "Run the Fast mode (default mapping)"),
3434 clEnumValN(RegBankSelect::Mode::Greedy, "regbankselect-greedy",
35 "Use the Greedy mode (best local mapping)"),
36 clEnumValEnd));
35 "Use the Greedy mode (best local mapping)")));
3736
3837 char RegBankSelect::ID = 0;
3938 INITIALIZE_PASS_BEGIN(RegBankSelect, DEBUG_TYPE,
4141 "display a graph using the raw "
4242 "integer fractional block frequency representation."),
4343 clEnumValN(GVDT_Count, "count", "display a graph using the real "
44 "profile count if available."),
45
46 clEnumValEnd));
44 "profile count if available.")));
4745
4846 extern cl::opt ViewBlockFreqFuncName;
4947 extern cl::opt ViewHotFreqPercent;
6060 cl::desc("Spill mode for splitting live ranges"),
6161 cl::values(clEnumValN(SplitEditor::SM_Partition, "default", "Default"),
6262 clEnumValN(SplitEditor::SM_Size, "size", "Optimize for size"),
63 clEnumValN(SplitEditor::SM_Speed, "speed", "Optimize for speed"),
64 clEnumValEnd),
63 clEnumValN(SplitEditor::SM_Speed, "speed", "Optimize for speed")),
6564 cl::init(SplitEditor::SM_Speed));
6665
6766 static cl::opt
5959 cl::values(clEnumValN(ThreadLocalUSP, "thread-local",
6060 "Thread-local storage"),
6161 clEnumValN(SingleThreadUSP, "single-thread",
62 "Non-thread-local storage"),
63 clEnumValEnd));
62 "Non-thread-local storage")));
6463
6564 namespace llvm {
6665
128128 clEnumValN(CFLAAType::Andersen, "anders",
129129 "Enable inclusion-based CFL-AA"),
130130 clEnumValN(CFLAAType::Both, "both",
131 "Enable both variants of CFL-AA"),
132 clEnumValEnd));
131 "Enable both variants of CFL-AA")));
133132
134133 /// Allow standard passes to be disabled by command line options. This supports
135134 /// simple binary flags that either suppress the pass or do nothing.
5555 clEnumVal(Arguments , "print pass arguments to pass to 'opt'"),
5656 clEnumVal(Structure , "print pass structure before run()"),
5757 clEnumVal(Executions, "print pass name before it is executed"),
58 clEnumVal(Details , "print pass details when it is executed"),
59 clEnumValEnd));
58 clEnumVal(Details , "print pass details when it is executed")));
6059
6160 namespace {
6261 typedef llvm::cl::list
2828 "aarch64-neon-syntax", cl::init(Default),
2929 cl::desc("Choose style of NEON code to emit from AArch64 backend:"),
3030 cl::values(clEnumValN(Generic, "generic", "Emit generic NEON assembly"),
31 clEnumValN(Apple, "apple", "Emit Apple-style NEON assembly"),
32 clEnumValEnd));
31 clEnumValN(Apple, "apple", "Emit Apple-style NEON assembly")));
3332
3433 AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin() {
3534 // We prefer NEON instructions to be printed in the short form.
5858 clEnumValN(RestrictedIT, "arm-restrict-it",
5959 "Disallow deprecated IT based on ARMv8"),
6060 clEnumValN(NoRestrictedIT, "arm-no-restrict-it",
61 "Allow IT blocks based on ARMv7"),
62 clEnumValEnd));
61 "Allow IT blocks based on ARMv7")));
6362
6463 /// ForceFastISel - Use the fast-isel, even for subtargets where it is not
6564 /// currently supported (for testing only).
6464 clEnumValN(ImplicitItModeTy::ARMOnly, "arm",
6565 "Accept in ARM, reject in Thumb"),
6666 clEnumValN(ImplicitItModeTy::ThumbOnly, "thumb",
67 "Warn in ARM, emit implicit ITs in Thumb"),
68 clEnumValEnd));
67 "Warn in ARM, emit implicit ITs in Thumb")));
6968
7069 class ARMOperand;
7170
5353 clEnumValN(HWMultIntr, "interrupts",
5454 "Assume hardware multiplier can be used inside interrupts"),
5555 clEnumValN(HWMultNoIntr, "use",
56 "Assume hardware multiplier cannot be used inside interrupts"),
57 clEnumValEnd));
56 "Assume hardware multiplier cannot be used inside interrupts")));
5857
5958 MSP430TargetLowering::MSP430TargetLowering(const TargetMachine &TM,
6059 const MSP430Subtarget &STI)
7878 cl::values(
7979 clEnumValN(CB_Never, "never", "Do not use compact branches if possible."),
8080 clEnumValN(CB_Optimal, "optimal", "Use compact branches where appropiate (default)."),
81 clEnumValN(CB_Always, "always", "Always use compact branches if possible."),
82 clEnumValEnd
81 clEnumValN(CB_Always, "always", "Always use compact branches if possible.")
8382 )
8483 );
8584
3030 AsmWriterFlavor("x86-asm-syntax", cl::init(ATT),
3131 cl::desc("Choose style of code to emit from X86 backend:"),
3232 cl::values(clEnumValN(ATT, "att", "Emit AT&T-style assembly"),
33 clEnumValN(Intel, "intel", "Emit Intel-style assembly"),
34 clEnumValEnd));
33 clEnumValN(Intel, "intel", "Emit Intel-style assembly")));
3534
3635 static cl::opt
3736 MarkedJTDataRegions("mark-data-regions", cl::init(true),
7171 cl::values(clEnumValN(InlinerFunctionImportStatsOpts::Basic, "basic",
7272 "basic statistics"),
7373 clEnumValN(InlinerFunctionImportStatsOpts::Verbose, "verbose",
74 "printing of statistics for each inlined function"),
75 clEnumValEnd),
74 "printing of statistics for each inlined function")),
7675 cl::Hidden, cl::desc("Enable inliner stats for imported functions"));
7776 } // namespace
7877
9191 clEnumValN(CFLAAType::Andersen, "anders",
9292 "Enable inclusion-based CFL-AA"),
9393 clEnumValN(CFLAAType::Both, "both",
94 "Enable both variants of CFL-AA"),
95 clEnumValEnd));
94 "Enable both variants of CFL-AA")));
9695
9796 static cl::opt
9897 EnableMLSM("mlsm", cl::init(true), cl::Hidden,
7878 clEnumValN(OnlyCheapRepl, "cheap",
7979 "only replace exit value when the cost is cheap"),
8080 clEnumValN(AlwaysRepl, "always",
81 "always replace exit value whenever possible"),
82 clEnumValEnd));
81 "always replace exit value whenever possible")));
8382
8483 namespace {
8584 struct RewritePhi;
5959 "compile the bitcode. Useful to avoid linking."),
6060 clEnumValN(Custom, "run-custom",
6161 "Use -exec-command to define a command to execute "
62 "the bitcode. Useful for cross-compilation."),
63 clEnumValEnd),
62 "the bitcode. Useful for cross-compilation.")),
6463 cl::init(AutoPick));
6564
6665 cl::opt SafeInterpreterSel(
6968 clEnumValN(RunLLC, "safe-run-llc", "Compile with LLC"),
7069 clEnumValN(Custom, "safe-run-custom",
7170 "Use -exec-command to define a command to execute "
72 "the bitcode. Useful for cross-compilation."),
73 clEnumValEnd),
71 "the bitcode. Useful for cross-compilation.")),
7472 cl::init(AutoPick));
7573
7674 cl::opt SafeInterpreterPath(
3636 "mods-to-disk",
3737 "Dump modules to the current "
3838 "working directory. (WARNING: "
39 "will overwrite existing files)."),
40 clEnumValEnd),
39 "will overwrite existing files).")),
4140 cl::Hidden);
4241
4342 cl::opt OrcInlineStubs("orc-lazy-inline-stubs",
9090 "Orc-based MCJIT replacement"),
9191 clEnumValN(JITKind::OrcLazy,
9292 "orc-lazy",
93 "Orc-based lazy JIT."),
94 clEnumValEnd));
93 "Orc-based lazy JIT.")));
9594
9695 // The MCJIT supports building for a target address space separate from
9796 // the JIT compilation process. Use a forked process and a copying
193192 clEnumValN(Reloc::PIC_, "pic",
194193 "Fully relocatable, position independent code"),
195194 clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic",
196 "Relocatable external references, non-relocatable code"),
197 clEnumValEnd));
195 "Relocatable external references, non-relocatable code")));
198196
199197 cl::opt
200198 CMModel("code-model",
209207 clEnumValN(CodeModel::Medium, "medium",
210208 "Medium code model"),
211209 clEnumValN(CodeModel::Large, "large",
212 "Large code model"),
213 clEnumValEnd));
210 "Large code model")));
214211
215212 cl::opt
216213 GenerateSoftFloatCalls("soft-float",
227224 clEnumValN(FloatABI::Soft, "soft",
228225 "Soft float ABI (implied by -soft-float)"),
229226 clEnumValN(FloatABI::Hard, "hard",
230 "Hard float ABI (uses FP registers)"),
231 clEnumValEnd));
227 "Hard float ABI (uses FP registers)")));
232228
233229 ExitOnError ExitOnErr;
234230 }
9292 FormatOpt("format", cl::desc("Archive format to create"),
9393 cl::values(clEnumValN(Default, "default", "default"),
9494 clEnumValN(GNU, "gnu", "gnu"),
95 clEnumValN(BSD, "bsd", "bsd"), clEnumValEnd));
95 clEnumValN(BSD, "bsd", "bsd")));
9696
9797 static std::string Options;
9898
484484 cl::values(clEnumValN(CoverageViewOptions::OutputFormat::Text, "text",
485485 "Text output"),
486486 clEnumValN(CoverageViewOptions::OutputFormat::HTML, "html",
487 "HTML output"),
488 clEnumValEnd),
487 "HTML output")),
489488 cl::init(CoverageViewOptions::OutputFormat::Text));
490489
491490 cl::opt FilenameEquivalence(
7171 ".debug_str_offsets.dwo"),
7272 clEnumValN(DIDT_CUIndex, "cu_index", ".debug_cu_index"),
7373 clEnumValN(DIDT_GdbIndex, "gdb_index", ".gdb_index"),
74 clEnumValN(DIDT_TUIndex, "tu_index", ".debug_tu_index"), clEnumValEnd));
74 clEnumValN(DIDT_TUIndex, "tu_index", ".debug_tu_index")));
7575
7676 static void error(StringRef Filename, std::error_code EC) {
7777 if (!EC)
101101 "(requires -thinlto-index)."),
102102 clEnumValN(THINOPT, "optimize", "Perform ThinLTO optimizations."),
103103 clEnumValN(THINCODEGEN, "codegen", "CodeGen (expected to match llc)"),
104 clEnumValN(THINALL, "run", "Perform ThinLTO end-to-end"),
105 clEnumValEnd));
104 clEnumValN(THINALL, "run", "Perform ThinLTO end-to-end")));
106105
107106 static cl::opt
108107 ThinLTOIndex("thinlto-index",
6565 clEnumValN(DebugCompressionType::DCT_Zlib, "zlib",
6666 "Use zlib compression"),
6767 clEnumValN(DebugCompressionType::DCT_ZlibGnu, "zlib-gnu",
68 "Use zlib-gnu compression (deprecated)"),
69 clEnumValEnd));
68 "Use zlib-gnu compression (deprecated)")));
7069
7170 static cl::opt
7271 ShowInst("show-inst", cl::desc("Show internal instruction representation"));
104103 clEnumValN(OFT_Null, "null",
105104 "Don't emit anything (for timing purposes)"),
106105 clEnumValN(OFT_ObjectFile, "obj",
107 "Emit a native object ('.o') file"),
108 clEnumValEnd));
106 "Emit a native object ('.o') file")));
109107
110108 static cl::list
111109 IncludeDirs("I", cl::desc("Directory of include files"),
147145 clEnumValN(CodeModel::Medium, "medium",
148146 "Medium code model"),
149147 clEnumValN(CodeModel::Large, "large",
150 "Large code model"),
151 clEnumValEnd));
148 "Large code model")));
152149
153150 static cl::opt
154151 NoInitialTextSection("n", cl::desc("Don't assume assembly file starts "
189186 clEnumValN(AC_Disassemble, "disassemble",
190187 "Disassemble strings of hex bytes"),
191188 clEnumValN(AC_MDisassemble, "mdis",
192 "Marked up disassembly of strings of hex bytes"),
193 clEnumValEnd));
189 "Marked up disassembly of strings of hex bytes")));
194190
195191 static const Target *GetTarget(const char *ProgName) {
196192 // Figure out the target triple.
3030 cl::values(clEnumValN(AC_Assemble, "assemble",
3131 "Assemble a .s file (default)"),
3232 clEnumValN(AC_Disassemble, "disassemble",
33 "Disassemble strings of hex bytes"),
34 clEnumValEnd));
33 "Disassemble strings of hex bytes")));
3534
3635 static cl::opt
3736 TripleName("triple", cl::desc("Target triple to assemble for, "
5555 "format", cl::desc("Specify output format"),
5656 cl::values(clEnumVal(bsd, "BSD format"), clEnumVal(sysv, "System V format"),
5757 clEnumVal(posix, "POSIX.2 format"),
58 clEnumVal(darwin, "Darwin -m format"), clEnumValEnd),
58 clEnumVal(darwin, "Darwin -m format")),
5959 cl::init(bsd));
6060 cl::alias OutputFormat2("f", cl::desc("Alias for --format"),
6161 cl::aliasopt(OutputFormat));
142142 cl::opt
143143 AddressRadix("radix", cl::desc("Radix (o/d/x) for printing symbol Values"),
144144 cl::values(clEnumVal(d, "decimal"), clEnumVal(o, "octal"),
145 clEnumVal(x, "hexadecimal"), clEnumValEnd),
145 clEnumVal(x, "hexadecimal")),
146146 cl::init(x));
147147 cl::alias RadixAlias("t", cl::desc("Alias for --radix"),
148148 cl::aliasopt(AddressRadix));
187187
188188 cl::opt llvm::DwarfDumpType(
189189 "dwarf", cl::init(DIDT_Null), cl::desc("Dump of dwarf debug sections:"),
190 cl::values(clEnumValN(DIDT_Frames, "frames", ".debug_frame"),
191 clEnumValEnd));
190 cl::values(clEnumValN(DIDT_Frames, "frames", ".debug_frame")));
192191
193192 cl::opt PrintSource(
194193 "source",
392392 cl::opt ProfileKind(
393393 cl::desc("Profile kind:"), cl::init(instr),
394394 cl::values(clEnumVal(instr, "Instrumentation profile (default)"),
395 clEnumVal(sample, "Sample profile"), clEnumValEnd));
395 clEnumVal(sample, "Sample profile")));
396396 cl::opt OutputFormat(
397397 cl::desc("Format of output profile"), cl::init(PF_Binary),
398398 cl::values(clEnumValN(PF_Binary, "binary", "Binary encoding (default)"),
399399 clEnumValN(PF_Text, "text", "Text encoding"),
400400 clEnumValN(PF_GCC, "gcc",
401 "GCC encoding (only meaningful for -sample)"),
402 clEnumValEnd));
401 "GCC encoding (only meaningful for -sample)")));
403402 cl::opt OutputSparse("sparse", cl::init(false),
404403 cl::desc("Generate a sparse profile (only meaningful for -instr)"));
405404 cl::opt NumThreads(
621620 cl::opt ProfileKind(
622621 cl::desc("Profile kind:"), cl::init(instr),
623622 cl::values(clEnumVal(instr, "Instrumentation profile (default)"),
624 clEnumVal(sample, "Sample profile"), clEnumValEnd));
623 clEnumVal(sample, "Sample profile")));
625624
626625 cl::ParseCommandLineOptions(argc, argv, "LLVM profile data summary\n");
627626
263263 cl::opt
264264 Output("elf-output-style", cl::desc("Specify ELF dump style"),
265265 cl::values(clEnumVal(LLVM, "LLVM default style"),
266 clEnumVal(GNU, "GNU readelf style"), clEnumValEnd),
266 clEnumVal(GNU, "GNU readelf style")),
267267 cl::init(LLVM));
268268 } // namespace opts
269269
6565 clEnumValN(AC_PrintObjectLineInfo, "printobjline",
6666 "Like -printlineinfo but does not load the object first"),
6767 clEnumValN(AC_Verify, "verify",
68 "Load, link and verify the resulting memory image."),
69 clEnumValEnd));
68 "Load, link and verify the resulting memory image.")));
7069
7170 static cl::opt
7271 EntryPoint("entry",
3939 OutputFormat("format", cl::desc("Specify output format"),
4040 cl::values(clEnumVal(sysv, "System V format"),
4141 clEnumVal(berkeley, "Berkeley format"),
42 clEnumVal(darwin, "Darwin -m format"), clEnumValEnd),
42 clEnumVal(darwin, "Darwin -m format")),
4343 cl::init(berkeley));
4444
4545 static cl::opt OutputFormatShort(
4646 cl::desc("Specify output format"),
4747 cl::values(clEnumValN(sysv, "A", "System V format"),
4848 clEnumValN(berkeley, "B", "Berkeley format"),
49 clEnumValN(darwin, "m", "Darwin -m format"), clEnumValEnd),
49 clEnumValN(darwin, "m", "Darwin -m format")),
5050 cl::init(berkeley));
5151
5252 static bool BerkeleyHeaderPrinted = false;
8080 RadixShort(cl::desc("Print size in radix:"),
8181 cl::values(clEnumValN(octal, "o", "Print size in octal"),
8282 clEnumValN(decimal, "d", "Print size in decimal"),
83 clEnumValN(hexadecimal, "x", "Print size in hexadecimal"),
84 clEnumValEnd),
83 clEnumValN(hexadecimal, "x", "Print size in hexadecimal")),
8584 cl::init(decimal));
8685
8786 static cl::opt
4545 clEnumValN(FunctionNameKind::ShortName, "short",
4646 "print short function name"),
4747 clEnumValN(FunctionNameKind::LinkageName, "linkage",
48 "print function linkage name"),
49 clEnumValEnd));
48 "print function linkage name")));
5049
5150 static cl::opt
5251 ClUseRelativeAddress("relative-address", cl::init(false),
9191 "REMOVED. Use -symbolize & coverage-report-server.py."),
9292 clEnumValN(SymbolizeAction, "symbolize",
9393 "Produces a symbolized JSON report from binary report."),
94 clEnumValN(MergeAction, "merge", "Merges reports."), clEnumValEnd));
94 clEnumValN(MergeAction, "merge", "Merges reports.")));
9595
9696 static cl::list
9797 ClInputFiles(cl::Positional, cl::OneOrMore,
9090 clEnumValN(GenAttributes, "gen-attrs",
9191 "Generate attributes"),
9292 clEnumValN(GenSearchableTables, "gen-searchable-tables",
93 "Generate generic binary-searchable table"),
94 clEnumValEnd));
93 "Generate generic binary-searchable table")));
9594
9695 cl::opt
9796 Class("class", cl::desc("Print Enum list for this class"),