Nick Lewycky | 028700f | 2011-12-15 22:58:58 +0000 | [diff] [blame] | 1 | //===-- TargetOptionsImpl.cpp - Options that apply to all targets ----------==// |
Nick Lewycky | b3ffe10 | 2011-12-10 22:34:41 +0000 | [diff] [blame] | 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 implements the methods in the TargetOptions. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #include "llvm/CodeGen/MachineFunction.h" |
| 15 | #include "llvm/CodeGen/MachineFrameInfo.h" |
| 16 | #include "llvm/Target/TargetOptions.h" |
| 17 | using namespace llvm; |
| 18 | |
| 19 | /// DisableFramePointerElim - This returns true if frame pointer elimination |
| 20 | /// optimization should be disabled for the given machine function. |
| 21 | bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const { |
| 22 | // Check to see if we should eliminate non-leaf frame pointers and then |
| 23 | // check to see if we should eliminate all frame pointers. |
| 24 | if (NoFramePointerElimNonLeaf && !NoFramePointerElim) { |
| 25 | const MachineFrameInfo *MFI = MF.getFrameInfo(); |
| 26 | return MFI->hasCalls(); |
| 27 | } |
| 28 | |
| 29 | return NoFramePointerElim; |
| 30 | } |
| 31 | |
| 32 | /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option |
| 33 | /// is specified on the command line. When this flag is off(default), the |
| 34 | /// code generator is not allowed to generate mad (multiply add) if the |
| 35 | /// result is "less precise" than doing those operations individually. |
| 36 | bool TargetOptions::LessPreciseFPMAD() const { |
| 37 | return UnsafeFPMath || LessPreciseFPMADOption; |
| 38 | } |
| 39 | |
| 40 | /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume |
| 41 | /// that the rounding mode of the FPU can change from its default. |
| 42 | bool TargetOptions::HonorSignDependentRoundingFPMath() const { |
| 43 | return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption; |
| 44 | } |
| 45 | |
| 46 | /// getTrapFunctionName - If this returns a non-empty string, this means isel |
| 47 | /// should lower Intrinsic::trap to a call to the specified function name |
| 48 | /// instead of an ISD::TRAP node. |
| 49 | StringRef TargetOptions::getTrapFunctionName() const { |
| 50 | return TrapFuncName; |
| 51 | } |
| 52 | |
Bill Wendling | 13bbe1f | 2013-04-05 21:52:40 +0000 | [diff] [blame] | 53 | bool TargetOptions::operator==(const TargetOptions &TO) { |
| 54 | #define ARE_EQUAL(X) X == TO.X |
| 55 | return |
| 56 | ARE_EQUAL(UnsafeFPMath) && |
| 57 | ARE_EQUAL(NoInfsFPMath) && |
| 58 | ARE_EQUAL(NoNaNsFPMath) && |
| 59 | ARE_EQUAL(HonorSignDependentRoundingFPMathOption) && |
| 60 | ARE_EQUAL(UseSoftFloat) && |
| 61 | ARE_EQUAL(NoZerosInBSS) && |
| 62 | ARE_EQUAL(JITExceptionHandling) && |
| 63 | ARE_EQUAL(JITEmitDebugInfo) && |
| 64 | ARE_EQUAL(JITEmitDebugInfoToDisk) && |
| 65 | ARE_EQUAL(GuaranteedTailCallOpt) && |
| 66 | ARE_EQUAL(DisableTailCalls) && |
| 67 | ARE_EQUAL(StackAlignmentOverride) && |
| 68 | ARE_EQUAL(RealignStack) && |
| 69 | ARE_EQUAL(SSPBufferSize) && |
| 70 | ARE_EQUAL(EnableFastISel) && |
| 71 | ARE_EQUAL(PositionIndependentExecutable) && |
| 72 | ARE_EQUAL(EnableSegmentedStacks) && |
| 73 | ARE_EQUAL(UseInitArray) && |
| 74 | ARE_EQUAL(TrapFuncName) && |
| 75 | ARE_EQUAL(FloatABIType) && |
| 76 | ARE_EQUAL(AllowFPOpFusion); |
| 77 | #undef ARE_EQUAL |
| 78 | } |