@@ -718,14 +718,9 @@ static int getMaxFPOffset(const ARMSubtarget &STI, const ARMFunctionInfo &AFI,
718
718
// This is a conservative estimation: Assume the frame pointer being r7 and
719
719
// pc("r15") up to r8 getting spilled before (= 8 registers).
720
720
int MaxRegBytes = 8 * 4 ;
721
- if (STI.getPushPopSplitVariation (MF) ==
722
- ARMSubtarget::PushPopSplitVariation::R11SplitAAPCSBranchSigning)
721
+ if (STI.splitFramePointerPush (MF)) {
723
722
// Here, r11 can be stored below all of r4-r15 (3 registers more than
724
- // above).
725
- MaxRegBytes = 11 * 4 ;
726
- if (STI.getPushPopSplitVariation (MF) ==
727
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind) {
728
- // Here, r11 can be stored below all of r4-r15 plus d8-d15.
723
+ // above), plus d8-d15.
729
724
MaxRegBytes = 11 * 4 + 8 * 8 ;
730
725
}
731
726
int FPCXTSaveSize =
@@ -793,10 +788,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
793
788
}
794
789
795
790
// Determine spill area sizes.
796
- if (STI.getPushPopSplitVariation (MF) ==
797
- ARMSubtarget::PushPopSplitVariation::R11SplitAAPCSBranchSigning ||
798
- STI.getPushPopSplitVariation (MF) ==
799
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind) {
791
+ if (STI.splitFramePointerPush (MF)) {
800
792
for (const CalleeSavedInfo &I : CSI) {
801
793
Register Reg = I.getReg ();
802
794
int FI = I.getFrameIdx ();
@@ -842,8 +834,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
842
834
case ARM::R10:
843
835
case ARM::R11:
844
836
case ARM::R12:
845
- if (STI.getPushPopSplitVariation (MF) ==
846
- ARMSubtarget::PushPopSplitVariation::R7Split) {
837
+ if (STI.splitFramePushPop (MF)) {
847
838
GPRCS2Size += 4 ;
848
839
break ;
849
840
}
@@ -906,15 +897,13 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
906
897
unsigned GPRCS2Offset = GPRCS1Offset - GPRCS2Size;
907
898
Align DPRAlign = DPRCSSize ? std::min (Align (8 ), Alignment) : Align (4 );
908
899
unsigned DPRGapSize = GPRCS1Size + FPCXTSaveSize + ArgRegsSaveSize;
909
- if (STI.getPushPopSplitVariation (MF) !=
910
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind) {
900
+ if (!STI.splitFramePointerPush (MF)) {
911
901
DPRGapSize += GPRCS2Size;
912
902
}
913
903
DPRGapSize %= DPRAlign.value ();
914
904
915
905
unsigned DPRCSOffset;
916
- if (STI.getPushPopSplitVariation (MF) ==
917
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind) {
906
+ if (STI.splitFramePointerPush (MF)) {
918
907
DPRCSOffset = GPRCS1Offset - DPRGapSize - DPRCSSize;
919
908
GPRCS2Offset = DPRCSOffset - GPRCS2Size;
920
909
} else {
@@ -933,10 +922,8 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
933
922
AFI->setGPRCalleeSavedArea2Offset (GPRCS2Offset);
934
923
AFI->setDPRCalleeSavedAreaOffset (DPRCSOffset);
935
924
936
- // Move past area 2, unless following the CSR_Win_SplitFP calling convention.
937
- if (GPRCS2Size > 0 &&
938
- STI.getPushPopSplitVariation (MF) !=
939
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind) {
925
+ // Move past area 2.
926
+ if (GPRCS2Size > 0 && !STI.splitFramePointerPush (MF)) {
940
927
GPRCS2Push = LastPush = MBBI++;
941
928
DefCFAOffsetCandidates.addInst (LastPush, GPRCS2Size);
942
929
}
@@ -976,18 +963,13 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
976
963
} else
977
964
NumBytes = DPRCSOffset;
978
965
979
- // Move past area 2 if following the CSR_Win_SplitFP calling convention.
980
- if (GPRCS2Size > 0 &&
981
- STI.getPushPopSplitVariation (MF) ==
982
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind) {
966
+ if (GPRCS2Size > 0 && STI.splitFramePointerPush (MF)) {
983
967
GPRCS2Push = LastPush = MBBI++;
984
968
DefCFAOffsetCandidates.addInst (LastPush, GPRCS2Size);
985
969
}
986
970
987
971
bool NeedsWinCFIStackAlloc = NeedsWinCFI;
988
- if (STI.getPushPopSplitVariation (MF) ==
989
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind &&
990
- HasFP)
972
+ if (STI.splitFramePointerPush (MF) && HasFP)
991
973
NeedsWinCFIStackAlloc = false ;
992
974
993
975
if (STI.isTargetWindows () && WindowsRequiresStackProbe (MF, NumBytes)) {
@@ -1092,10 +1074,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
1092
1074
AfterPush = std::next (GPRCS1Push);
1093
1075
unsigned PushSize = sizeOfSPAdjustment (*GPRCS1Push);
1094
1076
int FPOffset = PushSize + FramePtrOffsetInPush;
1095
- if (STI.getPushPopSplitVariation (MF) ==
1096
- ARMSubtarget::PushPopSplitVariation::R11SplitAAPCSBranchSigning ||
1097
- STI.getPushPopSplitVariation (MF) ==
1098
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind) {
1077
+ if (STI.splitFramePointerPush (MF)) {
1099
1078
AfterPush = std::next (GPRCS2Push);
1100
1079
emitRegPlusImmediate (!AFI->isThumbFunction (), MBB, AfterPush, dl, TII,
1101
1080
FramePtr, ARM::SP, 0 , MachineInstr::FrameSetup);
@@ -1127,9 +1106,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
1127
1106
// instructions below don't need to be replayed to unwind the stack.
1128
1107
if (NeedsWinCFI && MBBI != MBB.begin ()) {
1129
1108
MachineBasicBlock::iterator End = MBBI;
1130
- if (HasFP &&
1131
- STI.getPushPopSplitVariation (MF) ==
1132
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind)
1109
+ if (HasFP && STI.splitFramePointerPush (MF))
1133
1110
End = AfterPush;
1134
1111
insertSEHRange (MBB, {}, End, TII, MachineInstr::FrameSetup);
1135
1112
BuildMI (MBB, End, dl, TII.get (ARM::SEH_PrologEnd))
@@ -1141,103 +1118,51 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
1141
1118
// the necessary DWARF cf instructions to describe the situation. Start by
1142
1119
// recording where each register ended up:
1143
1120
if (GPRCS1Size > 0 && !NeedsWinCFI) {
1144
- if (STI.getPushPopSplitVariation (MF) ==
1145
- ARMSubtarget::PushPopSplitVariation::R11SplitAAPCSBranchSigning) {
1146
- MachineBasicBlock::iterator Pos = std::next (GPRCS1Push);
1147
- int CFIIndex;
1148
- for (const auto &Entry : CSI) {
1149
- Register Reg = Entry.getReg ();
1150
- int FI = Entry.getFrameIdx ();
1151
- switch (Reg) {
1152
- case ARM::R0:
1153
- case ARM::R1:
1154
- case ARM::R2:
1155
- case ARM::R3:
1156
- case ARM::R4:
1157
- case ARM::R5:
1158
- case ARM::R6:
1159
- case ARM::R7:
1160
- case ARM::R8:
1161
- case ARM::R9:
1162
- case ARM::R10:
1163
- case ARM::R12:
1164
- CFIIndex = MF.addFrameInst (MCCFIInstruction::createOffset (
1165
- nullptr , MRI->getDwarfRegNum (Reg, true ),
1166
- MFI.getObjectOffset (FI)));
1167
- BuildMI (MBB, Pos, dl, TII.get (TargetOpcode::CFI_INSTRUCTION))
1168
- .addCFIIndex (CFIIndex)
1169
- .setMIFlags (MachineInstr::FrameSetup);
1170
- break ;
1171
- }
1172
- }
1173
- } else {
1174
- MachineBasicBlock::iterator Pos = std::next (GPRCS1Push);
1175
- int CFIIndex;
1176
- for (const auto &Entry : CSI) {
1177
- Register Reg = Entry.getReg ();
1178
- int FI = Entry.getFrameIdx ();
1179
- switch (Reg) {
1180
- case ARM::R8:
1181
- case ARM::R9:
1182
- case ARM::R10:
1183
- case ARM::R11:
1184
- case ARM::R12:
1185
- if (STI.getPushPopSplitVariation (MF) ==
1186
- ARMSubtarget::PushPopSplitVariation::R7Split)
1187
- break ;
1188
- [[fallthrough]];
1189
- case ARM::R0:
1190
- case ARM::R1:
1191
- case ARM::R2:
1192
- case ARM::R3:
1193
- case ARM::R4:
1194
- case ARM::R5:
1195
- case ARM::R6:
1196
- case ARM::R7:
1197
- case ARM::LR:
1198
- CFIIndex = MF.addFrameInst (MCCFIInstruction::createOffset (
1199
- nullptr , MRI->getDwarfRegNum (Reg, true ),
1200
- MFI.getObjectOffset (FI)));
1201
- BuildMI (MBB, Pos, dl, TII.get (TargetOpcode::CFI_INSTRUCTION))
1202
- .addCFIIndex (CFIIndex)
1203
- .setMIFlags (MachineInstr::FrameSetup);
1121
+ MachineBasicBlock::iterator Pos = std::next (GPRCS1Push);
1122
+ int CFIIndex;
1123
+ for (const auto &Entry : CSI) {
1124
+ Register Reg = Entry.getReg ();
1125
+ int FI = Entry.getFrameIdx ();
1126
+ switch (Reg) {
1127
+ case ARM::R8:
1128
+ case ARM::R9:
1129
+ case ARM::R10:
1130
+ case ARM::R11:
1131
+ case ARM::R12:
1132
+ if (STI.splitFramePushPop (MF))
1204
1133
break ;
1205
- }
1134
+ [[fallthrough]];
1135
+ case ARM::R0:
1136
+ case ARM::R1:
1137
+ case ARM::R2:
1138
+ case ARM::R3:
1139
+ case ARM::R4:
1140
+ case ARM::R5:
1141
+ case ARM::R6:
1142
+ case ARM::R7:
1143
+ case ARM::LR:
1144
+ CFIIndex = MF.addFrameInst (MCCFIInstruction::createOffset (
1145
+ nullptr , MRI->getDwarfRegNum (Reg, true ), MFI.getObjectOffset (FI)));
1146
+ BuildMI (MBB, Pos, dl, TII.get (TargetOpcode::CFI_INSTRUCTION))
1147
+ .addCFIIndex (CFIIndex)
1148
+ .setMIFlags (MachineInstr::FrameSetup);
1149
+ break ;
1206
1150
}
1207
1151
}
1208
1152
}
1209
1153
1210
1154
if (GPRCS2Size > 0 && !NeedsWinCFI) {
1211
1155
MachineBasicBlock::iterator Pos = std::next (GPRCS2Push);
1212
- if (STI.getPushPopSplitVariation (MF) ==
1213
- ARMSubtarget::PushPopSplitVariation::R11SplitAAPCSBranchSigning) {
1214
- for (const auto &Entry : CSI) {
1215
- Register Reg = Entry.getReg ();
1216
- int FI = Entry.getFrameIdx ();
1217
- switch (Reg) {
1218
- case ARM::R11:
1219
- case ARM::LR:
1220
- unsigned DwarfReg = MRI->getDwarfRegNum (Reg, true );
1221
- unsigned Offset = MFI.getObjectOffset (FI);
1222
- unsigned CFIIndex = MF.addFrameInst (
1223
- MCCFIInstruction::createOffset (nullptr , DwarfReg, Offset));
1224
- BuildMI (MBB, Pos, dl, TII.get (TargetOpcode::CFI_INSTRUCTION))
1225
- .addCFIIndex (CFIIndex)
1226
- .setMIFlags (MachineInstr::FrameSetup);
1227
- break ;
1228
- }
1229
- }
1230
- } else {
1231
- MachineBasicBlock::iterator Pos = std::next (GPRCS2Push);
1232
- for (const auto &Entry : CSI) {
1233
- Register Reg = Entry.getReg ();
1234
- int FI = Entry.getFrameIdx ();
1235
- switch (Reg) {
1236
- case ARM::R8:
1237
- case ARM::R9:
1238
- case ARM::R10:
1239
- case ARM::R11:
1240
- case ARM::R12:
1156
+ for (const auto &Entry : CSI) {
1157
+ Register Reg = Entry.getReg ();
1158
+ int FI = Entry.getFrameIdx ();
1159
+ switch (Reg) {
1160
+ case ARM::R8:
1161
+ case ARM::R9:
1162
+ case ARM::R10:
1163
+ case ARM::R11:
1164
+ case ARM::R12:
1165
+ if (STI.splitFramePushPop (MF)) {
1241
1166
unsigned DwarfReg = MRI->getDwarfRegNum (
1242
1167
Reg == ARM::R12 ? ARM::RA_AUTH_CODE : Reg, true );
1243
1168
unsigned Offset = MFI.getObjectOffset (FI);
@@ -1246,8 +1171,8 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
1246
1171
BuildMI (MBB, Pos, dl, TII.get (TargetOpcode::CFI_INSTRUCTION))
1247
1172
.addCFIIndex (CFIIndex)
1248
1173
.setMIFlags (MachineInstr::FrameSetup);
1249
- break ;
1250
1174
}
1175
+ break ;
1251
1176
}
1252
1177
}
1253
1178
}
@@ -1457,9 +1382,7 @@ void ARMFrameLowering::emitEpilogue(MachineFunction &MF,
1457
1382
MachineInstr::FrameDestroy);
1458
1383
1459
1384
// Increment past our save areas.
1460
- if (AFI->getGPRCalleeSavedArea2Size () &&
1461
- STI.getPushPopSplitVariation (MF) ==
1462
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind)
1385
+ if (AFI->getGPRCalleeSavedArea2Size () && STI.splitFramePointerPush (MF))
1463
1386
MBBI++;
1464
1387
1465
1388
if (MBBI != MBB.end () && AFI->getDPRCalleeSavedAreaSize ()) {
@@ -1476,9 +1399,7 @@ void ARMFrameLowering::emitEpilogue(MachineFunction &MF,
1476
1399
MachineInstr::FrameDestroy);
1477
1400
}
1478
1401
1479
- if (AFI->getGPRCalleeSavedArea2Size () &&
1480
- STI.getPushPopSplitVariation (MF) !=
1481
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind)
1402
+ if (AFI->getGPRCalleeSavedArea2Size () && !STI.splitFramePointerPush (MF))
1482
1403
MBBI++;
1483
1404
if (AFI->getGPRCalleeSavedArea1Size ()) MBBI++;
1484
1405
@@ -1618,9 +1539,7 @@ void ARMFrameLowering::emitPushInst(MachineBasicBlock &MBB,
1618
1539
unsigned LastReg = 0 ;
1619
1540
for (; i != 0 ; --i) {
1620
1541
Register Reg = CSI[i-1 ].getReg ();
1621
- if (!(Func)(Reg, STI.getPushPopSplitVariation (MF) ==
1622
- ARMSubtarget::PushPopSplitVariation::R7Split))
1623
- continue ;
1542
+ if (!(Func)(Reg, STI.splitFramePushPop (MF))) continue ;
1624
1543
1625
1544
// D-registers in the aligned area DPRCS2 are NOT spilled here.
1626
1545
if (Reg >= ARM::D8 && Reg < ARM::D8 + NumAlignedDPRCS2Regs)
@@ -1713,21 +1632,15 @@ void ARMFrameLowering::emitPopInst(MachineBasicBlock &MBB,
1713
1632
for (; i != 0 ; --i) {
1714
1633
CalleeSavedInfo &Info = CSI[i-1 ];
1715
1634
Register Reg = Info.getReg ();
1716
- if (!(Func)(Reg, STI.getPushPopSplitVariation (MF) ==
1717
- ARMSubtarget::PushPopSplitVariation::R7Split))
1718
- continue ;
1635
+ if (!(Func)(Reg, STI.splitFramePushPop (MF))) continue ;
1719
1636
1720
1637
// The aligned reloads from area DPRCS2 are not inserted here.
1721
1638
if (Reg >= ARM::D8 && Reg < ARM::D8 + NumAlignedDPRCS2Regs)
1722
1639
continue ;
1723
1640
if (Reg == ARM::LR && !isTailCall && !isVarArg && !isInterrupt &&
1724
1641
!isCmseEntry && !isTrap && AFI->getArgumentStackToRestore () == 0 &&
1725
1642
STI.hasV5TOps () && MBB.succ_empty () && !hasPAC &&
1726
- (STI.getPushPopSplitVariation (MF) !=
1727
- ARMSubtarget::PushPopSplitVariation::
1728
- R11SplitAAPCSBranchSigning &&
1729
- STI.getPushPopSplitVariation (MF) !=
1730
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind)) {
1643
+ !STI.splitFramePointerPush (MF)) {
1731
1644
Reg = ARM::PC;
1732
1645
// Fold the return instruction into the LDM.
1733
1646
DeleteRet = true ;
@@ -2088,10 +2001,7 @@ bool ARMFrameLowering::spillCalleeSavedRegisters(
2088
2001
.addImm (-4 )
2089
2002
.add (predOps (ARMCC::AL));
2090
2003
}
2091
- if (STI.getPushPopSplitVariation (MF) ==
2092
- ARMSubtarget::PushPopSplitVariation::R11SplitAAPCSBranchSigning ||
2093
- STI.getPushPopSplitVariation (MF) ==
2094
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind) {
2004
+ if (STI.splitFramePointerPush (MF)) {
2095
2005
emitPushInst (MBB, MI, CSI, PushOpc, PushOneOpc, false ,
2096
2006
&isSplitFPArea1Register, 0 , MachineInstr::FrameSetup);
2097
2007
emitPushInst (MBB, MI, CSI, FltOpc, 0 , true , &isARMArea3Register,
@@ -2136,10 +2046,7 @@ bool ARMFrameLowering::restoreCalleeSavedRegisters(
2136
2046
unsigned LdrOpc =
2137
2047
AFI->isThumbFunction () ? ARM::t2LDR_POST : ARM::LDR_POST_IMM;
2138
2048
unsigned FltOpc = ARM::VLDMDIA_UPD;
2139
- if (STI.getPushPopSplitVariation (MF) ==
2140
- ARMSubtarget::PushPopSplitVariation::R11SplitAAPCSBranchSigning ||
2141
- STI.getPushPopSplitVariation (MF) ==
2142
- ARMSubtarget::PushPopSplitVariation::R11SplitWindowsSEHUnwind) {
2049
+ if (STI.splitFramePointerPush (MF)) {
2143
2050
emitPopInst (MBB, MI, CSI, PopOpc, LdrOpc, isVarArg, false ,
2144
2051
&isSplitFPArea2Register, 0 );
2145
2052
emitPopInst (MBB, MI, CSI, FltOpc, 0 , isVarArg, true , &isARMArea3Register,
@@ -2455,8 +2362,7 @@ void ARMFrameLowering::determineCalleeSaves(MachineFunction &MF,
2455
2362
if (Spilled) {
2456
2363
NumGPRSpills++;
2457
2364
2458
- if (STI.getPushPopSplitVariation (MF) !=
2459
- ARMSubtarget::PushPopSplitVariation::R7Split) {
2365
+ if (!STI.splitFramePushPop (MF)) {
2460
2366
if (Reg == ARM::LR)
2461
2367
LRSpilled = true ;
2462
2368
CS1Spilled = true ;
@@ -2478,8 +2384,7 @@ void ARMFrameLowering::determineCalleeSaves(MachineFunction &MF,
2478
2384
break ;
2479
2385
}
2480
2386
} else {
2481
- if (STI.getPushPopSplitVariation (MF) !=
2482
- ARMSubtarget::PushPopSplitVariation::R7Split) {
2387
+ if (!STI.splitFramePushPop (MF)) {
2483
2388
UnspilledCS1GPRs.push_back (Reg);
2484
2389
continue ;
2485
2390
}
0 commit comments