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;
40 : PrintMachineCode(false), NoFramePointerElim(false),
41 NoFramePointerElimNonLeaf(false), LessPreciseFPMADOption(false),
42 NoExcessFPPrecision(false), UnsafeFPMath(false), NoInfsFPMath(false),
43 NoNaNsFPMath(false), HonorSignDependentRoundingFPMathOption(false),
44 UseSoftFloat(false), NoZerosInBSS(false), JITExceptionHandling(false),
45 JITEmitDebugInfo(false), JITEmitDebugInfoToDisk(false),
46 GuaranteedTailCallOpt(false), DisableTailCalls(false),
47 StackAlignmentOverride(0), RealignStack(true),
48 DisableJumpTables(false), EnableFastISel(false),
49 EnableSegmentedStacks(false), TrapFuncName(""),
50 FloatABIType(FloatABI::Default)
53 /// PrintMachineCode - This flag is enabled when the -print-machineinstrs
54 /// option is specified on the command line, and should enable debugging
55 /// output from the code generator.
56 unsigned PrintMachineCode : 1;
58 /// NoFramePointerElim - This flag is enabled when the -disable-fp-elim is
59 /// specified on the command line. If the target supports the frame pointer
60 /// elimination optimization, this option should disable it.
61 unsigned NoFramePointerElim : 1;
63 /// NoFramePointerElimNonLeaf - This flag is enabled when the
64 /// -disable-non-leaf-fp-elim is specified on the command line. If the
65 /// target supports the frame pointer elimination optimization, this option
66 /// should disable it for non-leaf functions.
67 unsigned NoFramePointerElimNonLeaf : 1;
69 /// DisableFramePointerElim - This returns true if frame pointer elimination
70 /// optimization should be disabled for the given machine function.
71 bool DisableFramePointerElim(const MachineFunction &MF) const;
73 /// LessPreciseFPMAD - This flag is enabled when the
74 /// -enable-fp-mad is specified on the command line. When this flag is off
75 /// (the default), the code generator is not allowed to generate mad
76 /// (multiply add) if the result is "less precise" than doing those
77 /// operations individually.
78 unsigned LessPreciseFPMADOption : 1;
79 bool LessPreciseFPMAD() const;
81 /// NoExcessFPPrecision - This flag is enabled when the
82 /// -disable-excess-fp-precision flag is specified on the command line.
83 /// When this flag is off (the default), the code generator is allowed to
84 /// produce results that are "more precise" than IEEE allows. This includes
85 /// use of FMA-like operations and use of the X86 FP registers without
86 /// rounding all over the place.
87 unsigned NoExcessFPPrecision : 1;
89 /// UnsafeFPMath - This flag is enabled when the
90 /// -enable-unsafe-fp-math flag is specified on the command line. When
91 /// this flag is off (the default), the code generator is not allowed to
92 /// produce results that are "less precise" than IEEE allows. This includes
93 /// use of X86 instructions like FSIN and FCOS instead of libcalls.
94 /// UnsafeFPMath implies LessPreciseFPMAD.
95 unsigned UnsafeFPMath : 1;
97 /// NoInfsFPMath - This flag is enabled when the
98 /// -enable-no-infs-fp-math flag is specified on the command line. When
99 /// this flag is off (the default), the code generator is not allowed to
100 /// assume the FP arithmetic arguments and results are never +-Infs.
101 unsigned NoInfsFPMath : 1;
103 /// NoNaNsFPMath - This flag is enabled when the
104 /// -enable-no-nans-fp-math flag is specified on the command line. When
105 /// this flag is off (the default), the code generator is not allowed to
106 /// assume the FP arithmetic arguments and results are never NaNs.
107 unsigned NoNaNsFPMath : 1;
109 /// HonorSignDependentRoundingFPMath - This returns true when the
110 /// -enable-sign-dependent-rounding-fp-math is specified. If this returns
111 /// false (the default), the code generator is allowed to assume that the
112 /// rounding behavior is the default (round-to-zero for all floating point
113 /// to integer conversions, and round-to-nearest for all other arithmetic
114 /// truncations). If this is enabled (set to true), the code generator must
115 /// assume that the rounding mode may dynamically change.
116 unsigned HonorSignDependentRoundingFPMathOption : 1;
117 bool HonorSignDependentRoundingFPMath() const;
119 /// UseSoftFloat - This flag is enabled when the -soft-float flag is
120 /// specified on the command line. When this flag is on, the code generator
121 /// will generate libcalls to the software floating point library instead of
122 /// target FP instructions.
123 unsigned UseSoftFloat : 1;
125 /// NoZerosInBSS - By default some codegens place zero-initialized data to
126 /// .bss section. This flag disables such behaviour (necessary, e.g. for
127 /// crt*.o compiling).
128 unsigned NoZerosInBSS : 1;
130 /// JITExceptionHandling - This flag indicates that the JIT should emit
131 /// exception handling information.
132 unsigned JITExceptionHandling : 1;
134 /// JITEmitDebugInfo - This flag indicates that the JIT should try to emit
135 /// debug information and notify a debugger about it.
136 unsigned JITEmitDebugInfo : 1;
138 /// JITEmitDebugInfoToDisk - This flag indicates that the JIT should write
139 /// the object files generated by the JITEmitDebugInfo flag to disk. This
140 /// flag is hidden and is only for debugging the debug info.
141 unsigned JITEmitDebugInfoToDisk : 1;
143 /// GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is
144 /// specified on the commandline. When the flag is on, participating targets
145 /// will perform tail call optimization on all calls which use the fastcc
146 /// calling convention and which satisfy certain target-independent
147 /// criteria (being at the end of a function, having the same return type
148 /// as their parent function, etc.), using an alternate ABI if necessary.
149 unsigned GuaranteedTailCallOpt : 1;
151 /// DisableTailCalls - This flag controls whether we will use tail calls.
152 /// Disabling them may be useful to maintain a correct call stack.
153 unsigned DisableTailCalls : 1;
155 /// StackAlignmentOverride - Override default stack alignment for target.
156 unsigned StackAlignmentOverride;
158 /// RealignStack - This flag indicates whether the stack should be
159 /// automatically realigned, if needed.
160 unsigned RealignStack : 1;
162 /// DisableJumpTables - This flag indicates jump tables should not be
164 unsigned DisableJumpTables : 1;
166 /// EnableFastISel - This flag enables fast-path instruction selection
167 /// which trades away generated code quality in favor of reducing
169 unsigned EnableFastISel : 1;
171 unsigned EnableSegmentedStacks : 1;
173 /// getTrapFunctionName - If this returns a non-empty string, this means
174 /// isel should lower Intrinsic::trap to a call to the specified function
175 /// name instead of an ISD::TRAP node.
176 std::string TrapFuncName;
177 StringRef getTrapFunctionName() const;
179 /// FloatABIType - This setting is set by -float-abi=xxx option is specfied
180 /// on the command line. This setting may either be Default, Soft, or Hard.
181 /// Default selects the target's default behavior. Soft selects the ABI for
182 /// UseSoftFloat, but does not indicate that FP hardware may not be used.
183 /// Such a combination is unfortunately popular (e.g. arm-apple-darwin).
184 /// Hard presumes that the normal FP ABI is used.
185 FloatABI::ABIType FloatABIType;
187 } // End llvm namespace