aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2025-08-13 16:22:32 +0900
committerGitHub <noreply@github.com>2025-08-13 16:22:32 +0900
commitdb126d8004fda8998792e83e6938f4b3c221227a (patch)
treeb357c89b13bf4c2a2fcd55f1089a4bc8b45a3a66 /llvm/lib/CodeGen/MachineFunction.cpp
parent02ab6f358cf26f00342acc7c1c306dd61cd4f10e (diff)
downloadllvm-db126d8004fda8998792e83e6938f4b3c221227a.zip
llvm-db126d8004fda8998792e83e6938f4b3c221227a.tar.gz
llvm-db126d8004fda8998792e83e6938f4b3c221227a.tar.bz2
CodeGen: Make MachineFunction's subtarget member a reference (#153352)
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index ec40f6a..82ba596 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -154,17 +154,17 @@ void ilist_alloc_traits<MachineBasicBlock>::deleteNode(MachineBasicBlock *MBB) {
MBB->getParent()->deleteMachineBasicBlock(MBB);
}
-static inline Align getFnStackAlignment(const TargetSubtargetInfo *STI,
- const Function &F) {
+static inline Align getFnStackAlignment(const TargetSubtargetInfo &STI,
+ const Function &F) {
if (auto MA = F.getFnStackAlign())
return *MA;
- return STI->getFrameLowering()->getStackAlign();
+ return STI.getFrameLowering()->getStackAlign();
}
MachineFunction::MachineFunction(Function &F, const TargetMachine &Target,
const TargetSubtargetInfo &STI, MCContext &Ctx,
unsigned FunctionNum)
- : F(F), Target(Target), STI(&STI), Ctx(Ctx) {
+ : F(F), Target(Target), STI(STI), Ctx(Ctx) {
FunctionNumber = FunctionNum;
init();
}
@@ -195,7 +195,7 @@ void MachineFunction::init() {
// We can realign the stack if the target supports it and the user hasn't
// explicitly asked us not to.
- bool CanRealignSP = STI->getFrameLowering()->isStackRealignable() &&
+ bool CanRealignSP = STI.getFrameLowering()->isStackRealignable() &&
!F.hasFnAttribute("no-realign-stack");
bool ForceRealignSP = F.hasFnAttribute(Attribute::StackAlignment) ||
F.hasFnAttribute("stackrealign");
@@ -209,11 +209,11 @@ void MachineFunction::init() {
FrameInfo->ensureMaxAlignment(*F.getFnStackAlign());
ConstantPool = new (Allocator) MachineConstantPool(getDataLayout());
- Alignment = STI->getTargetLowering()->getMinFunctionAlignment();
+ Alignment = STI.getTargetLowering()->getMinFunctionAlignment();
if (!F.getAlign() && !F.hasOptSize())
Alignment = std::max(Alignment,
- STI->getTargetLowering()->getPrefFunctionAlignment());
+ STI.getTargetLowering()->getPrefFunctionAlignment());
// -fsanitize=function and -fsanitize=kcfi instrument indirect function calls
// to load a type hash before the function label. Ensure functions are aligned