16 #ifndef LLVM_CODEGEN_COMMANDFLAGS_H
17 #define LLVM_CODEGEN_COMMANDFLAGS_H
34 MArch(
"march",
cl::desc(
"Architecture to generate code for (see --version)"));
38 cl::desc(
"Target a specific cpu type (-mcpu=help for details)"),
45 cl::desc(
"Target specific attributes (-mattr=help for details)"),
49 "relocation-model",
cl::desc(
"Choose relocation model"),
53 "Fully relocatable, position independent code"),
55 "Relocatable external references, non-relocatable code"),
57 "Code and read-only data relocatable, accessed PC-relative"),
59 "Read-write data relocatable, accessed relative to static base"),
61 "Combination of ropi and rwpi")));
76 "POSIX thread model"),
78 "Single thread model")));
85 "Target default code model"),
93 "Large code model")));
100 "default exception handling model"),
102 "DWARF-like CFI based exception handling"),
104 "SjLj exception handling"),
106 "ARM EHABI exceptions"),
108 "Windows exception model")));
112 cl::desc(
"Choose a file type (not all types are supported by all targets):"),
115 "Emit an assembly ('.s') file"),
117 "Emit a native object ('.o') file"),
119 "Emit nothing, for performance testing")));
123 cl::desc(
"Enable less precise MAD instructions to be generated"),
128 cl::desc(
"Disable frame pointer elimination optimization"),
133 cl::desc(
"Enable optimizations that may decrease FP precision"),
138 cl::desc(
"Enable FP math optimizations that assume no +-Infs"),
143 cl::desc(
"Enable FP math optimizations that assume no NaNs"),
148 cl::desc(
"Enable setting the FP exceptions build "
149 "attribute not to use exceptions"),
154 cl::desc(
"Select which denormal numbers the code is permitted to require"),
158 "IEEE 754 denormal numbers"),
160 "the sign of a flushed-to-zero number is preserved "
163 "denormals are flushed to positive zero")));
168 cl::desc(
"Force codegen to assume rounding mode can change dynamically"),
177 "Target default float ABI type"),
179 "Soft float ABI (implied by -soft-float)"),
181 "Hard float ABI (uses FP registers)")));
185 cl::desc(
"Enable aggressive formation of fused FP ops"),
189 "Fuse FP ops whenever profitable"),
191 "Only fuse 'blessed' FP ops."),
193 "Only fuse FP ops when the result won't be affected.")));
197 cl::desc(
"Don't place zero-initialized symbols into bss section"),
202 cl::desc(
"Turn fastcc calls into tail calls by (potentially) changing ABI."),
212 cl::desc(
"Order local stack symbols."),
217 cl::desc(
"Override default stack alignment"),
222 cl::desc(
"Force align the stack to the minimum alignment"),
227 cl::desc(
"Emit a call to trap function rather than a trap instruction"),
232 cl::desc(
"Use .ctors instead of .init_array."),
236 "relax-elf-relocations",
237 cl::desc(
"Emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL on x86-64 ELF"),
241 cl::desc(
"Emit data into separate sections"),
246 cl::desc(
"Emit functions into separate sections"),
254 cl::desc(
"Give unique names to every section"),
258 "meabi",
cl::desc(
"Set EABI type (default depends on triple):"),
261 "Triple default EABI version"),
268 cl::desc(
"Tune debug info for a particular debugger"),
274 "SCE targets (e.g. PS4)")));
316 if (
MCPU ==
"native")
329 if (
MCPU ==
"native") {
332 for (
auto &
F : HostFeatures)
336 for (
unsigned i = 0;
i !=
MAttrs.size(); ++
i)
347 auto &Ctx =
F.getContext();
354 if (!Features.
empty())
356 "target-features", Features);
360 "no-frame-pointer-elim",
365 "disable-tail-calls",
375 if (
auto *
Call = dyn_cast<CallInst>(&
I))
376 if (
const auto *F =
Call->getCalledFunction())
377 if (F->getIntrinsicID() == Intrinsic::debugtrap ||
378 F->getIntrinsicID() == Intrinsic::trap)
385 F.setAttributes(NewAttrs);
unsigned StackSymbolOrdering
StackSymbolOrdering - When true, this will allow CodeGen to order the local stack symbols (for code s...
cl::opt< llvm::FloatABI::ABIType > FloatABIForCalls("float-abi", cl::desc("Choose float ABI type"), cl::init(FloatABI::Default), cl::values(clEnumValN(FloatABI::Default,"default","Target default float ABI type"), clEnumValN(FloatABI::Soft,"soft","Soft float ABI (implied by -soft-float)"), clEnumValN(FloatABI::Hard,"hard","Hard float ABI (uses FP registers)")))
cl::opt< bool > EnableNoNaNsFPMath("enable-no-nans-fp-math", cl::desc("Enable FP math optimizations that assume no NaNs"), cl::init(false))
unsigned NoTrappingFPMath
NoTrappingFPMath - This flag is enabled when the -enable-no-trapping-fp-math is specified on the comm...
cl::opt< bool > UniqueSectionNames("unique-section-names", cl::desc("Give unique names to every section"), cl::init(true))
cl::opt< bool > StackRealign("stackrealign", cl::desc("Force align the stack to the minimum alignment"), cl::init(false))
MCTargetOptions MCOptions
Machine level options.
cl::opt< ThreadModel::Model > TMModel("thread-model", cl::desc("Choose threading model"), cl::init(ThreadModel::POSIX), cl::values(clEnumValN(ThreadModel::POSIX,"posix","POSIX thread model"), clEnumValN(ThreadModel::Single,"single","Single thread model")))
static std::string getCPUStr()
A Module instance is used to store all the information related to an LLVM module. ...
EABI EABIVersion
EABIVersion - This flag specifies the EABI version.
unsigned DataSections
Emit data into separate sections.
DWARF-like instruction based exceptions.
cl::opt< llvm::FPOpFusion::FPOpFusionMode > FuseFPOps("fp-contract", cl::desc("Enable aggressive formation of fused FP ops"), cl::init(FPOpFusion::Standard), cl::values(clEnumValN(FPOpFusion::Fast,"fast","Fuse FP ops whenever profitable"), clEnumValN(FPOpFusion::Standard,"on","Only fuse 'blessed' FP ops."), clEnumValN(FPOpFusion::Strict,"off","Only fuse FP ops when the result won't be affected.")))
static Optional< Reloc::Model > getRelocModel()
setjmp/longjmp based exceptions
cl::opt< DebuggerKind > DebuggerTuningOpt("debugger-tune", cl::desc("Tune debug info for a particular debugger"), cl::init(DebuggerKind::Default), cl::values(clEnumValN(DebuggerKind::GDB,"gdb","gdb"), clEnumValN(DebuggerKind::LLDB,"lldb","lldb"), clEnumValN(DebuggerKind::SCE,"sce","SCE targets (e.g. PS4)")))
cl::opt< llvm::FPDenormal::DenormalMode > DenormalMode("denormal-fp-math", cl::desc("Select which denormal numbers the code is permitted to require"), cl::init(FPDenormal::IEEE), cl::values(clEnumValN(FPDenormal::IEEE,"ieee","IEEE 754 denormal numbers"), clEnumValN(FPDenormal::PreserveSign,"preserve-sign","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")))
ThreadModel::Model ThreadModel
ThreadModel - This flag specifies the type of threading model to assume for things like atomics...
cl::opt< llvm::CodeModel::Model > CMModel("code-model", cl::desc("Choose code model"), cl::init(CodeModel::Default), cl::values(clEnumValN(CodeModel::Default,"default","Target default code model"), clEnumValN(CodeModel::Small,"small","Small code model"), clEnumValN(CodeModel::Kernel,"kernel","Kernel code model"), clEnumValN(CodeModel::Medium,"medium","Medium code model"), clEnumValN(CodeModel::Large,"large","Large code model")))
static MCTargetOptions InitMCTargetOptionsFromFlags()
ExceptionHandling ExceptionModel
What exception model to use.
void AddFeature(StringRef String, bool Enable=true)
Adding Features.
cl::opt< bool > EnableFPMAD("enable-fp-mad", cl::desc("Enable less precise MAD instructions to be generated"), cl::init(false))
static TargetOptions InitTargetOptionsFromCodeGenFlags()
unsigned NoNaNsFPMath
NoNaNsFPMath - This flag is enabled when the -enable-no-nans-fp-math flag is specified on the command...
unsigned FunctionSections
Emit functions into separate sections.
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
cl::opt< llvm::ExceptionHandling > ExceptionModel("exception-model", cl::desc("exception model"), cl::init(ExceptionHandling::None), cl::values(clEnumValN(ExceptionHandling::None,"default","default exception handling model"), clEnumValN(ExceptionHandling::DwarfCFI,"dwarf","DWARF-like CFI based exception handling"), clEnumValN(ExceptionHandling::SjLj,"sjlj","SjLj exception handling"), clEnumValN(ExceptionHandling::ARM,"arm","ARM EHABI exceptions"), clEnumValN(ExceptionHandling::WinEH,"wineh","Windows exception model")))
unsigned UniqueSectionNames
cl::opt< bool > DisableFPElim("disable-fp-elim", cl::desc("Disable frame pointer elimination optimization"), cl::init(false))
cl::opt< bool > DontPlaceZerosInBSS("nozero-initialized-in-bss", cl::desc("Don't place zero-initialized symbols into bss section"), cl::init(false))
ValuesClass values(OptsTy...Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
DebuggerKind DebuggerTuning
Which debugger to tune for.
cl::opt< bool > RelaxELFRelocations("relax-elf-relocations", cl::desc("Emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL on x86-64 ELF"), cl::init(false))
initializer< Ty > init(const Ty &Val)
unsigned UnsafeFPMath
UnsafeFPMath - This flag is enabled when the -enable-unsafe-fp-math flag is specified on the command ...
FPOpFusion::FPOpFusionMode AllowFPOpFusion
AllowFPOpFusion - This flag is set by the -fuse-fp-ops=xxx option.
cl::opt< bool > EnableNoTrappingFPMath("enable-no-trapping-fp-math", cl::desc("Enable setting the FP exceptions build ""attribute not to use exceptions"), cl::init(false))
static void setFunctionAttributes(StringRef CPU, StringRef Features, Module &M)
Set function attributes of functions in Module M based on CPU, Features, and command line flags...
cl::list< std::string > MAttrs("mattr", cl::CommaSeparated, cl::desc("Target specific attributes (-mattr=help for details)"), cl::value_desc("a1,+a2,-a3,..."))
cl::opt< bool > EnableNoInfsFPMath("enable-no-infs-fp-math", cl::desc("Enable FP math optimizations that assume no +-Infs"), cl::init(false))
unsigned GuaranteedTailCallOpt
GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is specified on the commandline...
unsigned NoInfsFPMath
NoInfsFPMath - This flag is enabled when the -enable-no-infs-fp-math flag is specified on the command...
cl::opt< TargetMachine::CodeGenFileType > FileType("filetype", cl::init(TargetMachine::CGFT_AssemblyFile), cl::desc("Choose a file type (not all types are supported by all targets):"), cl::values(clEnumValN(TargetMachine::CGFT_AssemblyFile,"asm","Emit an assembly ('.s') file"), clEnumValN(TargetMachine::CGFT_ObjectFile,"obj","Emit a native object ('.o') file"), clEnumValN(TargetMachine::CGFT_Null,"null","Emit nothing, for performance testing")))
FPDenormal::DenormalMode FPDenormalMode
FPDenormalMode - This flags specificies which denormal numbers the code is permitted to require...
unsigned NoZerosInBSS
NoZerosInBSS - By default some codegens place zero-initialized data to .bss section.
cl::opt< Reloc::Model > RelocModel("relocation-model", cl::desc("Choose relocation model"), cl::values(clEnumValN(Reloc::Static,"static","Non-relocatable code"), clEnumValN(Reloc::PIC_,"pic","Fully relocatable, position independent code"), clEnumValN(Reloc::DynamicNoPIC,"dynamic-no-pic","Relocatable external references, non-relocatable code"), clEnumValN(Reloc::ROPI,"ropi","Code and read-only data relocatable, accessed PC-relative"), clEnumValN(Reloc::RWPI,"rwpi","Read-write data relocatable, accessed relative to static base"), clEnumValN(Reloc::ROPI_RWPI,"ropi-rwpi","Combination of ropi and rwpi")))
std::string getString() const
Features string accessors.
cl::opt< bool > StackSymbolOrdering("stack-symbol-ordering", cl::desc("Order local stack symbols."), cl::init(true))
cl::opt< bool > EnableUnsafeFPMath("enable-unsafe-fp-math", cl::desc("Enable optimizations that may decrease FP precision"), cl::init(false))
cl::opt< std::string > MCPU("mcpu", cl::desc("Target a specific cpu type (-mcpu=help for details)"), cl::value_desc("cpu-name"), cl::init(""))
cl::opt< bool > FunctionSections("function-sections", cl::desc("Emit functions into separate sections"), cl::init(false))
unsigned UseInitArray
UseInitArray - Use .init_array instead of .ctors for static constructors.
Module.h This file contains the declarations for the Module class.
cl::opt< std::string > MArch("march", cl::desc("Architecture to generate code for (see --version)"))
cl::opt< bool > DisableTailCalls("disable-tail-calls", cl::desc("Never emit tail calls"), cl::init(false))
unsigned StackAlignmentOverride
StackAlignmentOverride - Override default stack alignment for target.
SubtargetFeatures - Manages the enabling and disabling of subtarget specific features.
cl::opt< bool > DataSections("data-sections", cl::desc("Emit data into separate sections"), cl::init(false))
static std::string getFeaturesStr()
unsigned EmulatedTLS
EmulatedTLS - This flag enables emulated TLS model, using emutls function in the runtime library...
cl::opt< llvm::EABI > EABIVersion("meabi", cl::desc("Set EABI type (default depends on triple):"), cl::init(EABI::Default), cl::values(clEnumValN(EABI::Default,"default","Triple default EABI version"), clEnumValN(EABI::EABI4,"4","EABI version 4"), clEnumValN(EABI::EABI5,"5","EABI version 5"), clEnumValN(EABI::GNU,"gnu","EABI GNU")))
unsigned RelaxELFRelocations
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
cl::opt< unsigned > OverrideStackAlignment("stack-alignment", cl::desc("Override default stack alignment"), cl::init(0))
static StringRef toStringRef(bool B)
Construct a string ref from a boolean.
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
cl::opt< std::string > TrapFuncName("trap-func", cl::Hidden, cl::desc("Emit a call to trap function rather than a trap instruction"), cl::init(""))
StringRef getHostCPUName()
getHostCPUName - Get the LLVM name for the host CPU.
cl::opt< bool > EnableHonorSignDependentRoundingFPMath("enable-sign-dependent-rounding-fp-math", cl::Hidden, cl::desc("Force codegen to assume rounding mode can change dynamically"), cl::init(false))
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
unsigned HonorSignDependentRoundingFPMathOption
HonorSignDependentRoundingFPMath - This returns true when the -enable-sign-dependent-rounding-fp-math...
const FeatureBitset Features
cl::opt< bool > UseCtors("use-ctors", cl::desc("Use .ctors instead of .init_array."), cl::init(false))
StringRef - Represent a constant reference to a string, i.e.
cl::opt< bool > EnableGuaranteedTailCallOpt("tailcallopt", cl::desc("Turn fastcc calls into tail calls by (potentially) changing ABI."), cl::init(false))
bool getHostCPUFeatures(StringMap< bool > &Features)
getHostCPUFeatures - Get the LLVM names for the host CPU features.
unsigned LessPreciseFPMADOption
LessPreciseFPMAD - This flag is enabled when the -enable-fp-mad is specified on the command line...
cl::opt< bool > EmulatedTLS("emulated-tls", cl::desc("Use emulated TLS model"), cl::init(false))
AttributeSet addAttributes(LLVMContext &C, unsigned Index, AttributeSet Attrs) const
Add attributes to the attribute set at the given index.
FloatABI::ABIType FloatABIType
FloatABIType - This setting is set by -float-abi=xxx option is specfied on the command line...