LLVM API Documentation
00001 //===-- TargetOptionsImpl.cpp - Options that apply to all targets ----------==// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file implements the methods in the TargetOptions. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #include "llvm/IR/Function.h" 00015 #include "llvm/CodeGen/MachineFrameInfo.h" 00016 #include "llvm/CodeGen/MachineFunction.h" 00017 #include "llvm/Target/TargetOptions.h" 00018 using namespace llvm; 00019 00020 /// DisableFramePointerElim - This returns true if frame pointer elimination 00021 /// optimization should be disabled for the given machine function. 00022 bool TargetOptions::DisableFramePointerElim(const MachineFunction &MF) const { 00023 // Check to see if we should eliminate non-leaf frame pointers and then 00024 // check to see if we should eliminate all frame pointers. 00025 if (MF.getFunction()->hasFnAttribute("no-frame-pointer-elim-non-leaf") && 00026 !NoFramePointerElim) { 00027 const MachineFrameInfo *MFI = MF.getFrameInfo(); 00028 return MFI->hasCalls(); 00029 } 00030 00031 return NoFramePointerElim; 00032 } 00033 00034 /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option 00035 /// is specified on the command line. When this flag is off(default), the 00036 /// code generator is not allowed to generate mad (multiply add) if the 00037 /// result is "less precise" than doing those operations individually. 00038 bool TargetOptions::LessPreciseFPMAD() const { 00039 return UnsafeFPMath || LessPreciseFPMADOption; 00040 } 00041 00042 /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume 00043 /// that the rounding mode of the FPU can change from its default. 00044 bool TargetOptions::HonorSignDependentRoundingFPMath() const { 00045 return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption; 00046 } 00047 00048 /// getTrapFunctionName - If this returns a non-empty string, this means isel 00049 /// should lower Intrinsic::trap to a call to the specified function name 00050 /// instead of an ISD::TRAP node. 00051 StringRef TargetOptions::getTrapFunctionName() const { 00052 return TrapFuncName; 00053 }