LLVM: lib/Target/AArch64/AArch64MachineFunctionInfo.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

24

25using namespace llvm;

26

27static std::optional<uint64_t>

31 return std::nullopt;

32 return (MFI.*GetStackSize)();

33}

34

43 ? std::optional<bool>(MFI.hasStackFrame())

44 : std::nullopt),

46 MFI.hasStreamingModeChanges()

47 ? std::optional<bool>(MFI.hasStreamingModeChanges())

48 : std::nullopt) {}

49

53

66

68 if (F.hasFnAttribute("ptrauth-returns"))

70

71

72

73

74 if (F.hasFnAttribute("sign-return-address"))

76

77 StringRef Scope = F.getFnAttribute("sign-return-address").getValueAsString();

82}

83

85 if (F.hasFnAttribute("ptrauth-returns"))

86 return true;

87 if (F.hasFnAttribute("sign-return-address-key")) {

89 return true;

90 return false;

91 }

92

94 F.getFnAttribute("sign-return-address-key").getValueAsString();

96 return Key == "b_key";

97}

98

102 return false;

103 const Module *M = F.getParent();

105 M->getModuleFlag("ptrauth-elf-got"));

106 if (Flag && Flag->getZExtValue() == 1)

107 return true;

108 return false;

109}

110

113

114

115 if (F.hasFnAttribute(Attribute::NoRedZone))

116 HasRedZone = false;

120

121 IsMTETagged = F.hasFnAttribute(Attribute::SanitizeMemTag);

122

123

124 BranchTargetEnforcement = F.hasFnAttribute("branch-target-enforcement");

125 BranchProtectionPAuthLR = F.hasFnAttribute("branch-protection-pauth-lr");

126

127

129

130

131

132

134 if (F.hasFnAttribute("stack-probe-size"))

135 ProbeSize = F.getFnAttributeAsParsedInteger("stack-probe-size");

137 F.getParent()->getModuleFlag("stack-probe-size")))

138 ProbeSize = PS->getZExtValue();

139 assert(int64_t(ProbeSize) > 0 && "Invalid stack probe size");

140

142 if (F.hasFnAttribute("no-stack-arg-probe"))

143 StackProbeSize = ProbeSize;

144 } else {

145

148 ProbeSize = std::max(StackAlign, ProbeSize & ~(StackAlign - 1U));

150 if (F.hasFnAttribute("probe-stack"))

151 ProbeKind = F.getFnAttribute("probe-stack").getValueAsString();

153 F.getParent()->getModuleFlag("probe-stack")))

154 ProbeKind = PS->getString();

155 if (ProbeKind.size()) {

156 if (ProbeKind != "inline-asm")

158 StackProbeSize = ProbeSize;

159 }

160 }

161}

162

169

173 [](const auto &Info) { return Info.getReg() == AArch64::LR; });

174}

175

177 bool IsLRSpilled) {

178 switch (Condition) {

180 return false;

182 return IsLRSpilled;

184 return true;

185 }

187}

188

193

198 return false;

199

202

203 return true;

204}

205

208 if (!NeedsDwarfUnwindInfo)

211

212 return *NeedsDwarfUnwindInfo;

213}

214

217 if (!NeedsAsyncDwarfUnwindInfo) {

220

221

222

223 NeedsAsyncDwarfUnwindInfo =

227 }

228 return *NeedsAsyncDwarfUnwindInfo;

229}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static SignReturnAddress GetSignReturnAddress(const Function &F)

Definition AArch64MachineFunctionInfo.cpp:67

static std::optional< uint64_t > getSVEStackSize(const AArch64FunctionInfo &MFI, uint64_t(AArch64FunctionInfo::*GetStackSize)() const)

Definition AArch64MachineFunctionInfo.cpp:28

static bool ShouldSignWithBKey(const Function &F, const AArch64Subtarget &STI)

Definition AArch64MachineFunctionInfo.cpp:84

static bool hasELFSignedGOTHelper(const Function &F, const AArch64Subtarget *STI)

Definition AArch64MachineFunctionInfo.cpp:99

static bool isLRSpilled(const MachineFunction &MF)

Definition AArch64MachineFunctionInfo.cpp:170

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.

This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...

AArch64FunctionInfo - This class is derived from MachineFunctionInfo and contains private AArch64-spe...

bool needsShadowCallStackPrologueEpilogue(MachineFunction &MF) const

Definition AArch64MachineFunctionInfo.cpp:194

void setHasStackFrame(bool s)

bool hasStreamingModeChanges() const

void setStackSizeSVE(uint64_t ZPR, uint64_t PPR)

AArch64FunctionInfo(const Function &F, const AArch64Subtarget *STI)

Definition AArch64MachineFunctionInfo.cpp:111

bool needsDwarfUnwindInfo(const MachineFunction &MF) const

Definition AArch64MachineFunctionInfo.cpp:206

static bool shouldSignReturnAddress(SignReturnAddress Condition, bool IsLRSpilled)

Definition AArch64MachineFunctionInfo.cpp:176

bool hasCalculatedStackSizeSVE() const

void initializeBaseYamlFields(const yaml::AArch64FunctionInfo &YamlMFI)

Definition AArch64MachineFunctionInfo.cpp:54

bool needsAsyncDwarfUnwindInfo(const MachineFunction &MF) const

Definition AArch64MachineFunctionInfo.cpp:215

MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const override

Make a functionally equivalent copy of this MachineFunctionInfo in MF.

Definition AArch64MachineFunctionInfo.cpp:163

void setHasStreamingModeChanges(bool HasChanges)

bool isTargetWindows() const

const Triple & getTargetTriple() const

bool isXRegisterReserved(size_t i) const

const AArch64FrameLowering * getFrameLowering() const override

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.

Ty * getInfo()

getInfo - Keep track of various per-function pieces of information for backends that would like to do...

Ty * cloneInfo(const Ty &Old)

const TargetMachine & getTarget() const

getTarget - Return the target machine this machine code is compiled with

A Module instance is used to store all the information related to an LLVM module.

SMEAttrs is a utility class to parse the SME ACLE attributes on functions.

StringRef - Represent a constant reference to a string, i.e.

constexpr size_t size() const

size - Get the string size.

A switch()-like statement whose cases are string literals.

StringSwitch & Case(StringLiteral S, T Value)

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.

bool isOSBinFormatELF() const

Tests whether the OS uses the ELF binary format.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

std::enable_if_t< detail::IsValidPointer< X, Y >::value, X * > extract_or_null(Y &&MD)

Extract a Value from Metadata, allowing null.

This is an optimization pass for GlobalISel generic memory operations.

SignReturnAddress

Condition of signing the return address in a function.

auto dyn_cast_or_null(const Y &Val)

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)

LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)

LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key

BumpPtrAllocatorImpl<> BumpPtrAllocator

The standard BumpPtrAllocator which just uses the default template parameters.

Implement std::hash so that hash_code can be used in STL containers.

constexpr 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

std::optional< uint64_t > StackSizePPR

AArch64FunctionInfo()=default

std::optional< bool > HasStreamingModeChanges

std::optional< bool > HasStackFrame

std::optional< uint64_t > StackSizeZPR

void mappingImpl(yaml::IO &YamlIO) override

Definition AArch64MachineFunctionInfo.cpp:50

This class should be specialized by any type that needs to be converted to/from a YAML mapping.