llvm.org GIT mirror llvm / b3ffe10
Refactor the implementation of the TargetOptions out of TargetMachine, taking the only parts of TM that depends on CodeGen headers with it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146334 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 8 years ago
3 changed file(s) with 53 addition(s) and 33 deletion(s). Raw diff Collapse all Expand all
88 TargetLibraryInfo.cpp
99 TargetLoweringObjectFile.cpp
1010 TargetMachine.cpp
11 TargetOptions.cpp
1112 TargetRegisterInfo.cpp
1213 TargetSubtargetInfo.cpp
1314 )
108108 DataSections = V;
109109 }
110110
111 /// DisableFramePointerElim - This returns true if frame pointer elimination
112 /// optimization should be disabled for the given machine function.
113 bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const {
114 // Check to see if we should eliminate non-leaf frame pointers and then
115 // check to see if we should eliminate all frame pointers.
116 if (NoFramePointerElimNonLeaf && !NoFramePointerElim) {
117 const MachineFrameInfo *MFI = MF.getFrameInfo();
118 return MFI->hasCalls();
119 }
120
121 return NoFramePointerElim;
122 }
123
124 /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option
125 /// is specified on the command line. When this flag is off(default), the
126 /// code generator is not allowed to generate mad (multiply add) if the
127 /// result is "less precise" than doing those operations individually.
128 bool TargetOptions::LessPreciseFPMAD() const {
129 return UnsafeFPMath || LessPreciseFPMADOption;
130 }
131
132 /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume
133 /// that the rounding mode of the FPU can change from its default.
134 bool TargetOptions::HonorSignDependentRoundingFPMath() const {
135 return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption;
136 }
137
138 /// getTrapFunctionName - If this returns a non-empty string, this means isel
139 /// should lower Intrinsic::trap to a call to the specified function name
140 /// instead of an ISD::TRAP node.
141 StringRef TargetOptions::getTrapFunctionName() const {
142 return TrapFuncName;
143 }
0 //===-- TargetOptions.cpp - Options that apply to all targets --------------==//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the methods in the TargetOptions.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "llvm/CodeGen/MachineFunction.h"
14 #include "llvm/CodeGen/MachineFrameInfo.h"
15 #include "llvm/Target/TargetOptions.h"
16 using namespace llvm;
17
18 /// DisableFramePointerElim - This returns true if frame pointer elimination
19 /// optimization should be disabled for the given machine function.
20 bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const {
21 // Check to see if we should eliminate non-leaf frame pointers and then
22 // check to see if we should eliminate all frame pointers.
23 if (NoFramePointerElimNonLeaf && !NoFramePointerElim) {
24 const MachineFrameInfo *MFI = MF.getFrameInfo();
25 return MFI->hasCalls();
26 }
27
28 return NoFramePointerElim;
29 }
30
31 /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option
32 /// is specified on the command line. When this flag is off(default), the
33 /// code generator is not allowed to generate mad (multiply add) if the
34 /// result is "less precise" than doing those operations individually.
35 bool TargetOptions::LessPreciseFPMAD() const {
36 return UnsafeFPMath || LessPreciseFPMADOption;
37 }
38
39 /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume
40 /// that the rounding mode of the FPU can change from its default.
41 bool TargetOptions::HonorSignDependentRoundingFPMath() const {
42 return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption;
43 }
44
45 /// getTrapFunctionName - If this returns a non-empty string, this means isel
46 /// should lower Intrinsic::trap to a call to the specified function name
47 /// instead of an ISD::TRAP node.
48 StringRef TargetOptions::getTrapFunctionName() const {
49 return TrapFuncName;
50 }
51