@@ -443,7 +443,7 @@ void SystemZELFFrameLowering::processFunctionBeforeFrameFinalized(
443
443
MachineFrameInfo &MFFrame = MF.getFrameInfo ();
444
444
SystemZMachineFunctionInfo *ZFI = MF.getInfo <SystemZMachineFunctionInfo>();
445
445
MachineRegisterInfo *MRI = &MF.getRegInfo ();
446
- bool BackChain = MF.getFunction ().hasFnAttribute ( " backchain " );
446
+ bool BackChain = MF.getSubtarget <SystemZSubtarget> ().hasBackChain ( );
447
447
448
448
if (!usePackedStack (MF) || BackChain)
449
449
// Create the incoming register save area.
@@ -628,7 +628,7 @@ void SystemZELFFrameLowering::emitPrologue(MachineFunction &MF,
628
628
.addImm (StackSize);
629
629
}
630
630
else {
631
- bool StoreBackchain = MF.getFunction ().hasFnAttribute ( " backchain " );
631
+ bool StoreBackchain = MF.getSubtarget <SystemZSubtarget> ().hasBackChain ( );
632
632
// If we need backchain, save current stack pointer. R1 is free at
633
633
// this point.
634
634
if (StoreBackchain)
@@ -786,7 +786,7 @@ void SystemZELFFrameLowering::inlineStackProbe(
786
786
.addMemOperand (MMO);
787
787
};
788
788
789
- bool StoreBackchain = MF.getFunction ().hasFnAttribute ( " backchain " );
789
+ bool StoreBackchain = MF.getSubtarget <SystemZSubtarget> ().hasBackChain ( );
790
790
if (StoreBackchain)
791
791
BuildMI (*MBB, MBBI, DL, ZII->get (SystemZ::LGR))
792
792
.addReg (SystemZ::R1D, RegState::Define).addReg (SystemZ::R15D);
@@ -861,8 +861,9 @@ StackOffset SystemZELFFrameLowering::getFrameIndexReference(
861
861
unsigned SystemZELFFrameLowering::getRegSpillOffset (MachineFunction &MF,
862
862
Register Reg) const {
863
863
bool IsVarArg = MF.getFunction ().isVarArg ();
864
- bool BackChain = MF.getFunction ().hasFnAttribute (" backchain" );
865
- bool SoftFloat = MF.getSubtarget <SystemZSubtarget>().hasSoftFloat ();
864
+ const SystemZSubtarget &Subtarget = MF.getSubtarget <SystemZSubtarget>();
865
+ bool BackChain = Subtarget.hasBackChain ();
866
+ bool SoftFloat = Subtarget.hasSoftFloat ();
866
867
unsigned Offset = RegSpillOffsets[Reg];
867
868
if (usePackedStack (MF) && !(IsVarArg && !SoftFloat)) {
868
869
if (SystemZ::GR64BitRegClass.contains (Reg))
@@ -890,8 +891,9 @@ int SystemZELFFrameLowering::getOrCreateFramePointerSaveIndex(
890
891
891
892
bool SystemZELFFrameLowering::usePackedStack (MachineFunction &MF) const {
892
893
bool HasPackedStackAttr = MF.getFunction ().hasFnAttribute (" packed-stack" );
893
- bool BackChain = MF.getFunction ().hasFnAttribute (" backchain" );
894
- bool SoftFloat = MF.getSubtarget <SystemZSubtarget>().hasSoftFloat ();
894
+ const SystemZSubtarget &Subtarget = MF.getSubtarget <SystemZSubtarget>();
895
+ bool BackChain = Subtarget.hasBackChain ();
896
+ bool SoftFloat = Subtarget.hasSoftFloat ();
895
897
if (HasPackedStackAttr && BackChain && !SoftFloat)
896
898
report_fatal_error (" packed-stack + backchain + hard-float is unsupported." );
897
899
bool CallConv = MF.getFunction ().getCallingConv () != CallingConv::GHC;
@@ -946,7 +948,7 @@ static bool isXPLeafCandidate(const MachineFunction &MF) {
946
948
return false ;
947
949
948
950
// If the backchain pointer should be stored, then it is not a XPLeaf routine.
949
- if (MF.getFunction ().hasFnAttribute ( " backchain " ))
951
+ if (MF.getSubtarget <SystemZSubtarget> ().hasBackChain ( ))
950
952
return false ;
951
953
952
954
// If function acquires its own stack frame, then it is not a XPLeaf routine.
@@ -989,7 +991,7 @@ bool SystemZXPLINKFrameLowering::assignCalleeSavedSpillSlots(
989
991
990
992
// If the function needs a frame pointer, or if the backchain pointer should
991
993
// be stored, then save the stack pointer register R4.
992
- if (hasFP (MF) || MF. getFunction (). hasFnAttribute ( " backchain " ))
994
+ if (hasFP (MF) || Subtarget. hasBackChain ( ))
993
995
CSI.push_back (CalleeSavedInfo (Regs.getStackPointerRegister ()));
994
996
995
997
// Scan the call-saved GPRs and find the bounds of the register spill area.
0 commit comments