LEFT | RIGHT |
1 //===-- TargetMachine.cpp - General Target Information ---------------------==// | 1 //===-- TargetMachine.cpp - General Target Information ---------------------==// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file describes the general parts of a Target machine. | 10 // This file describes the general parts of a Target machine. |
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #include "llvm/Target/TargetAsmInfo.h" | 14 #include "llvm/MC/MCAsmInfo.h" |
15 #include "llvm/Target/TargetMachine.h" | 15 #include "llvm/Target/TargetMachine.h" |
16 #include "llvm/Target/TargetOptions.h" | 16 #include "llvm/Target/TargetOptions.h" |
17 #include "llvm/Support/CommandLine.h" | 17 #include "llvm/Support/CommandLine.h" |
18 using namespace llvm; | 18 using namespace llvm; |
19 | 19 |
20 //--------------------------------------------------------------------------- | 20 //--------------------------------------------------------------------------- |
21 // Command-line options that tend to be useful on more than one back-end. | 21 // Command-line options that tend to be useful on more than one back-end. |
22 // | 22 // |
23 | 23 |
24 namespace llvm { | 24 namespace llvm { |
25 bool LessPreciseFPMADOption; | 25 bool LessPreciseFPMADOption; |
26 bool PrintMachineCode; | 26 bool PrintMachineCode; |
27 bool NoFramePointerElim; | 27 bool NoFramePointerElim; |
28 bool NoExcessFPPrecision; | 28 bool NoExcessFPPrecision; |
29 bool UnsafeFPMath; | 29 bool UnsafeFPMath; |
30 bool FiniteOnlyFPMathOption; | 30 bool FiniteOnlyFPMathOption; |
31 bool HonorSignDependentRoundingFPMathOption; | 31 bool HonorSignDependentRoundingFPMathOption; |
32 bool UseSoftFloat; | 32 bool UseSoftFloat; |
33 FloatABI::ABIType FloatABIType; | 33 FloatABI::ABIType FloatABIType; |
34 bool NoImplicitFloat; | 34 bool NoImplicitFloat; |
35 bool NoZerosInBSS; | 35 bool NoZerosInBSS; |
36 bool ExceptionHandling; | 36 bool DwarfExceptionHandling; |
| 37 bool SjLjExceptionHandling; |
37 bool JITEmitDebugInfo; | 38 bool JITEmitDebugInfo; |
38 bool UnwindTablesMandatory; | 39 bool UnwindTablesMandatory; |
39 Reloc::Model RelocationModel; | 40 Reloc::Model RelocationModel; |
40 CodeModel::Model CMModel; | 41 CodeModel::Model CMModel; |
41 bool PerformTailCallOpt; | 42 bool PerformTailCallOpt; |
42 unsigned StackAlignment; | 43 unsigned StackAlignment; |
43 bool RealignStack; | 44 bool RealignStack; |
44 bool DisableJumpTables; | 45 bool DisableJumpTables; |
45 bool StrongPHIElim; | 46 bool StrongPHIElim; |
46 bool AsmVerbosityDefault(false); | 47 bool AsmVerbosityDefault(false); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 "Soft float ABI (implied by -soft-float)"), | 99 "Soft float ABI (implied by -soft-float)"), |
99 clEnumValN(FloatABI::Hard, "hard", | 100 clEnumValN(FloatABI::Hard, "hard", |
100 "Hard float ABI (uses FP registers)"), | 101 "Hard float ABI (uses FP registers)"), |
101 clEnumValEnd)); | 102 clEnumValEnd)); |
102 static cl::opt<bool, true> | 103 static cl::opt<bool, true> |
103 DontPlaceZerosInBSS("nozero-initialized-in-bss", | 104 DontPlaceZerosInBSS("nozero-initialized-in-bss", |
104 cl::desc("Don't place zero-initialized symbols into bss section"), | 105 cl::desc("Don't place zero-initialized symbols into bss section"), |
105 cl::location(NoZerosInBSS), | 106 cl::location(NoZerosInBSS), |
106 cl::init(false)); | 107 cl::init(false)); |
107 static cl::opt<bool, true> | 108 static cl::opt<bool, true> |
108 EnableExceptionHandling("enable-eh", | 109 EnableDwarfExceptionHandling("enable-eh", |
109 cl::desc("Emit DWARF exception handling (default if target supports)"), | 110 cl::desc("Emit DWARF exception handling (default if target supports)"), |
110 cl::location(ExceptionHandling), | 111 cl::location(DwarfExceptionHandling), |
111 cl::init(false)); | 112 cl::init(false)); |
| 113 static cl::opt<bool, true> |
| 114 EnableSjLjExceptionHandling("enable-sjlj-eh", |
| 115 cl::desc("Emit SJLJ exception handling (default if target supports)"), |
| 116 cl::location(SjLjExceptionHandling), |
| 117 cl::init(false)); |
| 118 // In debug builds, make this default to true. |
| 119 #ifdef NDEBUG |
| 120 #define EMIT_DEBUG false |
| 121 #else |
| 122 #define EMIT_DEBUG true |
| 123 #endif |
112 static cl::opt<bool, true> | 124 static cl::opt<bool, true> |
113 EmitJitDebugInfo("jit-emit-debug", | 125 EmitJitDebugInfo("jit-emit-debug", |
114 cl::desc("Emit debug information to debugger"), | 126 cl::desc("Emit debug information to debugger"), |
115 cl::location(JITEmitDebugInfo), | 127 cl::location(JITEmitDebugInfo), |
116 cl::init(false)); | 128 cl::init(EMIT_DEBUG)); |
| 129 #undef EMIT_DEBUG |
117 static cl::opt<bool, true> | 130 static cl::opt<bool, true> |
118 EnableUnwindTables("unwind-tables", | 131 EnableUnwindTables("unwind-tables", |
119 cl::desc("Generate unwinding tables for all functions"), | 132 cl::desc("Generate unwinding tables for all functions"), |
120 cl::location(UnwindTablesMandatory), | 133 cl::location(UnwindTablesMandatory), |
121 cl::init(false)); | 134 cl::init(false)); |
122 | 135 |
123 static cl::opt<llvm::Reloc::Model, true> | 136 static cl::opt<llvm::Reloc::Model, true> |
124 DefRelocationModel("relocation-model", | 137 DefRelocationModel("relocation-model", |
125 cl::desc("Choose relocation model"), | 138 cl::desc("Choose relocation model"), |
126 cl::location(RelocationModel), | 139 cl::location(RelocationModel), |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 static cl::opt<bool, true> | 188 static cl::opt<bool, true> |
176 EnableStrongPHIElim(cl::Hidden, "strong-phi-elim", | 189 EnableStrongPHIElim(cl::Hidden, "strong-phi-elim", |
177 cl::desc("Use strong PHI elimination."), | 190 cl::desc("Use strong PHI elimination."), |
178 cl::location(StrongPHIElim), | 191 cl::location(StrongPHIElim), |
179 cl::init(false)); | 192 cl::init(false)); |
180 | 193 |
181 //--------------------------------------------------------------------------- | 194 //--------------------------------------------------------------------------- |
182 // TargetMachine Class | 195 // TargetMachine Class |
183 // | 196 // |
184 | 197 |
185 TargetMachine::TargetMachine()· | 198 TargetMachine::TargetMachine(const Target &T)· |
186 : AsmInfo(0) { | 199 : TheTarget(T), AsmInfo(0) { |
187 // Typically it will be subtargets that will adjust FloatABIType from Default | 200 // Typically it will be subtargets that will adjust FloatABIType from Default |
188 // to Soft or Hard. | 201 // to Soft or Hard. |
189 if (UseSoftFloat) | 202 if (UseSoftFloat) |
190 FloatABIType = FloatABI::Soft; | 203 FloatABIType = FloatABI::Soft; |
191 } | 204 } |
192 | 205 |
193 TargetMachine::~TargetMachine() { | 206 TargetMachine::~TargetMachine() { |
194 delete AsmInfo; | 207 delete AsmInfo; |
195 } | 208 } |
196 | 209 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 /// the code generator is not allowed to assume that FP arithmetic arguments | 249 /// the code generator is not allowed to assume that FP arithmetic arguments |
237 /// and results are never NaNs or +-Infs. | 250 /// and results are never NaNs or +-Infs. |
238 bool FiniteOnlyFPMath() { return UnsafeFPMath || FiniteOnlyFPMathOption; } | 251 bool FiniteOnlyFPMath() { return UnsafeFPMath || FiniteOnlyFPMathOption; } |
239 ·· | 252 ·· |
240 /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume | 253 /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume |
241 /// that the rounding mode of the FPU can change from its default. | 254 /// that the rounding mode of the FPU can change from its default. |
242 bool HonorSignDependentRoundingFPMath() { | 255 bool HonorSignDependentRoundingFPMath() { |
243 return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption; | 256 return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption; |
244 } | 257 } |
245 } | 258 } |
LEFT | RIGHT |