@@ -1137,6 +1137,9 @@ class SlotIndexUpdateDelegate : public MachineFunction::Delegate {
1137
1137
}
1138
1138
};
1139
1139
1140
+ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge (
1141
+ MachineBasicBlock *Succ, Pass *P, MachineFunctionAnalysisManager *MFAM,
1142
+ std::vector<SparseBitVector<>> *LiveInSets, MachineDomTreeUpdater *MDTU) {
1140
1143
#define GET_RESULT (RESULT, GETTER, INFIX ) \
1141
1144
[MF, P, MFAM]() { \
1142
1145
if (P) { \
@@ -1146,10 +1149,19 @@ class SlotIndexUpdateDelegate : public MachineFunction::Delegate {
1146
1149
return MFAM->getCachedResult <RESULT##Analysis>(*MF); \
1147
1150
}()
1148
1151
1152
+ assert ((P || MFAM) && " Need a way to get analysis results!" );
1153
+ MachineFunction *MF = getParent ();
1154
+ LiveIntervals *LIS = GET_RESULT (LiveIntervals, getLIS, );
1155
+ SlotIndexes *Indexes = GET_RESULT (SlotIndexes, getSI, );
1156
+ LiveVariables *LV = GET_RESULT (LiveVariables, getLV, );
1157
+ MachineLoopInfo *MLI = GET_RESULT (MachineLoop, getLI, Info);
1158
+ return SplitCriticalEdge (Succ, {LIS, Indexes, LV, MLI}, LiveInSets, MDTU);
1159
+ #undef GET_RESULT
1160
+ }
1161
+
1149
1162
MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge (
1150
- MachineBasicBlock *Succ, Pass *P, MachineFunctionAnalysisManager *MFAM ,
1163
+ MachineBasicBlock *Succ, const SplitCriticalEdgeAnalyses &Analyses ,
1151
1164
std::vector<SparseBitVector<>> *LiveInSets, MachineDomTreeUpdater *MDTU) {
1152
- assert ((P || MFAM) && " Need a way to get analysis results!" );
1153
1165
if (!canSplitCriticalEdge (Succ))
1154
1166
return nullptr ;
1155
1167
@@ -1172,19 +1184,16 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
1172
1184
LLVM_DEBUG (dbgs () << " Splitting critical edge: " << printMBBReference (*this )
1173
1185
<< " -- " << printMBBReference (*NMBB) << " -- "
1174
1186
<< printMBBReference (*Succ) << ' \n ' );
1175
-
1176
- LiveIntervals *LIS = GET_RESULT (LiveIntervals, getLIS, );
1177
- SlotIndexes *Indexes = GET_RESULT (SlotIndexes, getSI, );
1187
+ auto *LIS = Analyses.LIS ;
1178
1188
if (LIS)
1179
1189
LIS->insertMBBInMaps (NMBB);
1180
- else if (Indexes )
1181
- Indexes ->insertMBBInMaps (NMBB);
1190
+ else if (Analyses. SI )
1191
+ Analyses. SI ->insertMBBInMaps (NMBB);
1182
1192
1183
1193
// On some targets like Mips, branches may kill virtual registers. Make sure
1184
1194
// that LiveVariables is properly updated after updateTerminator replaces the
1185
1195
// terminators.
1186
- LiveVariables *LV = GET_RESULT (LiveVariables, getLV, );
1187
-
1196
+ auto *LV = Analyses.LV ;
1188
1197
// Collect a list of virtual registers killed by the terminators.
1189
1198
SmallVector<Register, 4 > KilledRegs;
1190
1199
if (LV)
@@ -1223,7 +1232,7 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
1223
1232
// as the fallthrough successor
1224
1233
if (Succ == PrevFallthrough)
1225
1234
PrevFallthrough = NMBB;
1226
-
1235
+ auto *Indexes = Analyses. SI ;
1227
1236
if (!ChangedIndirectJump) {
1228
1237
SlotIndexUpdateDelegate SlotUpdater (*MF, Indexes);
1229
1238
updateTerminator (PrevFallthrough);
@@ -1351,7 +1360,7 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
1351
1360
if (MDTU)
1352
1361
MDTU->splitCriticalEdge (this , Succ, NMBB);
1353
1362
1354
- if (MachineLoopInfo *MLI = GET_RESULT (MachineLoop, getLI, Info) )
1363
+ if (MachineLoopInfo *MLI = Analyses. MLI )
1355
1364
if (MachineLoop *TIL = MLI->getLoopFor (this )) {
1356
1365
// If one or the other blocks were not in a loop, the new block is not
1357
1366
// either, and thus LI doesn't need to be updated.
0 commit comments