@@ -227,10 +227,6 @@ bool AArch64FrameLowering::hasFP(const MachineFunction &MF) const {
227
227
MFI.getMaxCallFrameSize () > DefaultSafeSPDisplacement)
228
228
return true ;
229
229
230
- // Win64 SEH requires frame pointer if funclets are present.
231
- if (MF.hasLocalEscape ())
232
- return true ;
233
-
234
230
return false ;
235
231
}
236
232
@@ -1469,19 +1465,44 @@ int AArch64FrameLowering::getFrameIndexReference(const MachineFunction &MF,
1469
1465
return resolveFrameIndexReference (MF, FI, FrameReg);
1470
1466
}
1471
1467
1468
+ int AArch64FrameLowering::getNonLocalFrameIndexReference (
1469
+ const MachineFunction &MF, int FI) const {
1470
+ return getSEHFrameIndexOffset (MF, FI);
1471
+ }
1472
+
1473
+ static int getFPOffset (const MachineFunction &MF, int FI) {
1474
+ const auto &MFI = MF.getFrameInfo ();
1475
+ const auto *AFI = MF.getInfo <AArch64FunctionInfo>();
1476
+ const auto &Subtarget = MF.getSubtarget <AArch64Subtarget>();
1477
+ bool IsWin64 =
1478
+ Subtarget.isCallingConvWin64 (MF.getFunction ().getCallingConv ());
1479
+ unsigned FixedObject = IsWin64 ? alignTo (AFI->getVarArgsGPRSize (), 16 ) : 0 ;
1480
+ return MFI.getObjectOffset (FI) + FixedObject + 16 ;
1481
+ }
1482
+
1483
+ static int getStackOffset (const MachineFunction &MF, int FI) {
1484
+ const auto &MFI = MF.getFrameInfo ();
1485
+ return MFI.getObjectOffset (FI) + MFI.getStackSize ();
1486
+ }
1487
+
1488
+ int AArch64FrameLowering::getSEHFrameIndexOffset (const MachineFunction &MF,
1489
+ int FI) const {
1490
+ const auto *RegInfo = static_cast <const AArch64RegisterInfo *>(
1491
+ MF.getSubtarget ().getRegisterInfo ());
1492
+ return RegInfo->getLocalAddressRegister (MF) == AArch64::FP ?
1493
+ getFPOffset (MF, FI) : getStackOffset (MF, FI);
1494
+ }
1495
+
1472
1496
int AArch64FrameLowering::resolveFrameIndexReference (const MachineFunction &MF,
1473
1497
int FI, unsigned &FrameReg,
1474
1498
bool PreferFP) const {
1475
- const MachineFrameInfo &MFI = MF.getFrameInfo ();
1476
- const AArch64RegisterInfo *RegInfo = static_cast <const AArch64RegisterInfo *>(
1499
+ const auto &MFI = MF.getFrameInfo ();
1500
+ const auto *RegInfo = static_cast <const AArch64RegisterInfo *>(
1477
1501
MF.getSubtarget ().getRegisterInfo ());
1478
- const AArch64FunctionInfo *AFI = MF.getInfo <AArch64FunctionInfo>();
1479
- const AArch64Subtarget &Subtarget = MF.getSubtarget <AArch64Subtarget>();
1480
- bool IsWin64 =
1481
- Subtarget.isCallingConvWin64 (MF.getFunction ().getCallingConv ());
1482
- unsigned FixedObject = IsWin64 ? alignTo (AFI->getVarArgsGPRSize (), 16 ) : 0 ;
1483
- int FPOffset = MFI.getObjectOffset (FI) + FixedObject + 16 ;
1484
- int Offset = MFI.getObjectOffset (FI) + MFI.getStackSize ();
1502
+ const auto *AFI = MF.getInfo <AArch64FunctionInfo>();
1503
+ const auto &Subtarget = MF.getSubtarget <AArch64Subtarget>();
1504
+ int FPOffset = getFPOffset (MF, FI);
1505
+ int Offset = getStackOffset (MF, FI);
1485
1506
bool isFixed = MFI.isFixedObjectIndex (FI);
1486
1507
bool isCSR = !isFixed && MFI.getObjectOffset (FI) >=
1487
1508
-((int )AFI->getCalleeSavedStackSize ());
0 commit comments