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