31 cl::desc(
"Architecture to generate code for (see --version)"));
35 cl::desc(
"Target a specific cpu type (-mcpu=help for details)"),
40 cl::desc(
"Target specific attributes (-mattr=help for details)"),
44 "relocation-model",
cl::desc(
"Choose relocation model"),
48 "Fully relocatable, position independent code"),
50 "Relocatable external references, non-relocatable code"),
52 "Code and read-only data relocatable, accessed PC-relative"),
55 "Read-write data relocatable, accessed relative to static base"),
57 "Combination of ropi and rwpi")));
60 if (RelocModel.getNumOccurrences()) {
68 "thread-model",
cl::desc(
"Choose threading model"),
72 "Single thread model")));
75 "code-model",
cl::desc(
"Choose code model"),
83 if (CMModel.getNumOccurrences()) {
91 "exception-model",
cl::desc(
"exception model"),
95 "default exception handling model"),
97 "DWARF-like CFI based exception handling"),
101 "Windows exception model"),
103 "WebAssembly exception handling")));
108 "Choose a file type (not all types are supported by all targets):"),
110 "Emit an assembly ('.s') file"),
112 "Emit a native object ('.o') file"),
114 "Emit nothing, for performance testing")));
117 "frame-pointer",
cl::desc(
"Specify frame pointer elimination optimization"),
121 "Disable frame pointer elimination"),
123 "Disable frame pointer elimination for non-leaf frame"),
125 "Enable frame pointer elimination")));
128 "enable-unsafe-fp-math",
129 cl::desc(
"Enable optimizations that may decrease FP precision"),
133 "enable-no-infs-fp-math",
134 cl::desc(
"Enable FP math optimizations that assume no +-Infs"),
138 "enable-no-nans-fp-math",
139 cl::desc(
"Enable FP math optimizations that assume no NaNs"),
143 "enable-no-signed-zeros-fp-math",
144 cl::desc(
"Enable FP math optimizations that assume " 145 "the sign of 0 is insignificant"),
149 EnableNoTrappingFPMath(
"enable-no-trapping-fp-math",
150 cl::desc(
"Enable setting the FP exceptions build " 151 "attribute not to use exceptions"),
156 cl::desc(
"Select which denormal numbers the code is permitted to require"),
159 "IEEE 754 denormal numbers"),
161 "the sign of a flushed-to-zero number is preserved " 164 "denormals are flushed to positive zero")));
167 "enable-sign-dependent-rounding-fp-math",
cl::Hidden,
168 cl::desc(
"Force codegen to assume rounding mode can change dynamically"),
174 "Target default float ABI type"),
176 "Soft float ABI (implied by -soft-float)"),
178 "Hard float ABI (uses FP registers)")));
181 "fp-contract",
cl::desc(
"Enable aggressive formation of fused FP ops"),
187 "Only fuse FP ops when the result won't be affected.")));
190 "nozero-initialized-in-bss",
191 cl::desc(
"Don't place zero-initialized symbols into bss section"),
197 "Turn fastcc calls into tail calls by (potentially) changing ABI."),
204 static cl::opt<bool> StackSymbolOrdering(
"stack-symbol-ordering",
205 cl::desc(
"Order local stack symbols."),
209 OverrideStackAlignment(
"stack-alignment",
210 cl::desc(
"Override default stack alignment"),
214 StackRealign(
"stackrealign",
215 cl::desc(
"Force align the stack to the minimum alignment"),
220 cl::desc(
"Emit a call to trap function rather than a trap instruction"),
224 cl::desc(
"Use .ctors instead of .init_array."),
228 "relax-elf-relocations",
229 cl::desc(
"Emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL on x86-64 ELF"),
233 cl::desc(
"Emit data into separate sections"),
237 FunctionSections(
"function-sections",
238 cl::desc(
"Emit functions into separate sections"),
242 cl::desc(
"Bit size of immediate TLS offsets"),
250 UniqueSectionNames(
"unique-section-names",
251 cl::desc(
"Give unique names to every section"),
255 EABIVersion(
"meabi",
cl::desc(
"Set EABI type (default depends on triple):"),
258 "Triple default EABI version"),
264 "debugger-tune",
cl::desc(
"Tune debug info for a particular debugger"),
271 "stack-size-section",
272 cl::desc(
"Emit a section containing stack size metadata"),
cl::init(
false));
275 EnableAddrsig(
"addrsig",
cl::desc(
"Emit an address-significance table"),
279 EnableDebugEntryValues(
"debug-entry-values",
280 cl::desc(
"Emit debug info about parameter's entry values"),
284 ForceDwarfFrameSection(
"force-dwarf-frame-section",
285 cl::desc(
"Always emit a debug frame section."),
300 EnableHonorSignDependentRoundingFPMath;
321 Options.
MCOptions = InitMCTargetOptionsFromFlags();
334 if (MCPU ==
"native")
347 if (MCPU ==
"native") {
350 for (
auto &
F : HostFeatures)
354 for (
unsigned i = 0; i != MAttrs.size(); ++i)
367 if (MCPU ==
"native") {
370 for (
auto &
F : HostFeatures)
374 for (
unsigned i = 0; i != MAttrs.size(); ++i)
390 if (!Features.
empty())
392 if (FramePointerUsage.getNumOccurrences() > 0) {
400 if (DisableTailCalls.getNumOccurrences() > 0)
406 if (TrapFuncName.getNumOccurrences() > 0)
409 if (
auto *Call = dyn_cast<CallInst>(&
I))
410 if (
const auto *F =
Call->getCalledFunction())
411 if (F->getIntrinsicID() == Intrinsic::debugtrap ||
412 F->getIntrinsicID() == Intrinsic::trap)
427 setFunctionAttributes(CPU, Features, F);
unsigned StackSymbolOrdering
StackSymbolOrdering - When true, this will allow CodeGen to order the local stack symbols (for code s...
unsigned NoTrappingFPMath
NoTrappingFPMath - This flag is enabled when the -enable-no-trapping-fp-math is specified on the comm...
MCTargetOptions MCOptions
Machine level options.
This class represents lattice values for constants.
unsigned EnableDebugEntryValues
Emit debug info about parameter's entry values.
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.
setjmp/longjmp based exceptions
std::string getString() const
Returns features as a string.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
ThreadModel::Model ThreadModel
ThreadModel - This flag specifies the type of threading model to assume for things like atomics...
ExceptionHandling ExceptionModel
What exception model to use.
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
void AddFeature(StringRef String, bool Enable=true)
Adds Features.
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.
AttributeList getAttributes() const
Return the attribute list for this Function.
unsigned UniqueSectionNames
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
static Reloc::Model getRelocModel(Optional< Reloc::Model > RM)
WebAssembly Exception Handling.
DebuggerKind DebuggerTuning
Which debugger to tune for.
initializer< Ty > init(const Ty &Val)
const std::vector< std::string > & getFeatures() const
Returns the vector of individual subtarget features.
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.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
unsigned ExplicitEmulatedTLS
Whether -emulated-tls or -no-emulated-tls is set.
unsigned TLSSize
Bit size of immediate TLS offsets (0 == use the default).
ValuesClass values(OptsTy... Options)
Helper to build a ValuesClass by forwarding a variable number of arguments as an initializer list to ...
unsigned EmitStackSizeSection
Emit section containing metadata on function stack sizes.
#define LLVM_ATTRIBUTE_UNUSED
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...
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
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.
StringRef toStringRef(bool B)
Construct a string ref from a boolean.
unsigned ForceDwarfFrameSection
Emit DWARF debug frame section.
FileType
Defines the file type this file represents.
unsigned UseInitArray
UseInitArray - Use .init_array instead of .ctors for static constructors.
Module.h This file contains the declarations for the Module class.
unsigned EmitAddrsig
Emit address-significance table.
unsigned StackAlignmentOverride
StackAlignmentOverride - Override default stack alignment for target.
Manages the enabling and disabling of subtarget specific features.
unsigned EmulatedTLS
EmulatedTLS - This flag enables emulated TLS model, using emutls function in the runtime library...
unsigned RelaxELFRelocations
#define clEnumValN(ENUMVAL, FLAGNAME, DESC)
StringRef getHostCPUName()
getHostCPUName - Get the LLVM name for the host CPU.
Windows Exception Handling.
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
LLVM_NODISCARD AttributeList addAttributes(LLVMContext &C, unsigned Index, const AttrBuilder &B) const
Add attributes to the attribute set at the given index.
unsigned HonorSignDependentRoundingFPMathOption
HonorSignDependentRoundingFPMath - This returns true when the -enable-sign-dependent-rounding-fp-math...
unsigned NoSignedZerosFPMath
NoSignedZerosFPMath - This flag is enabled when the -enable-no-signed-zeros-fp-math is specified on t...
StringRef - Represent a constant reference to a string, i.e.
bool getHostCPUFeatures(StringMap< bool > &Features)
getHostCPUFeatures - Get the LLVM names for the host CPU features.
DWARF-like instruction based exceptions.
FloatABI::ABIType FloatABIType
FloatABIType - This setting is set by -float-abi=xxx option is specfied on the command line...