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