28 : HasRedZone(MFI.hasRedZone()) {}
44 if (!
F.hasFnAttribute(
"sign-return-address")) {
45 const Module &M = *
F.getParent();
46 if (
const auto *Sign = mdconst::extract_or_null<ConstantInt>(
47 M.getModuleFlag(
"sign-return-address"))) {
48 if (Sign->getZExtValue()) {
49 if (
const auto *
All = mdconst::extract_or_null<ConstantInt>(
50 M.getModuleFlag(
"sign-return-address-all")))
51 return {
true,
All->getZExtValue()};
55 return {
false,
false};
58 StringRef Scope =
F.getFnAttribute(
"sign-return-address").getValueAsString();
59 if (Scope.equals(
"none"))
60 return {
false,
false};
62 if (Scope.equals(
"all"))
65 assert(Scope.equals(
"non-leaf"));
70 if (!
F.hasFnAttribute(
"sign-return-address-key")) {
71 if (
const auto *BKey = mdconst::extract_or_null<ConstantInt>(
72 F.getParent()->getModuleFlag(
"sign-return-address-with-bkey")))
73 return BKey->getZExtValue();
80 F.getFnAttribute(
"sign-return-address-key").getValueAsString();
81 assert(Key ==
"a_key" || Key ==
"b_key");
82 return Key ==
"b_key";
89 if (
F.hasFnAttribute(Attribute::NoRedZone))
94 IsMTETagged =
F.hasFnAttribute(Attribute::SanitizeMemTag);
102 if (
F.hasFnAttribute(AttrName)) {
103 const StringRef V =
F.getFnAttribute(AttrName).getValueAsString();
104 assert(V.equals_insensitive(
"true") || V.equals_insensitive(
"false"));
105 Bool = V.equals_insensitive(
"true");
106 }
else if (
const auto *ModVal = mdconst::extract_or_null<ConstantInt>(
107 F.getParent()->getModuleFlag(AttrName))) {
108 Bool = ModVal->getZExtValue();
112 TryFnThenModule(
"branch-target-enforcement", BranchTargetEnforcement);
113 TryFnThenModule(
"branch-protection-pauth-lr", BranchProtectionPAuthLR);
119 if (
F.hasFnAttribute(
"stack-probe-size"))
120 ProbeSize =
F.getFnAttributeAsParsedInteger(
"stack-probe-size");
121 else if (
const auto *PS = mdconst::extract_or_null<ConstantInt>(
122 F.getParent()->getModuleFlag(
"stack-probe-size")))
123 ProbeSize = PS->getZExtValue();
124 assert(int64_t(ProbeSize) > 0 &&
"Invalid stack probe size");
127 if (!
F.hasFnAttribute(
"no-stack-arg-probe"))
128 StackProbeSize = ProbeSize;
133 ProbeSize = std::max(StackAlign, ProbeSize & ~(StackAlign - 1U));
135 if (
F.hasFnAttribute(
"probe-stack"))
136 ProbeKind =
F.getFnAttribute(
"probe-stack").getValueAsString();
137 else if (
const auto *PS = dyn_cast_or_null<MDString>(
138 F.getParent()->getModuleFlag(
"probe-stack")))
139 ProbeKind = PS->getString();
140 if (ProbeKind.
size()) {
141 if (ProbeKind !=
"inline-asm")
143 StackProbeSize = ProbeSize;
156 if (!SignReturnAddress)
158 if (SignReturnAddressAll)
166 [](
const auto &
Info) { return Info.getReg() == AArch64::LR; });
188 if (!NeedsDwarfUnwindInfo)
192 return *NeedsDwarfUnwindInfo;
197 if (!NeedsAsyncDwarfUnwindInfo) {
202 NeedsAsyncDwarfUnwindInfo = needsDwarfUnwindInfo(MF) &&
206 return *NeedsAsyncDwarfUnwindInfo;
static std::pair< bool, bool > GetSignReturnAddress(const Function &F)
static bool ShouldSignWithBKey(const Function &F, const AArch64Subtarget &STI)
static bool isLRSpilled(const MachineFunction &MF)
Analysis containing CSE Info
This file contains the declarations for the subclasses of Constant, which represent the different fla...
Module.h This file contains the declarations for the Module class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
AArch64FunctionInfo - This class is derived from MachineFunctionInfo and contains private AArch64-spe...
bool needsShadowCallStackPrologueEpilogue(MachineFunction &MF) const
bool shouldSignReturnAddress(const MachineFunction &MF) const
bool needsDwarfUnwindInfo(const MachineFunction &MF) const
void initializeBaseYamlFields(const yaml::AArch64FunctionInfo &YamlMFI)
bool needsAsyncDwarfUnwindInfo(const MachineFunction &MF) const
MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
bool isTargetWindows() const
const Triple & getTargetTriple() const
bool isXRegisterReserved(size_t i) const
const AArch64FrameLowering * getFrameLowering() const override
Allocate memory in an ever growing pool, as if by bump-pointer.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
bool usesWindowsCFI() const
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
bool needsFrameMoves() const
True if this function needs frame moves for debug or exceptions.
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Function & getFunction()
Return the LLVM function that this machine code represents.
const LLVMTargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Ty * cloneInfo(const Ty &Old)
A Module instance is used to store all the information related to an LLVM module.
StringRef - Represent a constant reference to a string, i.e.
constexpr size_t size() const
size - Get the string size.
Align getTransientStackAlign() const
getTransientStackAlignment - This method returns the number of bytes to which the stack pointer must ...
const MCAsmInfo * getMCAsmInfo() const
Return target specific asm information.
bool isOSWindows() const
Tests whether the OS is Windows.
This is an optimization pass for GlobalISel generic memory operations.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
@ Async
"Asynchronous" unwind tables (instr precise)
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
uint64_t value() const
This is a hole in the type system and should not be abused.
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
std::optional< bool > HasRedZone
AArch64FunctionInfo()=default
void mappingImpl(yaml::IO &YamlIO) override