1 //===-- llvm/Target/TargetOptions.h - Target Options ------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines command line option flags that are shared across various
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TARGET_TARGETOPTIONS_H
16 #define LLVM_TARGET_TARGETOPTIONS_H
21 class MachineFunction;
24 // Possible float ABI settings. Used with FloatABIType in TargetOptions.h.
27 Default, // Target-specific (either soft of hard depending on triple, etc).
33 /// StrongPHIElim - This flag enables more aggressive PHI elimination
34 /// wth earlier copy coalescing.
35 extern bool StrongPHIElim;
37 /// EnableMachineSched - temporary flag to enable the machine scheduling pass
38 /// until we complete the register allocation pass configuration cleanup.
39 extern bool EnableMachineSched;
44 : PrintMachineCode(false), NoFramePointerElim(false),
45 NoFramePointerElimNonLeaf(false), LessPreciseFPMADOption(false),
46 NoExcessFPPrecision(false), UnsafeFPMath(false), NoInfsFPMath(false),
47 NoNaNsFPMath(false), HonorSignDependentRoundingFPMathOption(false),
48 UseSoftFloat(false), NoZerosInBSS(false), JITExceptionHandling(false),
49 JITEmitDebugInfo(false), JITEmitDebugInfoToDisk(false),
50 GuaranteedTailCallOpt(false), StackAlignmentOverride(0),
51 RealignStack(true), DisableJumpTables(false), EnableFastISel(false),
52 EnableSegmentedStacks(false), TrapFuncName(""),
53 FloatABIType(FloatABI::Default)
56 /// PrintMachineCode - This flag is enabled when the -print-machineinstrs
57 /// option is specified on the command line, and should enable debugging
58 /// output from the code generator.
59 unsigned PrintMachineCode : 1;
61 /// NoFramePointerElim - This flag is enabled when the -disable-fp-elim is
62 /// specified on the command line. If the target supports the frame pointer
63 /// elimination optimization, this option should disable it.
64 unsigned NoFramePointerElim : 1;
66 /// NoFramePointerElimNonLeaf - This flag is enabled when the
67 /// -disable-non-leaf-fp-elim is specified on the command line. If the
68 /// target supports the frame pointer elimination optimization, this option
69 /// should disable it for non-leaf functions.
70 unsigned NoFramePointerElimNonLeaf : 1;
72 /// DisableFramePointerElim - This returns true if frame pointer elimination
73 /// optimization should be disabled for the given machine function.
74 bool DisableFramePointerElim(const MachineFunction &MF) const;
76 /// LessPreciseFPMAD - This flag is enabled when the
77 /// -enable-fp-mad is specified on the command line. When this flag is off
78 /// (the default), the code generator is not allowed to generate mad
79 /// (multiply add) if the result is "less precise" than doing those
80 /// operations individually.
81 unsigned LessPreciseFPMADOption : 1;
82 bool LessPreciseFPMAD() const;
84 /// NoExcessFPPrecision - This flag is enabled when the
85 /// -disable-excess-fp-precision flag is specified on the command line.
86 /// When this flag is off (the default), the code generator is allowed to
87 /// produce results that are "more precise" than IEEE allows. This includes
88 /// use of FMA-like operations and use of the X86 FP registers without
89 /// rounding all over the place.
90 unsigned NoExcessFPPrecision : 1;
92 /// UnsafeFPMath - This flag is enabled when the
93 /// -enable-unsafe-fp-math flag is specified on the command line. When
94 /// this flag is off (the default), the code generator is not allowed to
95 /// produce results that are "less precise" than IEEE allows. This includes
96 /// use of X86 instructions like FSIN and FCOS instead of libcalls.
97 /// UnsafeFPMath implies LessPreciseFPMAD.
98 unsigned UnsafeFPMath : 1;
100 /// NoInfsFPMath - This flag is enabled when the
101 /// -enable-no-infs-fp-math flag is specified on the command line. When
102 /// this flag is off (the default), the code generator is not allowed to
103 /// assume the FP arithmetic arguments and results are never +-Infs.
104 unsigned NoInfsFPMath : 1;
106 /// NoNaNsFPMath - This flag is enabled when the
107 /// -enable-no-nans-fp-math flag is specified on the command line. When
108 /// this flag is off (the default), the code generator is not allowed to
109 /// assume the FP arithmetic arguments and results are never NaNs.
110 unsigned NoNaNsFPMath : 1;
112 /// HonorSignDependentRoundingFPMath - This returns true when the
113 /// -enable-sign-dependent-rounding-fp-math is specified. If this returns
114 /// false (the default), the code generator is allowed to assume that the
115 /// rounding behavior is the default (round-to-zero for all floating point
116 /// to integer conversions, and round-to-nearest for all other arithmetic
117 /// truncations). If this is enabled (set to true), the code generator must
118 /// assume that the rounding mode may dynamically change.
119 unsigned HonorSignDependentRoundingFPMathOption : 1;
120 bool HonorSignDependentRoundingFPMath() const;
122 /// UseSoftFloat - This flag is enabled when the -soft-float flag is
123 /// specified on the command line. When this flag is on, the code generator
124 /// will generate libcalls to the software floating point library instead of
125 /// target FP instructions.
126 unsigned UseSoftFloat : 1;
128 /// NoZerosInBSS - By default some codegens place zero-initialized data to
129 /// .bss section. This flag disables such behaviour (necessary, e.g. for
130 /// crt*.o compiling).
131 unsigned NoZerosInBSS : 1;
133 /// JITExceptionHandling - This flag indicates that the JIT should emit
134 /// exception handling information.
135 unsigned JITExceptionHandling : 1;
137 /// JITEmitDebugInfo - This flag indicates that the JIT should try to emit
138 /// debug information and notify a debugger about it.
139 unsigned JITEmitDebugInfo : 1;
141 /// JITEmitDebugInfoToDisk - This flag indicates that the JIT should write
142 /// the object files generated by the JITEmitDebugInfo flag to disk. This
143 /// flag is hidden and is only for debugging the debug info.
144 unsigned JITEmitDebugInfoToDisk : 1;
146 /// GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is
147 /// specified on the commandline. When the flag is on, participating targets
148 /// will perform tail call optimization on all calls which use the fastcc
149 /// calling convention and which satisfy certain target-independent
150 /// criteria (being at the end of a function, having the same return type
151 /// as their parent function, etc.), using an alternate ABI if necessary.
152 unsigned GuaranteedTailCallOpt : 1;
154 /// StackAlignmentOverride - Override default stack alignment for target.
155 unsigned StackAlignmentOverride;
157 /// RealignStack - This flag indicates whether the stack should be
158 /// automatically realigned, if needed.
159 unsigned RealignStack : 1;
161 /// DisableJumpTables - This flag indicates jump tables should not be
163 unsigned DisableJumpTables : 1;
165 /// EnableFastISel - This flag enables fast-path instruction selection
166 /// which trades away generated code quality in favor of reducing
168 unsigned EnableFastISel : 1;
170 unsigned EnableSegmentedStacks : 1;
172 /// getTrapFunctionName - If this returns a non-empty string, this means
173 /// isel should lower Intrinsic::trap to a call to the specified function
174 /// name instead of an ISD::TRAP node.
175 std::string TrapFuncName;
176 StringRef getTrapFunctionName() const;
178 /// FloatABIType - This setting is set by -float-abi=xxx option is specfied
179 /// on the command line. This setting may either be Default, Soft, or Hard.
180 /// Default selects the target's default behavior. Soft selects the ABI for
181 /// UseSoftFloat, but does not indicate that FP hardware may not be used.
182 /// Such a combination is unfortunately popular (e.g. arm-apple-darwin).
183 /// Hard presumes that the normal FP ABI is used.
184 FloatABI::ABIType FloatABIType;
186 } // End llvm namespace