TargetOptions.h revision 57b6e9eb6ccb757b74beeb377c7c16d08468d3e8
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
18namespace 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 FiniteOnlyFPMath and LessPreciseFPMAD.
72  extern bool UnsafeFPMath;
73
74  /// FiniteOnlyFPMath - This returns true when the -enable-finite-only-fp-math
75  /// option is specified on the command line. If this returns false (default),
76  /// the code generator is not allowed to assume that FP arithmetic arguments
77  /// and results are never NaNs or +-Infs.
78  extern bool FiniteOnlyFPMathOption;
79  extern bool FiniteOnlyFPMath();
80
81  /// HonorSignDependentRoundingFPMath - This returns true when the
82  /// -enable-sign-dependent-rounding-fp-math is specified.  If this returns
83  /// false (the default), the code generator is allowed to assume that the
84  /// rounding behavior is the default (round-to-zero for all floating point to
85  /// integer conversions, and round-to-nearest for all other arithmetic
86  /// truncations).  If this is enabled (set to true), the code generator must
87  /// assume that the rounding mode may dynamically change.
88  extern bool HonorSignDependentRoundingFPMathOption;
89  extern bool HonorSignDependentRoundingFPMath();
90
91  /// UseSoftFloat - This flag is enabled when the -soft-float flag is specified
92  /// on the command line.  When this flag is on, the code generator will
93  /// generate libcalls to the software floating point library instead of
94  /// target FP instructions.
95  extern bool UseSoftFloat;
96
97  /// FloatABIType - This setting is set by -float-abi=xxx option is specfied
98  /// on the command line. This setting may either be Default, Soft, or Hard.
99  /// Default selects the target's default behavior. Soft selects the ABI for
100  /// UseSoftFloat, but does not inidcate that FP hardware may not be used.
101  /// Such a combination is unfortunately popular (e.g. arm-apple-darwin).
102  /// Hard presumes that the normal FP ABI is used.
103  extern FloatABI::ABIType FloatABIType;
104
105  /// NoZerosInBSS - By default some codegens place zero-initialized data to
106  /// .bss section. This flag disables such behaviour (necessary, e.g. for
107  /// crt*.o compiling).
108  extern bool NoZerosInBSS;
109
110  /// JITExceptionHandling - This flag indicates that the JIT should emit
111  /// exception handling information.
112  extern bool JITExceptionHandling;
113
114  /// JITEmitDebugInfo - This flag indicates that the JIT should try to emit
115  /// debug information and notify a debugger about it.
116  extern bool JITEmitDebugInfo;
117
118  /// JITEmitDebugInfoToDisk - This flag indicates that the JIT should write
119  /// the object files generated by the JITEmitDebugInfo flag to disk.  This
120  /// flag is hidden and is only for debugging the debug info.
121  extern bool JITEmitDebugInfoToDisk;
122
123  /// UnwindTablesMandatory - This flag indicates that unwind tables should
124  /// be emitted for all functions.
125  extern bool UnwindTablesMandatory;
126
127  /// GuaranteedTailCallOpt - This flag is enabled when -tailcallopt is
128  /// specified on the commandline. When the flag is on, participating targets
129  /// will perform tail call optimization on all calls which use the fastcc
130  /// calling convention and which satisfy certain target-independent
131  /// criteria (being at the end of a function, having the same return type
132  /// as their parent function, etc.), using an alternate ABI if necessary.
133  extern bool GuaranteedTailCallOpt;
134
135  /// StackAlignment - Override default stack alignment for target.
136  extern unsigned StackAlignment;
137
138  /// RealignStack - This flag indicates, whether stack should be automatically
139  /// realigned, if needed.
140  extern bool RealignStack;
141
142  /// DisableJumpTables - This flag indicates jump tables should not be
143  /// generated.
144  extern bool DisableJumpTables;
145
146  /// EnableFastISel - This flag enables fast-path instruction selection
147  /// which trades away generated code quality in favor of reducing
148  /// compile time.
149  extern bool EnableFastISel;
150
151  /// StrongPHIElim - This flag enables more aggressive PHI elimination
152  /// wth earlier copy coalescing.
153  extern bool StrongPHIElim;
154
155} // End llvm namespace
156
157#endif
158