mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
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 llvm-svn: 283671
This commit is contained in:
parent
df57ffdd73
commit
a6cfd067ac
@ -355,8 +355,7 @@ library fill it in with the appropriate level directly, which is used like this:
|
||||
clEnumVal(g , "No optimizations, enable debugging"),
|
||||
clEnumVal(O1, "Enable trivial optimizations"),
|
||||
clEnumVal(O2, "Enable default optimizations"),
|
||||
clEnumVal(O3, "Enable expensive optimizations"),
|
||||
clEnumValEnd));
|
||||
clEnumVal(O3, "Enable expensive optimizations")));
|
||||
|
||||
...
|
||||
if (OptimizationLevel >= O2) doPartialRedundancyElimination(...);
|
||||
@ -401,8 +400,7 @@ program. Because of this, we can alternatively write this example like this:
|
||||
clEnumValN(Debug, "g", "No optimizations, enable debugging"),
|
||||
clEnumVal(O1 , "Enable trivial optimizations"),
|
||||
clEnumVal(O2 , "Enable default optimizations"),
|
||||
clEnumVal(O3 , "Enable expensive optimizations"),
|
||||
clEnumValEnd));
|
||||
clEnumVal(O3 , "Enable expensive optimizations")));
|
||||
|
||||
...
|
||||
if (OptimizationLevel == Debug) outputDebugInfo(...);
|
||||
@ -436,8 +434,7 @@ the code looks like this:
|
||||
cl::values(
|
||||
clEnumValN(nodebuginfo, "none", "disable debug information"),
|
||||
clEnumVal(quick, "enable quick debug information"),
|
||||
clEnumVal(detailed, "enable detailed debug information"),
|
||||
clEnumValEnd));
|
||||
clEnumVal(detailed, "enable detailed debug information")));
|
||||
|
||||
This definition defines an enumerated command line variable of type "``enum
|
||||
DebugLev``", which works exactly the same way as before. The difference here is
|
||||
@ -498,8 +495,7 @@ Then define your "``cl::list``" variable:
|
||||
clEnumVal(dce , "Dead Code Elimination"),
|
||||
clEnumVal(constprop , "Constant Propagation"),
|
||||
clEnumValN(inlining, "inline", "Procedure Integration"),
|
||||
clEnumVal(strip , "Strip Symbols"),
|
||||
clEnumValEnd));
|
||||
clEnumVal(strip , "Strip Symbols")));
|
||||
|
||||
This defines a variable that is conceptually of the type
|
||||
"``std::vector<enum Opts>``". Thus, you can access it with standard vector
|
||||
@ -558,8 +554,7 @@ Reworking the above list example, we could replace `cl::list`_ with `cl::bits`_:
|
||||
clEnumVal(dce , "Dead Code Elimination"),
|
||||
clEnumVal(constprop , "Constant Propagation"),
|
||||
clEnumValN(inlining, "inline", "Procedure Integration"),
|
||||
clEnumVal(strip , "Strip Symbols"),
|
||||
clEnumValEnd));
|
||||
clEnumVal(strip , "Strip Symbols")));
|
||||
|
||||
To test to see if ``constprop`` was specified, we can use the ``cl:bits::isSet``
|
||||
function:
|
||||
|
@ -58,8 +58,7 @@ cl::opt<Reloc::Model> RelocModel(
|
||||
clEnumValN(Reloc::RWPI, "rwpi",
|
||||
"Read-write data relocatable, accessed relative to static base"),
|
||||
clEnumValN(Reloc::ROPI_RWPI, "ropi-rwpi",
|
||||
"Combination of ropi and rwpi"),
|
||||
clEnumValEnd));
|
||||
"Combination of ropi and rwpi")));
|
||||
|
||||
static inline Optional<Reloc::Model> getRelocModel() {
|
||||
if (RelocModel.getNumOccurrences()) {
|
||||
@ -76,8 +75,7 @@ TMModel("thread-model",
|
||||
cl::values(clEnumValN(ThreadModel::POSIX, "posix",
|
||||
"POSIX thread model"),
|
||||
clEnumValN(ThreadModel::Single, "single",
|
||||
"Single thread model"),
|
||||
clEnumValEnd));
|
||||
"Single thread model")));
|
||||
|
||||
cl::opt<llvm::CodeModel::Model>
|
||||
CMModel("code-model",
|
||||
@ -92,8 +90,7 @@ CMModel("code-model",
|
||||
clEnumValN(CodeModel::Medium, "medium",
|
||||
"Medium code model"),
|
||||
clEnumValN(CodeModel::Large, "large",
|
||||
"Large code model"),
|
||||
clEnumValEnd));
|
||||
"Large code model")));
|
||||
|
||||
cl::opt<llvm::ExceptionHandling>
|
||||
ExceptionModel("exception-model",
|
||||
@ -108,8 +105,7 @@ ExceptionModel("exception-model",
|
||||
clEnumValN(ExceptionHandling::ARM, "arm",
|
||||
"ARM EHABI exceptions"),
|
||||
clEnumValN(ExceptionHandling::WinEH, "wineh",
|
||||
"Windows exception model"),
|
||||
clEnumValEnd));
|
||||
"Windows exception model")));
|
||||
|
||||
cl::opt<TargetMachine::CodeGenFileType>
|
||||
FileType("filetype", cl::init(TargetMachine::CGFT_AssemblyFile),
|
||||
@ -120,8 +116,7 @@ FileType("filetype", cl::init(TargetMachine::CGFT_AssemblyFile),
|
||||
clEnumValN(TargetMachine::CGFT_ObjectFile, "obj",
|
||||
"Emit a native object ('.o') file"),
|
||||
clEnumValN(TargetMachine::CGFT_Null, "null",
|
||||
"Emit nothing, for performance testing"),
|
||||
clEnumValEnd));
|
||||
"Emit nothing, for performance testing")));
|
||||
|
||||
cl::opt<bool>
|
||||
EnableFPMAD("enable-fp-mad",
|
||||
@ -165,8 +160,7 @@ DenormalMode("denormal-fp-math",
|
||||
"the sign of a flushed-to-zero number is preserved "
|
||||
"in the sign of 0"),
|
||||
clEnumValN(FPDenormal::PositiveZero, "positive-zero",
|
||||
"denormals are flushed to positive zero"),
|
||||
clEnumValEnd));
|
||||
"denormals are flushed to positive zero")));
|
||||
|
||||
cl::opt<bool>
|
||||
EnableHonorSignDependentRoundingFPMath("enable-sign-dependent-rounding-fp-math",
|
||||
@ -184,8 +178,7 @@ FloatABIForCalls("float-abi",
|
||||
clEnumValN(FloatABI::Soft, "soft",
|
||||
"Soft float ABI (implied by -soft-float)"),
|
||||
clEnumValN(FloatABI::Hard, "hard",
|
||||
"Hard float ABI (uses FP registers)"),
|
||||
clEnumValEnd));
|
||||
"Hard float ABI (uses FP registers)")));
|
||||
|
||||
cl::opt<llvm::FPOpFusion::FPOpFusionMode>
|
||||
FuseFPOps("fp-contract",
|
||||
@ -197,8 +190,7 @@ FuseFPOps("fp-contract",
|
||||
clEnumValN(FPOpFusion::Standard, "on",
|
||||
"Only fuse 'blessed' FP ops."),
|
||||
clEnumValN(FPOpFusion::Strict, "off",
|
||||
"Only fuse FP ops when the result won't be affected."),
|
||||
clEnumValEnd));
|
||||
"Only fuse FP ops when the result won't be affected.")));
|
||||
|
||||
cl::opt<bool>
|
||||
DontPlaceZerosInBSS("nozero-initialized-in-bss",
|
||||
@ -269,8 +261,7 @@ JTableType("jump-table-type",
|
||||
clEnumValN(JumpTable::Simplified, "simplified",
|
||||
"Create one table per simplified function type."),
|
||||
clEnumValN(JumpTable::Full, "full",
|
||||
"Create one table per unique function type."),
|
||||
clEnumValEnd));
|
||||
"Create one table per unique function type.")));
|
||||
|
||||
cl::opt<llvm::EABI> EABIVersion(
|
||||
"meabi", cl::desc("Set EABI type (default depends on triple):"),
|
||||
@ -279,7 +270,7 @@ cl::opt<llvm::EABI> EABIVersion(
|
||||
"Triple default EABI version"),
|
||||
clEnumValN(EABI::EABI4, "4", "EABI version 4"),
|
||||
clEnumValN(EABI::EABI5, "5", "EABI version 5"),
|
||||
clEnumValN(EABI::GNU, "gnu", "EABI GNU"), clEnumValEnd));
|
||||
clEnumValN(EABI::GNU, "gnu", "EABI GNU")));
|
||||
|
||||
cl::opt<DebuggerKind>
|
||||
DebuggerTuningOpt("debugger-tune",
|
||||
@ -289,8 +280,7 @@ DebuggerTuningOpt("debugger-tune",
|
||||
clEnumValN(DebuggerKind::GDB, "gdb", "gdb"),
|
||||
clEnumValN(DebuggerKind::LLDB, "lldb", "lldb"),
|
||||
clEnumValN(DebuggerKind::SCE, "sce",
|
||||
"SCE targets (e.g. PS4)"),
|
||||
clEnumValEnd));
|
||||
"SCE targets (e.g. PS4)")));
|
||||
|
||||
// Common utility function tightly tied to the options listed here. Initializes
|
||||
// a TargetOptions object with CodeGen flags and returns it.
|
||||
|
@ -26,8 +26,7 @@ cl::opt<MCTargetOptions::AsmInstrumentation> AsmInstrumentation(
|
||||
cl::values(clEnumValN(MCTargetOptions::AsmInstrumentationNone, "none",
|
||||
"no instrumentation at all"),
|
||||
clEnumValN(MCTargetOptions::AsmInstrumentationAddress, "address",
|
||||
"instrument instructions with memory arguments"),
|
||||
clEnumValEnd));
|
||||
"instrument instructions with memory arguments")));
|
||||
|
||||
cl::opt<bool> RelaxAll("mc-relax-all",
|
||||
cl::desc("When used with filetype=obj, "
|
||||
|
@ -556,52 +556,43 @@ private:
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Enum valued command line option
|
||||
//
|
||||
#define clEnumVal(ENUMVAL, DESC) #ENUMVAL, int(ENUMVAL), DESC
|
||||
#define clEnumValN(ENUMVAL, FLAGNAME, DESC) FLAGNAME, int(ENUMVAL), DESC
|
||||
#define clEnumValEnd (reinterpret_cast<void *>(0))
|
||||
|
||||
// This represents a single enum value, using "int" as the underlying type.
|
||||
struct OptionEnumValue {
|
||||
StringRef Name;
|
||||
int Value;
|
||||
StringRef Description;
|
||||
};
|
||||
|
||||
#define clEnumVal(ENUMVAL, DESC) \
|
||||
cl::OptionEnumValue { #ENUMVAL, int(ENUMVAL), DESC }
|
||||
#define clEnumValN(ENUMVAL, FLAGNAME, DESC) \
|
||||
cl::OptionEnumValue { FLAGNAME, int(ENUMVAL), DESC }
|
||||
|
||||
// values - For custom data types, allow specifying a group of values together
|
||||
// as the values that go into the mapping that the option handler uses. Note
|
||||
// that the values list must always have a 0 at the end of the list to indicate
|
||||
// that the list has ended.
|
||||
// as the values that go into the mapping that the option handler uses.
|
||||
//
|
||||
template <class DataType> class ValuesClass {
|
||||
class ValuesClass {
|
||||
// Use a vector instead of a map, because the lists should be short,
|
||||
// the overhead is less, and most importantly, it keeps them in the order
|
||||
// inserted so we can print our option out nicely.
|
||||
SmallVector<std::pair<StringRef , std::pair<int, StringRef >>, 4> Values;
|
||||
void processValues(va_list Vals);
|
||||
SmallVector<OptionEnumValue, 4> Values;
|
||||
|
||||
public:
|
||||
ValuesClass(StringRef EnumName, DataType Val, StringRef Desc,
|
||||
va_list ValueArgs) {
|
||||
// Insert the first value, which is required.
|
||||
Values.push_back(std::make_pair(EnumName, std::make_pair(Val, Desc)));
|
||||
|
||||
// Process the varargs portion of the values...
|
||||
while (const char *enumName = va_arg(ValueArgs, const char * )) {
|
||||
DataType EnumVal = static_cast<DataType>(va_arg(ValueArgs, int));
|
||||
auto EnumDesc = StringRef(va_arg(ValueArgs, const char * ));
|
||||
Values.push_back(std::make_pair(StringRef(enumName), // Add value to value map
|
||||
std::make_pair(EnumVal, EnumDesc)));
|
||||
}
|
||||
}
|
||||
ValuesClass(std::initializer_list<OptionEnumValue> Options)
|
||||
: Values(Options) {}
|
||||
|
||||
template <class Opt> void apply(Opt &O) const {
|
||||
for (size_t i = 0, e = Values.size(); i != e; ++i)
|
||||
O.getParser().addLiteralOption(Values[i].first, Values[i].second.first,
|
||||
Values[i].second.second);
|
||||
for (auto Value : Values)
|
||||
O.getParser().addLiteralOption(Value.Name, Value.Value,
|
||||
Value.Description);
|
||||
}
|
||||
};
|
||||
|
||||
template <class DataType>
|
||||
ValuesClass<DataType> LLVM_END_WITH_NULL
|
||||
values(StringRef Arg, DataType Val, StringRef Desc, ...) {
|
||||
va_list ValueArgs;
|
||||
va_start(ValueArgs, Desc);
|
||||
ValuesClass<DataType> Vals(Arg, Val, Desc, ValueArgs);
|
||||
va_end(ValueArgs);
|
||||
return Vals;
|
||||
/// Helper to build a ValuesClass by forwarding a variable number of arguments
|
||||
/// as an initializer list to the ValuesClass constructor.
|
||||
template <typename... OptsTy> ValuesClass values(OptsTy... Options) {
|
||||
return ValuesClass({Options...});
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -39,8 +39,7 @@ static cl::opt<GVDAGType> ViewBlockFreqPropagationDAG(
|
||||
"display a graph using the raw "
|
||||
"integer fractional block frequency representation."),
|
||||
clEnumValN(GVDT_Count, "count", "display a graph using the real "
|
||||
"profile count if available."),
|
||||
clEnumValEnd));
|
||||
"profile count if available.")));
|
||||
|
||||
cl::opt<std::string>
|
||||
ViewBlockFreqFuncName("view-bfi-func-name", cl::Hidden,
|
||||
|
@ -54,8 +54,7 @@ static cl::opt<Region::PrintStyle, true> printStyleX("print-region-style",
|
||||
clEnumValN(Region::PrintBB, "bb",
|
||||
"print regions in detail with block_iterator"),
|
||||
clEnumValN(Region::PrintRN, "rn",
|
||||
"print regions in detail with element_iterator"),
|
||||
clEnumValEnd));
|
||||
"print regions in detail with element_iterator")));
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -24,8 +24,7 @@ static cl::opt<TargetLibraryInfoImpl::VectorLibrary> ClVectorLibrary(
|
||||
clEnumValN(TargetLibraryInfoImpl::Accelerate, "Accelerate",
|
||||
"Accelerate framework"),
|
||||
clEnumValN(TargetLibraryInfoImpl::SVML, "SVML",
|
||||
"Intel SVML library"),
|
||||
clEnumValEnd));
|
||||
"Intel SVML library")));
|
||||
|
||||
StringRef const TargetLibraryInfoImpl::StandardNames[LibFunc::NumLibFuncs] = {
|
||||
#define TLI_DEFINE_STRING
|
||||
|
@ -86,7 +86,7 @@ DwarfAccelTables("dwarf-accel-tables", cl::Hidden,
|
||||
cl::desc("Output prototype dwarf accelerator tables."),
|
||||
cl::values(clEnumVal(Default, "Default for platform"),
|
||||
clEnumVal(Enable, "Enabled"),
|
||||
clEnumVal(Disable, "Disabled"), clEnumValEnd),
|
||||
clEnumVal(Disable, "Disabled")),
|
||||
cl::init(Default));
|
||||
|
||||
static cl::opt<DefaultOnOff>
|
||||
@ -94,7 +94,7 @@ SplitDwarf("split-dwarf", cl::Hidden,
|
||||
cl::desc("Output DWARF5 split debug info."),
|
||||
cl::values(clEnumVal(Default, "Default for platform"),
|
||||
clEnumVal(Enable, "Enabled"),
|
||||
clEnumVal(Disable, "Disabled"), clEnumValEnd),
|
||||
clEnumVal(Disable, "Disabled")),
|
||||
cl::init(Default));
|
||||
|
||||
static cl::opt<DefaultOnOff>
|
||||
@ -102,7 +102,7 @@ DwarfPubSections("generate-dwarf-pub-sections", cl::Hidden,
|
||||
cl::desc("Generate DWARF pubnames and pubtypes sections"),
|
||||
cl::values(clEnumVal(Default, "Default for platform"),
|
||||
clEnumVal(Enable, "Enabled"),
|
||||
clEnumVal(Disable, "Disabled"), clEnumValEnd),
|
||||
clEnumVal(Disable, "Disabled")),
|
||||
cl::init(Default));
|
||||
|
||||
enum LinkageNameOption {
|
||||
@ -117,8 +117,7 @@ static cl::opt<LinkageNameOption>
|
||||
"Default for platform"),
|
||||
clEnumValN(AllLinkageNames, "All", "All"),
|
||||
clEnumValN(AbstractLinkageNames, "Abstract",
|
||||
"Abstract subprograms"),
|
||||
clEnumValEnd),
|
||||
"Abstract subprograms")),
|
||||
cl::init(DefaultLinkageNames));
|
||||
|
||||
static const char *const DWARFGroupName = "DWARF Emission";
|
||||
|
@ -33,8 +33,7 @@ static cl::opt<RegBankSelect::Mode> RegBankSelectMode(
|
||||
cl::values(clEnumValN(RegBankSelect::Mode::Fast, "regbankselect-fast",
|
||||
"Run the Fast mode (default mapping)"),
|
||||
clEnumValN(RegBankSelect::Mode::Greedy, "regbankselect-greedy",
|
||||
"Use the Greedy mode (best local mapping)"),
|
||||
clEnumValEnd));
|
||||
"Use the Greedy mode (best local mapping)")));
|
||||
|
||||
char RegBankSelect::ID = 0;
|
||||
INITIALIZE_PASS_BEGIN(RegBankSelect, DEBUG_TYPE,
|
||||
|
@ -42,9 +42,7 @@ static cl::opt<GVDAGType> ViewMachineBlockFreqPropagationDAG(
|
||||
"display a graph using the raw "
|
||||
"integer fractional block frequency representation."),
|
||||
clEnumValN(GVDT_Count, "count", "display a graph using the real "
|
||||
"profile count if available."),
|
||||
|
||||
clEnumValEnd));
|
||||
"profile count if available.")));
|
||||
|
||||
extern cl::opt<std::string> ViewBlockFreqFuncName;
|
||||
extern cl::opt<unsigned> ViewHotFreqPercent;
|
||||
|
@ -61,8 +61,7 @@ static cl::opt<SplitEditor::ComplementSpillMode> SplitSpillMode(
|
||||
cl::desc("Spill mode for splitting live ranges"),
|
||||
cl::values(clEnumValN(SplitEditor::SM_Partition, "default", "Default"),
|
||||
clEnumValN(SplitEditor::SM_Size, "size", "Optimize for size"),
|
||||
clEnumValN(SplitEditor::SM_Speed, "speed", "Optimize for speed"),
|
||||
clEnumValEnd),
|
||||
clEnumValN(SplitEditor::SM_Speed, "speed", "Optimize for speed")),
|
||||
cl::init(SplitEditor::SM_Speed));
|
||||
|
||||
static cl::opt<unsigned>
|
||||
|
@ -60,8 +60,7 @@ static cl::opt<UnsafeStackPtrStorageVal> USPStorage("safe-stack-usp-storage",
|
||||
cl::values(clEnumValN(ThreadLocalUSP, "thread-local",
|
||||
"Thread-local storage"),
|
||||
clEnumValN(SingleThreadUSP, "single-thread",
|
||||
"Non-thread-local storage"),
|
||||
clEnumValEnd));
|
||||
"Non-thread-local storage")));
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -129,8 +129,7 @@ static cl::opt<CFLAAType> UseCFLAA(
|
||||
clEnumValN(CFLAAType::Andersen, "anders",
|
||||
"Enable inclusion-based CFL-AA"),
|
||||
clEnumValN(CFLAAType::Both, "both",
|
||||
"Enable both variants of CFL-AA"),
|
||||
clEnumValEnd));
|
||||
"Enable both variants of CFL-AA")));
|
||||
|
||||
/// Allow standard passes to be disabled by command line options. This supports
|
||||
/// simple binary flags that either suppress the pass or do nothing.
|
||||
|
@ -56,8 +56,7 @@ PassDebugging("debug-pass", cl::Hidden,
|
||||
clEnumVal(Arguments , "print pass arguments to pass to 'opt'"),
|
||||
clEnumVal(Structure , "print pass structure before run()"),
|
||||
clEnumVal(Executions, "print pass name before it is executed"),
|
||||
clEnumVal(Details , "print pass details when it is executed"),
|
||||
clEnumValEnd));
|
||||
clEnumVal(Details , "print pass details when it is executed")));
|
||||
|
||||
namespace {
|
||||
typedef llvm::cl::list<const llvm::PassInfo *, bool, PassNameParser>
|
||||
|
@ -29,8 +29,7 @@ static cl::opt<AsmWriterVariantTy> AsmWriterVariant(
|
||||
"aarch64-neon-syntax", cl::init(Default),
|
||||
cl::desc("Choose style of NEON code to emit from AArch64 backend:"),
|
||||
cl::values(clEnumValN(Generic, "generic", "Emit generic NEON assembly"),
|
||||
clEnumValN(Apple, "apple", "Emit Apple-style NEON assembly"),
|
||||
clEnumValEnd));
|
||||
clEnumValN(Apple, "apple", "Emit Apple-style NEON assembly")));
|
||||
|
||||
AArch64MCAsmInfoDarwin::AArch64MCAsmInfoDarwin() {
|
||||
// We prefer NEON instructions to be printed in the short form.
|
||||
|
@ -59,8 +59,7 @@ IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT),
|
||||
clEnumValN(RestrictedIT, "arm-restrict-it",
|
||||
"Disallow deprecated IT based on ARMv8"),
|
||||
clEnumValN(NoRestrictedIT, "arm-no-restrict-it",
|
||||
"Allow IT blocks based on ARMv7"),
|
||||
clEnumValEnd));
|
||||
"Allow IT blocks based on ARMv7")));
|
||||
|
||||
/// ForceFastISel - Use the fast-isel, even for subtargets where it is not
|
||||
/// currently supported (for testing only).
|
||||
|
@ -65,8 +65,7 @@ static cl::opt<ImplicitItModeTy> ImplicitItMode(
|
||||
clEnumValN(ImplicitItModeTy::ARMOnly, "arm",
|
||||
"Accept in ARM, reject in Thumb"),
|
||||
clEnumValN(ImplicitItModeTy::ThumbOnly, "thumb",
|
||||
"Warn in ARM, emit implicit ITs in Thumb"),
|
||||
clEnumValEnd));
|
||||
"Warn in ARM, emit implicit ITs in Thumb")));
|
||||
|
||||
class ARMOperand;
|
||||
|
||||
|
@ -54,8 +54,7 @@ HWMultMode("msp430-hwmult-mode", cl::Hidden,
|
||||
clEnumValN(HWMultIntr, "interrupts",
|
||||
"Assume hardware multiplier can be used inside interrupts"),
|
||||
clEnumValN(HWMultNoIntr, "use",
|
||||
"Assume hardware multiplier cannot be used inside interrupts"),
|
||||
clEnumValEnd));
|
||||
"Assume hardware multiplier cannot be used inside interrupts")));
|
||||
|
||||
MSP430TargetLowering::MSP430TargetLowering(const TargetMachine &TM,
|
||||
const MSP430Subtarget &STI)
|
||||
|
@ -79,8 +79,7 @@ static cl::opt<CompactBranchPolicy> MipsCompactBranchPolicy(
|
||||
cl::values(
|
||||
clEnumValN(CB_Never, "never", "Do not use compact branches if possible."),
|
||||
clEnumValN(CB_Optimal, "optimal", "Use compact branches where appropiate (default)."),
|
||||
clEnumValN(CB_Always, "always", "Always use compact branches if possible."),
|
||||
clEnumValEnd
|
||||
clEnumValN(CB_Always, "always", "Always use compact branches if possible.")
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -31,8 +31,7 @@ static cl::opt<AsmWriterFlavorTy>
|
||||
AsmWriterFlavor("x86-asm-syntax", cl::init(ATT),
|
||||
cl::desc("Choose style of code to emit from X86 backend:"),
|
||||
cl::values(clEnumValN(ATT, "att", "Emit AT&T-style assembly"),
|
||||
clEnumValN(Intel, "intel", "Emit Intel-style assembly"),
|
||||
clEnumValEnd));
|
||||
clEnumValN(Intel, "intel", "Emit Intel-style assembly")));
|
||||
|
||||
static cl::opt<bool>
|
||||
MarkedJTDataRegions("mark-data-regions", cl::init(true),
|
||||
|
@ -72,8 +72,7 @@ cl::opt<InlinerFunctionImportStatsOpts> InlinerFunctionImportStats(
|
||||
cl::values(clEnumValN(InlinerFunctionImportStatsOpts::Basic, "basic",
|
||||
"basic statistics"),
|
||||
clEnumValN(InlinerFunctionImportStatsOpts::Verbose, "verbose",
|
||||
"printing of statistics for each inlined function"),
|
||||
clEnumValEnd),
|
||||
"printing of statistics for each inlined function")),
|
||||
cl::Hidden, cl::desc("Enable inliner stats for imported functions"));
|
||||
} // namespace
|
||||
|
||||
|
@ -92,8 +92,7 @@ static cl::opt<CFLAAType>
|
||||
clEnumValN(CFLAAType::Andersen, "anders",
|
||||
"Enable inclusion-based CFL-AA"),
|
||||
clEnumValN(CFLAAType::Both, "both",
|
||||
"Enable both variants of CFL-AA"),
|
||||
clEnumValEnd));
|
||||
"Enable both variants of CFL-AA")));
|
||||
|
||||
static cl::opt<bool>
|
||||
EnableMLSM("mlsm", cl::init(true), cl::Hidden,
|
||||
|
@ -79,8 +79,7 @@ static cl::opt<ReplaceExitVal> ReplaceExitValue(
|
||||
clEnumValN(OnlyCheapRepl, "cheap",
|
||||
"only replace exit value when the cost is cheap"),
|
||||
clEnumValN(AlwaysRepl, "always",
|
||||
"always replace exit value whenever possible"),
|
||||
clEnumValEnd));
|
||||
"always replace exit value whenever possible")));
|
||||
|
||||
namespace {
|
||||
struct RewritePhi;
|
||||
|
@ -60,8 +60,7 @@ cl::opt<OutputType> InterpreterSel(
|
||||
"compile the bitcode. Useful to avoid linking."),
|
||||
clEnumValN(Custom, "run-custom",
|
||||
"Use -exec-command to define a command to execute "
|
||||
"the bitcode. Useful for cross-compilation."),
|
||||
clEnumValEnd),
|
||||
"the bitcode. Useful for cross-compilation.")),
|
||||
cl::init(AutoPick));
|
||||
|
||||
cl::opt<OutputType> SafeInterpreterSel(
|
||||
@ -70,8 +69,7 @@ cl::opt<OutputType> SafeInterpreterSel(
|
||||
clEnumValN(RunLLC, "safe-run-llc", "Compile with LLC"),
|
||||
clEnumValN(Custom, "safe-run-custom",
|
||||
"Use -exec-command to define a command to execute "
|
||||
"the bitcode. Useful for cross-compilation."),
|
||||
clEnumValEnd),
|
||||
"the bitcode. Useful for cross-compilation.")),
|
||||
cl::init(AutoPick));
|
||||
|
||||
cl::opt<std::string> SafeInterpreterPath(
|
||||
|
@ -37,8 +37,7 @@ namespace {
|
||||
"mods-to-disk",
|
||||
"Dump modules to the current "
|
||||
"working directory. (WARNING: "
|
||||
"will overwrite existing files)."),
|
||||
clEnumValEnd),
|
||||
"will overwrite existing files).")),
|
||||
cl::Hidden);
|
||||
|
||||
cl::opt<bool> OrcInlineStubs("orc-lazy-inline-stubs",
|
||||
|
@ -91,8 +91,7 @@ namespace {
|
||||
"Orc-based MCJIT replacement"),
|
||||
clEnumValN(JITKind::OrcLazy,
|
||||
"orc-lazy",
|
||||
"Orc-based lazy JIT."),
|
||||
clEnumValEnd));
|
||||
"Orc-based lazy JIT.")));
|
||||
|
||||
// The MCJIT supports building for a target address space separate from
|
||||
// the JIT compilation process. Use a forked process and a copying
|
||||
@ -194,8 +193,7 @@ namespace {
|
||||
clEnumValN(Reloc::PIC_, "pic",
|
||||
"Fully relocatable, position independent code"),
|
||||
clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic",
|
||||
"Relocatable external references, non-relocatable code"),
|
||||
clEnumValEnd));
|
||||
"Relocatable external references, non-relocatable code")));
|
||||
|
||||
cl::opt<llvm::CodeModel::Model>
|
||||
CMModel("code-model",
|
||||
@ -210,8 +208,7 @@ namespace {
|
||||
clEnumValN(CodeModel::Medium, "medium",
|
||||
"Medium code model"),
|
||||
clEnumValN(CodeModel::Large, "large",
|
||||
"Large code model"),
|
||||
clEnumValEnd));
|
||||
"Large code model")));
|
||||
|
||||
cl::opt<bool>
|
||||
GenerateSoftFloatCalls("soft-float",
|
||||
@ -228,8 +225,7 @@ namespace {
|
||||
clEnumValN(FloatABI::Soft, "soft",
|
||||
"Soft float ABI (implied by -soft-float)"),
|
||||
clEnumValN(FloatABI::Hard, "hard",
|
||||
"Hard float ABI (uses FP registers)"),
|
||||
clEnumValEnd));
|
||||
"Hard float ABI (uses FP registers)")));
|
||||
|
||||
ExitOnError ExitOnErr;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ static cl::opt<Format>
|
||||
FormatOpt("format", cl::desc("Archive format to create"),
|
||||
cl::values(clEnumValN(Default, "default", "default"),
|
||||
clEnumValN(GNU, "gnu", "gnu"),
|
||||
clEnumValN(BSD, "bsd", "bsd"), clEnumValEnd));
|
||||
clEnumValN(BSD, "bsd", "bsd")));
|
||||
|
||||
static std::string Options;
|
||||
|
||||
|
@ -485,8 +485,7 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
|
||||
cl::values(clEnumValN(CoverageViewOptions::OutputFormat::Text, "text",
|
||||
"Text output"),
|
||||
clEnumValN(CoverageViewOptions::OutputFormat::HTML, "html",
|
||||
"HTML output"),
|
||||
clEnumValEnd),
|
||||
"HTML output")),
|
||||
cl::init(CoverageViewOptions::OutputFormat::Text));
|
||||
|
||||
cl::opt<bool> FilenameEquivalence(
|
||||
|
@ -72,7 +72,7 @@ static cl::opt<DIDumpType> DumpType(
|
||||
".debug_str_offsets.dwo"),
|
||||
clEnumValN(DIDT_CUIndex, "cu_index", ".debug_cu_index"),
|
||||
clEnumValN(DIDT_GdbIndex, "gdb_index", ".gdb_index"),
|
||||
clEnumValN(DIDT_TUIndex, "tu_index", ".debug_tu_index"), clEnumValEnd));
|
||||
clEnumValN(DIDT_TUIndex, "tu_index", ".debug_tu_index")));
|
||||
|
||||
static void error(StringRef Filename, std::error_code EC) {
|
||||
if (!EC)
|
||||
|
@ -102,8 +102,7 @@ cl::opt<ThinLTOModes> ThinLTOMode(
|
||||
"(requires -thinlto-index)."),
|
||||
clEnumValN(THINOPT, "optimize", "Perform ThinLTO optimizations."),
|
||||
clEnumValN(THINCODEGEN, "codegen", "CodeGen (expected to match llc)"),
|
||||
clEnumValN(THINALL, "run", "Perform ThinLTO end-to-end"),
|
||||
clEnumValEnd));
|
||||
clEnumValN(THINALL, "run", "Perform ThinLTO end-to-end")));
|
||||
|
||||
static cl::opt<std::string>
|
||||
ThinLTOIndex("thinlto-index",
|
||||
|
@ -31,8 +31,7 @@ Action(cl::desc("Action to perform:"),
|
||||
cl::values(clEnumValN(AC_Assemble, "assemble",
|
||||
"Assemble a .s file (default)"),
|
||||
clEnumValN(AC_Disassemble, "disassemble",
|
||||
"Disassemble strings of hex bytes"),
|
||||
clEnumValEnd));
|
||||
"Disassemble strings of hex bytes")));
|
||||
|
||||
static cl::opt<std::string>
|
||||
TripleName("triple", cl::desc("Target triple to assemble for, "
|
||||
|
@ -66,8 +66,7 @@ CompressDebugSections("compress-debug-sections", cl::ValueOptional,
|
||||
clEnumValN(DebugCompressionType::DCT_Zlib, "zlib",
|
||||
"Use zlib compression"),
|
||||
clEnumValN(DebugCompressionType::DCT_ZlibGnu, "zlib-gnu",
|
||||
"Use zlib-gnu compression (deprecated)"),
|
||||
clEnumValEnd));
|
||||
"Use zlib-gnu compression (deprecated)")));
|
||||
|
||||
static cl::opt<bool>
|
||||
ShowInst("show-inst", cl::desc("Show internal instruction representation"));
|
||||
@ -105,8 +104,7 @@ FileType("filetype", cl::init(OFT_AssemblyFile),
|
||||
clEnumValN(OFT_Null, "null",
|
||||
"Don't emit anything (for timing purposes)"),
|
||||
clEnumValN(OFT_ObjectFile, "obj",
|
||||
"Emit a native object ('.o') file"),
|
||||
clEnumValEnd));
|
||||
"Emit a native object ('.o') file")));
|
||||
|
||||
static cl::list<std::string>
|
||||
IncludeDirs("I", cl::desc("Directory of include files"),
|
||||
@ -148,8 +146,7 @@ CMModel("code-model",
|
||||
clEnumValN(CodeModel::Medium, "medium",
|
||||
"Medium code model"),
|
||||
clEnumValN(CodeModel::Large, "large",
|
||||
"Large code model"),
|
||||
clEnumValEnd));
|
||||
"Large code model")));
|
||||
|
||||
static cl::opt<bool>
|
||||
NoInitialTextSection("n", cl::desc("Don't assume assembly file starts "
|
||||
@ -190,8 +187,7 @@ Action(cl::desc("Action to perform:"),
|
||||
clEnumValN(AC_Disassemble, "disassemble",
|
||||
"Disassemble strings of hex bytes"),
|
||||
clEnumValN(AC_MDisassemble, "mdis",
|
||||
"Marked up disassembly of strings of hex bytes"),
|
||||
clEnumValEnd));
|
||||
"Marked up disassembly of strings of hex bytes")));
|
||||
|
||||
static const Target *GetTarget(const char *ProgName) {
|
||||
// Figure out the target triple.
|
||||
|
@ -56,7 +56,7 @@ cl::opt<OutputFormatTy> OutputFormat(
|
||||
"format", cl::desc("Specify output format"),
|
||||
cl::values(clEnumVal(bsd, "BSD format"), clEnumVal(sysv, "System V format"),
|
||||
clEnumVal(posix, "POSIX.2 format"),
|
||||
clEnumVal(darwin, "Darwin -m format"), clEnumValEnd),
|
||||
clEnumVal(darwin, "Darwin -m format")),
|
||||
cl::init(bsd));
|
||||
cl::alias OutputFormat2("f", cl::desc("Alias for --format"),
|
||||
cl::aliasopt(OutputFormat));
|
||||
@ -143,7 +143,7 @@ enum Radix { d, o, x };
|
||||
cl::opt<Radix>
|
||||
AddressRadix("radix", cl::desc("Radix (o/d/x) for printing symbol Values"),
|
||||
cl::values(clEnumVal(d, "decimal"), clEnumVal(o, "octal"),
|
||||
clEnumVal(x, "hexadecimal"), clEnumValEnd),
|
||||
clEnumVal(x, "hexadecimal")),
|
||||
cl::init(x));
|
||||
cl::alias RadixAlias("t", cl::desc("Alias for --radix"),
|
||||
cl::aliasopt(AddressRadix));
|
||||
|
@ -188,8 +188,7 @@ cl::opt<bool> PrintFaultMaps("fault-map-section",
|
||||
|
||||
cl::opt<DIDumpType> llvm::DwarfDumpType(
|
||||
"dwarf", cl::init(DIDT_Null), cl::desc("Dump of dwarf debug sections:"),
|
||||
cl::values(clEnumValN(DIDT_Frames, "frames", ".debug_frame"),
|
||||
clEnumValEnd));
|
||||
cl::values(clEnumValN(DIDT_Frames, "frames", ".debug_frame")));
|
||||
|
||||
cl::opt<bool> PrintSource(
|
||||
"source",
|
||||
|
@ -393,14 +393,13 @@ static int merge_main(int argc, const char *argv[]) {
|
||||
cl::opt<ProfileKinds> ProfileKind(
|
||||
cl::desc("Profile kind:"), cl::init(instr),
|
||||
cl::values(clEnumVal(instr, "Instrumentation profile (default)"),
|
||||
clEnumVal(sample, "Sample profile"), clEnumValEnd));
|
||||
clEnumVal(sample, "Sample profile")));
|
||||
cl::opt<ProfileFormat> OutputFormat(
|
||||
cl::desc("Format of output profile"), cl::init(PF_Binary),
|
||||
cl::values(clEnumValN(PF_Binary, "binary", "Binary encoding (default)"),
|
||||
clEnumValN(PF_Text, "text", "Text encoding"),
|
||||
clEnumValN(PF_GCC, "gcc",
|
||||
"GCC encoding (only meaningful for -sample)"),
|
||||
clEnumValEnd));
|
||||
"GCC encoding (only meaningful for -sample)")));
|
||||
cl::opt<bool> OutputSparse("sparse", cl::init(false),
|
||||
cl::desc("Generate a sparse profile (only meaningful for -instr)"));
|
||||
cl::opt<unsigned> NumThreads(
|
||||
@ -622,7 +621,7 @@ static int show_main(int argc, const char *argv[]) {
|
||||
cl::opt<ProfileKinds> ProfileKind(
|
||||
cl::desc("Profile kind:"), cl::init(instr),
|
||||
cl::values(clEnumVal(instr, "Instrumentation profile (default)"),
|
||||
clEnumVal(sample, "Sample profile"), clEnumValEnd));
|
||||
clEnumVal(sample, "Sample profile")));
|
||||
|
||||
cl::ParseCommandLineOptions(argc, argv, "LLVM profile data summary\n");
|
||||
|
||||
|
@ -264,7 +264,7 @@ namespace opts {
|
||||
cl::opt<OutputStyleTy>
|
||||
Output("elf-output-style", cl::desc("Specify ELF dump style"),
|
||||
cl::values(clEnumVal(LLVM, "LLVM default style"),
|
||||
clEnumVal(GNU, "GNU readelf style"), clEnumValEnd),
|
||||
clEnumVal(GNU, "GNU readelf style")),
|
||||
cl::init(LLVM));
|
||||
} // namespace opts
|
||||
|
||||
|
@ -66,8 +66,7 @@ Action(cl::desc("Action to perform:"),
|
||||
clEnumValN(AC_PrintObjectLineInfo, "printobjline",
|
||||
"Like -printlineinfo but does not load the object first"),
|
||||
clEnumValN(AC_Verify, "verify",
|
||||
"Load, link and verify the resulting memory image."),
|
||||
clEnumValEnd));
|
||||
"Load, link and verify the resulting memory image.")));
|
||||
|
||||
static cl::opt<std::string>
|
||||
EntryPoint("entry",
|
||||
|
@ -40,14 +40,14 @@ static cl::opt<OutputFormatTy>
|
||||
OutputFormat("format", cl::desc("Specify output format"),
|
||||
cl::values(clEnumVal(sysv, "System V format"),
|
||||
clEnumVal(berkeley, "Berkeley format"),
|
||||
clEnumVal(darwin, "Darwin -m format"), clEnumValEnd),
|
||||
clEnumVal(darwin, "Darwin -m format")),
|
||||
cl::init(berkeley));
|
||||
|
||||
static cl::opt<OutputFormatTy> OutputFormatShort(
|
||||
cl::desc("Specify output format"),
|
||||
cl::values(clEnumValN(sysv, "A", "System V format"),
|
||||
clEnumValN(berkeley, "B", "Berkeley format"),
|
||||
clEnumValN(darwin, "m", "Darwin -m format"), clEnumValEnd),
|
||||
clEnumValN(darwin, "m", "Darwin -m format")),
|
||||
cl::init(berkeley));
|
||||
|
||||
static bool BerkeleyHeaderPrinted = false;
|
||||
@ -81,8 +81,7 @@ static cl::opt<RadixTy>
|
||||
RadixShort(cl::desc("Print size in radix:"),
|
||||
cl::values(clEnumValN(octal, "o", "Print size in octal"),
|
||||
clEnumValN(decimal, "d", "Print size in decimal"),
|
||||
clEnumValN(hexadecimal, "x", "Print size in hexadecimal"),
|
||||
clEnumValEnd),
|
||||
clEnumValN(hexadecimal, "x", "Print size in hexadecimal")),
|
||||
cl::init(decimal));
|
||||
|
||||
static cl::opt<bool>
|
||||
|
@ -46,8 +46,7 @@ static cl::opt<FunctionNameKind> ClPrintFunctions(
|
||||
clEnumValN(FunctionNameKind::ShortName, "short",
|
||||
"print short function name"),
|
||||
clEnumValN(FunctionNameKind::LinkageName, "linkage",
|
||||
"print function linkage name"),
|
||||
clEnumValEnd));
|
||||
"print function linkage name")));
|
||||
|
||||
static cl::opt<bool>
|
||||
ClUseRelativeAddress("relative-address", cl::init(false),
|
||||
|
@ -92,7 +92,7 @@ cl::opt<ActionType> Action(
|
||||
"REMOVED. Use -symbolize & coverage-report-server.py."),
|
||||
clEnumValN(SymbolizeAction, "symbolize",
|
||||
"Produces a symbolized JSON report from binary report."),
|
||||
clEnumValN(MergeAction, "merge", "Merges reports."), clEnumValEnd));
|
||||
clEnumValN(MergeAction, "merge", "Merges reports.")));
|
||||
|
||||
static cl::list<std::string>
|
||||
ClInputFiles(cl::Positional, cl::OneOrMore,
|
||||
|
@ -91,8 +91,7 @@ namespace {
|
||||
clEnumValN(GenAttributes, "gen-attrs",
|
||||
"Generate attributes"),
|
||||
clEnumValN(GenSearchableTables, "gen-searchable-tables",
|
||||
"Generate generic binary-searchable table"),
|
||||
clEnumValEnd));
|
||||
"Generate generic binary-searchable table")));
|
||||
|
||||
cl::opt<std::string>
|
||||
Class("class", cl::desc("Print Enum list for this class"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user