Mercurial > hg > CbC > CbC_llvm
comparison lib/CodeGen/TargetOptionsImpl.cpp @ 95:afa8332a0e37 LLVM3.8
LLVM 3.8
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 13 Oct 2015 17:48:58 +0900 |
parents | 60c9769439b8 |
children | 1172e4bd9c6f |
comparison
equal
deleted
inserted
replaced
84:f3e34b893a5f | 95:afa8332a0e37 |
---|---|
10 // This file implements the methods in the TargetOptions. | 10 // This file implements the methods in the TargetOptions. |
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #include "llvm/IR/Function.h" | 14 #include "llvm/IR/Function.h" |
15 #include "llvm/IR/Module.h" | |
15 #include "llvm/CodeGen/MachineFrameInfo.h" | 16 #include "llvm/CodeGen/MachineFrameInfo.h" |
16 #include "llvm/CodeGen/MachineFunction.h" | 17 #include "llvm/CodeGen/MachineFunction.h" |
18 #include "llvm/Target/TargetFrameLowering.h" | |
17 #include "llvm/Target/TargetOptions.h" | 19 #include "llvm/Target/TargetOptions.h" |
20 #include "llvm/Target/TargetSubtargetInfo.h" | |
18 using namespace llvm; | 21 using namespace llvm; |
19 | 22 |
20 /// DisableFramePointerElim - This returns true if frame pointer elimination | 23 /// DisableFramePointerElim - This returns true if frame pointer elimination |
21 /// optimization should be disabled for the given machine function. | 24 /// optimization should be disabled for the given machine function. |
22 bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const { | 25 bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const { |
23 // Check to see if we should eliminate non-leaf frame pointers and then | 26 // Check to see if we should eliminate all frame pointers. |
24 // check to see if we should eliminate all frame pointers. | 27 if (MF.getSubtarget().getFrameLowering()->noFramePointerElim(MF)) |
25 if (MF.getFunction()->hasFnAttribute("no-frame-pointer-elim-non-leaf") && | 28 return true; |
26 !NoFramePointerElim) { | |
27 const MachineFrameInfo *MFI = MF.getFrameInfo(); | |
28 return MFI->hasCalls(); | |
29 } | |
30 | 29 |
31 return NoFramePointerElim; | 30 // Check to see if we should eliminate non-leaf frame pointers. |
31 if (MF.getFunction()->hasFnAttribute("no-frame-pointer-elim-non-leaf")) | |
32 return MF.getFrameInfo()->hasCalls(); | |
33 | |
34 return false; | |
32 } | 35 } |
33 | 36 |
34 /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option | 37 /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option |
35 /// is specified on the command line. When this flag is off(default), the | 38 /// is specified on the command line. When this flag is off(default), the |
36 /// code generator is not allowed to generate mad (multiply add) if the | 39 /// code generator is not allowed to generate mad (multiply add) if the |
42 /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume | 45 /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume |
43 /// that the rounding mode of the FPU can change from its default. | 46 /// that the rounding mode of the FPU can change from its default. |
44 bool TargetOptions::HonorSignDependentRoundingFPMath() const { | 47 bool TargetOptions::HonorSignDependentRoundingFPMath() const { |
45 return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption; | 48 return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption; |
46 } | 49 } |
47 | |
48 /// getTrapFunctionName - If this returns a non-empty string, this means isel | |
49 /// should lower Intrinsic::trap to a call to the specified function name | |
50 /// instead of an ISD::TRAP node. | |
51 StringRef TargetOptions::getTrapFunctionName() const { | |
52 return TrapFuncName; | |
53 } | |
54 | |
55 /// getCFIFuncName - If this returns a non-empty string, then it is the name of | |
56 /// the function that gets called on CFI violations in CFI non-enforcing mode | |
57 /// (!TargetOptions::CFIEnforcing). | |
58 StringRef TargetOptions::getCFIFuncName() const { | |
59 return CFIFuncName; | |
60 } |