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