LLVM 22.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
18#include "llvm/IR/Function.h"
20using namespace llvm;
21
22/// DisableFramePointerElim - This returns true if frame pointer elimination
23/// optimization should be disabled for the given machine function.
25 const Function &F = MF.getFunction();
26
27 Attribute FPAttr = F.getFnAttribute("frame-pointer");
28 if (!FPAttr.isValid())
29 return false;
30 StringRef FP = FPAttr.getValueAsString();
31 if (FP == "all")
32 return true;
33 if (FP == "non-leaf")
34 return MF.getFrameInfo().hasCalls();
35 if (FP == "none" || FP == "reserved")
36 return false;
37 llvm_unreachable("unknown frame pointer flag");
38}
39
41 const Function &F = MF.getFunction();
42 Attribute FPAttr = F.getFnAttribute("frame-pointer");
43 if (!FPAttr.isValid())
44 return false;
45
47 .Cases("all", "non-leaf", "reserved", true)
48 .Case("none", false);
49}
50
51/// HonorSignDependentRoundingFPMath - Return true if the codegen must assume
52/// that the rounding mode of the FPU can change from its default.
55}
56
57/// NOTE: There are targets that still do not support the debug entry values
58/// production and that is being controlled with the SupportsDebugEntryValues.
59/// In addition, SCE debugger does not have the feature implemented, so prefer
60/// not to emit the debug entry values in that case.
61/// The EnableDebugEntryValues can be used for the testing purposes.
65}
#define F(x, y, z)
Definition: MD5.cpp:55
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
LLVM_ABI StringRef getValueAsString() const
Return the attribute's value as a string.
Definition: Attributes.cpp:400
bool isValid() const
Return true if the attribute is any kind of attribute.
Definition: Attributes.h:223
bool hasCalls() const
Return true if the current function has any function calls.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Function & getFunction()
Return the LLVM function that this machine code represents.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:43
StringSwitch & Case(StringLiteral S, T Value)
Definition: StringSwitch.h:68
StringSwitch & Cases(StringLiteral S0, StringLiteral S1, T Value)
Definition: StringSwitch.h:87
unsigned UnsafeFPMath
UnsafeFPMath - This flag is enabled when the -enable-unsafe-fp-math flag is specified on the command ...
LLVM_ABI bool HonorSignDependentRoundingFPMath() const
HonorSignDependentRoundingFPMath - Return true if the codegen must assume that the rounding mode of t...
unsigned SupportsDebugEntryValues
Set if the target supports the debug entry values by default.
unsigned HonorSignDependentRoundingFPMathOption
HonorSignDependentRoundingFPMath - This returns true when the -enable-sign-dependent-rounding-fp-math...
DebuggerKind DebuggerTuning
Which debugger to tune for.
LLVM_ABI bool FramePointerIsReserved(const MachineFunction &MF) const
FramePointerIsReserved - This returns true if the frame pointer must always either point to a new fra...
LLVM_ABI bool DisableFramePointerElim(const MachineFunction &MF) const
DisableFramePointerElim - This returns true if frame pointer elimination optimization should be disab...
unsigned EnableDebugEntryValues
When set to true, the EnableDebugEntryValues option forces production of debug entry values even if t...
LLVM_ABI bool ShouldEmitDebugEntryValues() const
NOTE: There are targets that still do not support the debug entry values production.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ SCE
Tune debug info for SCE targets (e.g. PS4).