44 unsigned StackAlignment; 45 bool RealignStack; 46 bool DisableJumpTables; 47 bool StrongPHIElim; 48 bool AsmVerbosityDefault(false); 49} 50 51static cl::opt<bool, true> 52PrintCode("print-machineinstrs", 53 cl::desc("Print generated machine code"), 54 cl::location(PrintMachineCode), cl::init(false)); 55static cl::opt<bool, true> 56DisableFPElim("disable-fp-elim", 57 cl::desc("Disable frame pointer elimination optimization"), 58 cl::location(NoFramePointerElim), 59 cl::init(false)); 60static cl::opt<bool, true> 61DisableExcessPrecision("disable-excess-fp-precision", 62 cl::desc("Disable optimizations that may increase FP precision"), 63 cl::location(NoExcessFPPrecision), 64 cl::init(false)); 65static cl::opt<bool, true> 66EnableFPMAD("enable-fp-mad", 67 cl::desc("Enable less precise MAD instructions to be generated"), 68 cl::location(LessPreciseFPMADOption), 69 cl::init(false)); 70static cl::opt<bool, true> 71EnableUnsafeFPMath("enable-unsafe-fp-math", 72 cl::desc("Enable optimizations that may decrease FP precision"), 73 cl::location(UnsafeFPMath), 74 cl::init(false)); 75static cl::opt<bool, true> 76EnableFiniteOnlyFPMath("enable-finite-only-fp-math", 77 cl::desc("Enable optimizations that assumes non- NaNs / +-Infs"), 78 cl::location(FiniteOnlyFPMathOption), 79 cl::init(false)); 80static cl::opt<bool, true> 81EnableHonorSignDependentRoundingFPMath("enable-sign-dependent-rounding-fp-math", 82 cl::Hidden, 83 cl::desc("Force codegen to assume rounding mode can change dynamically"), 84 cl::location(HonorSignDependentRoundingFPMathOption), 85 cl::init(false)); 86static cl::opt<bool, true> 87GenerateSoftFloatCalls("soft-float", 88 cl::desc("Generate software floating point library calls"), 89 cl::location(UseSoftFloat), 90 cl::init(false)); 91static cl::opt<llvm::FloatABI::ABIType, true> 92FloatABIForCalls("float-abi", 93 cl::desc("Choose float ABI type"), 94 cl::location(FloatABIType), 95 cl::init(FloatABI::Default), 96 cl::values( 97 clEnumValN(FloatABI::Default, "default", 98 "Target default float ABI type"), 99 clEnumValN(FloatABI::Soft, "soft", 100 "Soft float ABI (implied by -soft-float)"), 101 clEnumValN(FloatABI::Hard, "hard", 102 "Hard float ABI (uses FP registers)"), 103 clEnumValEnd)); 104static cl::opt<bool, true> 105DontPlaceZerosInBSS("nozero-initialized-in-bss", 106 cl::desc("Don't place zero-initialized symbols into bss section"), 107 cl::location(NoZerosInBSS), 108 cl::init(false)); 109static cl::opt<bool, true> 110EnableDwarfExceptionHandling("enable-eh", 111 cl::desc("Emit DWARF exception handling (default if target supports)"), 112 cl::location(DwarfExceptionHandling), 113 cl::init(false)); 114static cl::opt<bool, true> 115EnableSjLjExceptionHandling("enable-sjlj-eh", 116 cl::desc("Emit SJLJ exception handling (default if target supports)"), 117 cl::location(SjLjExceptionHandling), 118 cl::init(false)); 119// In debug builds, make this default to true. 120#ifdef NDEBUG 121#define EMIT_DEBUG false 122#else 123#define EMIT_DEBUG true 124#endif 125static cl::opt<bool, true> 126EmitJitDebugInfo("jit-emit-debug", 127 cl::desc("Emit debug information to debugger"), 128 cl::location(JITEmitDebugInfo), 129 cl::init(EMIT_DEBUG)); 130#undef EMIT_DEBUG 131static cl::opt<bool, true> 132EmitJitDebugInfoToDisk("jit-emit-debug-to-disk", 133 cl::Hidden, 134 cl::desc("Emit debug info objfiles to disk"), 135 cl::location(JITEmitDebugInfoToDisk), 136 cl::init(false)); 137static cl::opt<bool, true> 138EnableUnwindTables("unwind-tables", 139 cl::desc("Generate unwinding tables for all functions"), 140 cl::location(UnwindTablesMandatory), 141 cl::init(false)); 142 143static cl::opt<llvm::Reloc::Model, true> 144DefRelocationModel("relocation-model", 145 cl::desc("Choose relocation model"), 146 cl::location(RelocationModel), 147 cl::init(Reloc::Default), 148 cl::values( 149 clEnumValN(Reloc::Default, "default", 150 "Target default relocation model"), 151 clEnumValN(Reloc::Static, "static", 152 "Non-relocatable code"), 153 clEnumValN(Reloc::PIC_, "pic", 154 "Fully relocatable, position independent code"), 155 clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic", 156 "Relocatable external references, non-relocatable code"), 157 clEnumValEnd)); 158static cl::opt<llvm::CodeModel::Model, true> 159DefCodeModel("code-model", 160 cl::desc("Choose code model"), 161 cl::location(CMModel), 162 cl::init(CodeModel::Default), 163 cl::values( 164 clEnumValN(CodeModel::Default, "default", 165 "Target default code model"), 166 clEnumValN(CodeModel::Small, "small", 167 "Small code model"), 168 clEnumValN(CodeModel::Kernel, "kernel", 169 "Kernel code model"), 170 clEnumValN(CodeModel::Medium, "medium", 171 "Medium code model"), 172 clEnumValN(CodeModel::Large, "large", 173 "Large code model"), 174 clEnumValEnd)); 175static cl::opt<bool, true>
| 44 unsigned StackAlignment; 45 bool RealignStack; 46 bool DisableJumpTables; 47 bool StrongPHIElim; 48 bool AsmVerbosityDefault(false); 49} 50 51static cl::opt<bool, true> 52PrintCode("print-machineinstrs", 53 cl::desc("Print generated machine code"), 54 cl::location(PrintMachineCode), cl::init(false)); 55static cl::opt<bool, true> 56DisableFPElim("disable-fp-elim", 57 cl::desc("Disable frame pointer elimination optimization"), 58 cl::location(NoFramePointerElim), 59 cl::init(false)); 60static cl::opt<bool, true> 61DisableExcessPrecision("disable-excess-fp-precision", 62 cl::desc("Disable optimizations that may increase FP precision"), 63 cl::location(NoExcessFPPrecision), 64 cl::init(false)); 65static cl::opt<bool, true> 66EnableFPMAD("enable-fp-mad", 67 cl::desc("Enable less precise MAD instructions to be generated"), 68 cl::location(LessPreciseFPMADOption), 69 cl::init(false)); 70static cl::opt<bool, true> 71EnableUnsafeFPMath("enable-unsafe-fp-math", 72 cl::desc("Enable optimizations that may decrease FP precision"), 73 cl::location(UnsafeFPMath), 74 cl::init(false)); 75static cl::opt<bool, true> 76EnableFiniteOnlyFPMath("enable-finite-only-fp-math", 77 cl::desc("Enable optimizations that assumes non- NaNs / +-Infs"), 78 cl::location(FiniteOnlyFPMathOption), 79 cl::init(false)); 80static cl::opt<bool, true> 81EnableHonorSignDependentRoundingFPMath("enable-sign-dependent-rounding-fp-math", 82 cl::Hidden, 83 cl::desc("Force codegen to assume rounding mode can change dynamically"), 84 cl::location(HonorSignDependentRoundingFPMathOption), 85 cl::init(false)); 86static cl::opt<bool, true> 87GenerateSoftFloatCalls("soft-float", 88 cl::desc("Generate software floating point library calls"), 89 cl::location(UseSoftFloat), 90 cl::init(false)); 91static cl::opt<llvm::FloatABI::ABIType, true> 92FloatABIForCalls("float-abi", 93 cl::desc("Choose float ABI type"), 94 cl::location(FloatABIType), 95 cl::init(FloatABI::Default), 96 cl::values( 97 clEnumValN(FloatABI::Default, "default", 98 "Target default float ABI type"), 99 clEnumValN(FloatABI::Soft, "soft", 100 "Soft float ABI (implied by -soft-float)"), 101 clEnumValN(FloatABI::Hard, "hard", 102 "Hard float ABI (uses FP registers)"), 103 clEnumValEnd)); 104static cl::opt<bool, true> 105DontPlaceZerosInBSS("nozero-initialized-in-bss", 106 cl::desc("Don't place zero-initialized symbols into bss section"), 107 cl::location(NoZerosInBSS), 108 cl::init(false)); 109static cl::opt<bool, true> 110EnableDwarfExceptionHandling("enable-eh", 111 cl::desc("Emit DWARF exception handling (default if target supports)"), 112 cl::location(DwarfExceptionHandling), 113 cl::init(false)); 114static cl::opt<bool, true> 115EnableSjLjExceptionHandling("enable-sjlj-eh", 116 cl::desc("Emit SJLJ exception handling (default if target supports)"), 117 cl::location(SjLjExceptionHandling), 118 cl::init(false)); 119// In debug builds, make this default to true. 120#ifdef NDEBUG 121#define EMIT_DEBUG false 122#else 123#define EMIT_DEBUG true 124#endif 125static cl::opt<bool, true> 126EmitJitDebugInfo("jit-emit-debug", 127 cl::desc("Emit debug information to debugger"), 128 cl::location(JITEmitDebugInfo), 129 cl::init(EMIT_DEBUG)); 130#undef EMIT_DEBUG 131static cl::opt<bool, true> 132EmitJitDebugInfoToDisk("jit-emit-debug-to-disk", 133 cl::Hidden, 134 cl::desc("Emit debug info objfiles to disk"), 135 cl::location(JITEmitDebugInfoToDisk), 136 cl::init(false)); 137static cl::opt<bool, true> 138EnableUnwindTables("unwind-tables", 139 cl::desc("Generate unwinding tables for all functions"), 140 cl::location(UnwindTablesMandatory), 141 cl::init(false)); 142 143static cl::opt<llvm::Reloc::Model, true> 144DefRelocationModel("relocation-model", 145 cl::desc("Choose relocation model"), 146 cl::location(RelocationModel), 147 cl::init(Reloc::Default), 148 cl::values( 149 clEnumValN(Reloc::Default, "default", 150 "Target default relocation model"), 151 clEnumValN(Reloc::Static, "static", 152 "Non-relocatable code"), 153 clEnumValN(Reloc::PIC_, "pic", 154 "Fully relocatable, position independent code"), 155 clEnumValN(Reloc::DynamicNoPIC, "dynamic-no-pic", 156 "Relocatable external references, non-relocatable code"), 157 clEnumValEnd)); 158static cl::opt<llvm::CodeModel::Model, true> 159DefCodeModel("code-model", 160 cl::desc("Choose code model"), 161 cl::location(CMModel), 162 cl::init(CodeModel::Default), 163 cl::values( 164 clEnumValN(CodeModel::Default, "default", 165 "Target default code model"), 166 clEnumValN(CodeModel::Small, "small", 167 "Small code model"), 168 clEnumValN(CodeModel::Kernel, "kernel", 169 "Kernel code model"), 170 clEnumValN(CodeModel::Medium, "medium", 171 "Medium code model"), 172 clEnumValN(CodeModel::Large, "large", 173 "Large code model"), 174 clEnumValEnd)); 175static cl::opt<bool, true>
|
179 cl::init(false)); 180static cl::opt<unsigned, true> 181OverrideStackAlignment("stack-alignment", 182 cl::desc("Override default stack alignment"), 183 cl::location(StackAlignment), 184 cl::init(0)); 185static cl::opt<bool, true> 186EnableRealignStack("realign-stack", 187 cl::desc("Realign stack if needed"), 188 cl::location(RealignStack), 189 cl::init(true)); 190static cl::opt<bool, true> 191DisableSwitchTables(cl::Hidden, "disable-jump-tables", 192 cl::desc("Do not generate jump tables."), 193 cl::location(DisableJumpTables), 194 cl::init(false)); 195static cl::opt<bool, true> 196EnableStrongPHIElim(cl::Hidden, "strong-phi-elim", 197 cl::desc("Use strong PHI elimination."), 198 cl::location(StrongPHIElim), 199 cl::init(false)); 200 201//--------------------------------------------------------------------------- 202// TargetMachine Class 203// 204 205TargetMachine::TargetMachine(const Target &T) 206 : TheTarget(T), AsmInfo(0) { 207 // Typically it will be subtargets that will adjust FloatABIType from Default 208 // to Soft or Hard. 209 if (UseSoftFloat) 210 FloatABIType = FloatABI::Soft; 211} 212 213TargetMachine::~TargetMachine() { 214 delete AsmInfo; 215} 216 217/// getRelocationModel - Returns the code generation relocation model. The 218/// choices are static, PIC, and dynamic-no-pic, and target default. 219Reloc::Model TargetMachine::getRelocationModel() { 220 return RelocationModel; 221} 222 223/// setRelocationModel - Sets the code generation relocation model. 224void TargetMachine::setRelocationModel(Reloc::Model Model) { 225 RelocationModel = Model; 226} 227 228/// getCodeModel - Returns the code model. The choices are small, kernel, 229/// medium, large, and target default. 230CodeModel::Model TargetMachine::getCodeModel() { 231 return CMModel; 232} 233 234/// setCodeModel - Sets the code model. 235void TargetMachine::setCodeModel(CodeModel::Model Model) { 236 CMModel = Model; 237} 238 239bool TargetMachine::getAsmVerbosityDefault() { 240 return AsmVerbosityDefault; 241} 242 243void TargetMachine::setAsmVerbosityDefault(bool V) { 244 AsmVerbosityDefault = V; 245} 246 247namespace llvm { 248 /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option 249 /// is specified on the command line. When this flag is off(default), the 250 /// code generator is not allowed to generate mad (multiply add) if the 251 /// result is "less precise" than doing those operations individually. 252 bool LessPreciseFPMAD() { return UnsafeFPMath || LessPreciseFPMADOption; } 253 254 /// FiniteOnlyFPMath - This returns true when the -enable-finite-only-fp-math 255 /// option is specified on the command line. If this returns false (default), 256 /// the code generator is not allowed to assume that FP arithmetic arguments 257 /// and results are never NaNs or +-Infs. 258 bool FiniteOnlyFPMath() { return UnsafeFPMath || FiniteOnlyFPMathOption; } 259 260 /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume 261 /// that the rounding mode of the FPU can change from its default. 262 bool HonorSignDependentRoundingFPMath() { 263 return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption; 264 } 265}
| 179 cl::init(false)); 180static cl::opt<unsigned, true> 181OverrideStackAlignment("stack-alignment", 182 cl::desc("Override default stack alignment"), 183 cl::location(StackAlignment), 184 cl::init(0)); 185static cl::opt<bool, true> 186EnableRealignStack("realign-stack", 187 cl::desc("Realign stack if needed"), 188 cl::location(RealignStack), 189 cl::init(true)); 190static cl::opt<bool, true> 191DisableSwitchTables(cl::Hidden, "disable-jump-tables", 192 cl::desc("Do not generate jump tables."), 193 cl::location(DisableJumpTables), 194 cl::init(false)); 195static cl::opt<bool, true> 196EnableStrongPHIElim(cl::Hidden, "strong-phi-elim", 197 cl::desc("Use strong PHI elimination."), 198 cl::location(StrongPHIElim), 199 cl::init(false)); 200 201//--------------------------------------------------------------------------- 202// TargetMachine Class 203// 204 205TargetMachine::TargetMachine(const Target &T) 206 : TheTarget(T), AsmInfo(0) { 207 // Typically it will be subtargets that will adjust FloatABIType from Default 208 // to Soft or Hard. 209 if (UseSoftFloat) 210 FloatABIType = FloatABI::Soft; 211} 212 213TargetMachine::~TargetMachine() { 214 delete AsmInfo; 215} 216 217/// getRelocationModel - Returns the code generation relocation model. The 218/// choices are static, PIC, and dynamic-no-pic, and target default. 219Reloc::Model TargetMachine::getRelocationModel() { 220 return RelocationModel; 221} 222 223/// setRelocationModel - Sets the code generation relocation model. 224void TargetMachine::setRelocationModel(Reloc::Model Model) { 225 RelocationModel = Model; 226} 227 228/// getCodeModel - Returns the code model. The choices are small, kernel, 229/// medium, large, and target default. 230CodeModel::Model TargetMachine::getCodeModel() { 231 return CMModel; 232} 233 234/// setCodeModel - Sets the code model. 235void TargetMachine::setCodeModel(CodeModel::Model Model) { 236 CMModel = Model; 237} 238 239bool TargetMachine::getAsmVerbosityDefault() { 240 return AsmVerbosityDefault; 241} 242 243void TargetMachine::setAsmVerbosityDefault(bool V) { 244 AsmVerbosityDefault = V; 245} 246 247namespace llvm { 248 /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option 249 /// is specified on the command line. When this flag is off(default), the 250 /// code generator is not allowed to generate mad (multiply add) if the 251 /// result is "less precise" than doing those operations individually. 252 bool LessPreciseFPMAD() { return UnsafeFPMath || LessPreciseFPMADOption; } 253 254 /// FiniteOnlyFPMath - This returns true when the -enable-finite-only-fp-math 255 /// option is specified on the command line. If this returns false (default), 256 /// the code generator is not allowed to assume that FP arithmetic arguments 257 /// and results are never NaNs or +-Infs. 258 bool FiniteOnlyFPMath() { return UnsafeFPMath || FiniteOnlyFPMathOption; } 259 260 /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume 261 /// that the rounding mode of the FPU can change from its default. 262 bool HonorSignDependentRoundingFPMath() { 263 return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption; 264 } 265}
|