2011-12-16 06:58:58 +08:00
|
|
|
//===-- TargetOptionsImpl.cpp - Options that apply to all targets ----------==//
|
2011-12-11 06:34:41 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the methods in the TargetOptions.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-07-25 08:34:29 +08:00
|
|
|
#include "llvm/IR/Function.h"
|
2015-05-23 09:14:08 +08:00
|
|
|
#include "llvm/IR/Module.h"
|
2011-12-11 06:34:41 +08:00
|
|
|
#include "llvm/CodeGen/MachineFrameInfo.h"
|
2014-01-07 19:48:04 +08:00
|
|
|
#include "llvm/CodeGen/MachineFunction.h"
|
2015-05-23 09:14:08 +08:00
|
|
|
#include "llvm/Target/TargetFrameLowering.h"
|
2011-12-11 06:34:41 +08:00
|
|
|
#include "llvm/Target/TargetOptions.h"
|
2015-05-23 09:14:08 +08:00
|
|
|
#include "llvm/Target/TargetSubtargetInfo.h"
|
2011-12-11 06:34:41 +08:00
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
/// DisableFramePointerElim - This returns true if frame pointer elimination
|
|
|
|
/// optimization should be disabled for the given machine function.
|
|
|
|
bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const {
|
2015-05-23 09:14:08 +08:00
|
|
|
// Check to see if we should eliminate all frame pointers.
|
|
|
|
if (MF.getSubtarget().getFrameLowering()->noFramePointerElim(MF))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
// Check to see if we should eliminate non-leaf frame pointers.
|
|
|
|
if (MF.getFunction()->hasFnAttribute("no-frame-pointer-elim-non-leaf"))
|
2016-07-29 02:40:00 +08:00
|
|
|
return MF.getFrameInfo().hasCalls();
|
2011-12-11 06:34:41 +08:00
|
|
|
|
2015-05-23 09:14:08 +08:00
|
|
|
return false;
|
2011-12-11 06:34:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// HonorSignDependentRoundingFPMath - Return true if the codegen must assume
|
|
|
|
/// that the rounding mode of the FPU can change from its default.
|
|
|
|
bool TargetOptions::HonorSignDependentRoundingFPMath() const {
|
|
|
|
return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption;
|
|
|
|
}
|