LLVM  13.0.0git
TargetOptionsImpl.cpp
Go to the documentation of this file.
1 //===-- TargetOptionsImpl.cpp - Options that apply to all targets ----------==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the methods in the TargetOptions.
10 //
11 //===----------------------------------------------------------------------===//
12 
17 #include "llvm/IR/Function.h"
18 #include "llvm/IR/Module.h"
20 using namespace llvm;
21 
22 /// DisableFramePointerElim - This returns true if frame pointer elimination
23 /// optimization should be disabled for the given machine function.
25  // Check to see if the target want to forcably keep frame pointer.
27  return true;
28 
29  const Function &F = MF.getFunction();
30 
31  if (!F.hasFnAttribute("frame-pointer"))
32  return false;
33  StringRef FP = F.getFnAttribute("frame-pointer").getValueAsString();
34  if (FP == "all")
35  return true;
36  if (FP == "non-leaf")
37  return MF.getFrameInfo().hasCalls();
38  if (FP == "none")
39  return false;
40  llvm_unreachable("unknown frame pointer flag");
41 }
42 
43 /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume
44 /// that the rounding mode of the FPU can change from its default.
47 }
48 
49 /// NOTE: There are targets that still do not support the debug entry values
50 /// production and that is being controlled with the SupportsDebugEntryValues.
51 /// In addition, SCE debugger does not have the feature implemented, so prefer
52 /// not to emit the debug entry values in that case.
53 /// The EnableDebugEntryValues can be used for the testing purposes.
57 }
llvm::TargetOptions::HonorSignDependentRoundingFPMathOption
unsigned HonorSignDependentRoundingFPMathOption
HonorSignDependentRoundingFPMath - This returns true when the -enable-sign-dependent-rounding-fp-math...
Definition: TargetOptions.h:193
CmpMode::FP
@ FP
llvm
Definition: AllocatorList.h:23
TargetFrameLowering.h
llvm::Function
Definition: Function.h:61
Module.h
llvm::TargetOptions::HonorSignDependentRoundingFPMath
bool HonorSignDependentRoundingFPMath() const
HonorSignDependentRoundingFPMath - Return true if the codegen must assume that the rounding mode of t...
Definition: TargetOptionsImpl.cpp:45
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::TargetFrameLowering::keepFramePointer
virtual bool keepFramePointer(const MachineFunction &MF) const
Return true if the target wants to keep the frame pointer regardless of the function attribute "frame...
Definition: TargetFrameLowering.h:264
llvm::TargetOptions::DisableFramePointerElim
bool DisableFramePointerElim(const MachineFunction &MF) const
DisableFramePointerElim - This returns true if frame pointer elimination optimization should be disab...
Definition: TargetOptionsImpl.cpp:24
llvm::MachineFunction::getSubtarget
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Definition: MachineFunction.h:558
llvm::TargetOptions::SupportsDebugEntryValues
unsigned SupportsDebugEntryValues
Set if the target supports the debug entry values by default.
Definition: TargetOptions.h:306
llvm::TargetOptions::ShouldEmitDebugEntryValues
bool ShouldEmitDebugEntryValues() const
NOTE: There are targets that still do not support the debug entry values production.
Definition: TargetOptionsImpl.cpp:54
llvm::MachineFunction::getFrameInfo
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Definition: MachineFunction.h:574
llvm::MachineFunction
Definition: MachineFunction.h:230
TargetOptions.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
TargetSubtargetInfo.h
llvm::MachineFrameInfo::hasCalls
bool hasCalls() const
Return true if the current function has any function calls.
Definition: MachineFrameInfo.h:602
llvm::TargetOptions::DebuggerTuning
DebuggerKind DebuggerTuning
Which debugger to tune for.
Definition: TargetOptions.h:374
llvm::MachineFunction::getFunction
Function & getFunction()
Return the LLVM function that this machine code represents.
Definition: MachineFunction.h:524
llvm::TargetSubtargetInfo::getFrameLowering
virtual const TargetFrameLowering * getFrameLowering() const
Definition: TargetSubtargetInfo.h:93
MachineFrameInfo.h
Function.h
llvm::TargetOptions::UnsafeFPMath
unsigned UnsafeFPMath
UnsafeFPMath - This flag is enabled when the -enable-unsafe-fp-math flag is specified on the command ...
Definition: TargetOptions.h:155
llvm::DebuggerKind::SCE
@ SCE
Tune debug info for SCE targets (e.g. PS4).
MachineFunction.h
llvm::TargetOptions::EnableDebugEntryValues
unsigned EnableDebugEntryValues
When set to true, the EnableDebugEntryValues option forces production of debug entry values even if t...
Definition: TargetOptions.h:311