@@ -102,12 +102,13 @@ class StackColoring : public MachineFunctionPass {
102
102
};
103
103
104
104
// / Maps active slots (per bit) for each basic block.
105
- DenseMap<MachineBasicBlock*, BlockLifetimeInfo> BlockLiveness;
105
+ typedef DenseMap<const MachineBasicBlock*, BlockLifetimeInfo> LivenessMap;
106
+ LivenessMap BlockLiveness;
106
107
107
108
// / Maps serial numbers to basic blocks.
108
- DenseMap<MachineBasicBlock*, int > BasicBlocks;
109
+ DenseMap<const MachineBasicBlock*, int > BasicBlocks;
109
110
// / Maps basic blocks to a serial number.
110
- SmallVector<MachineBasicBlock*, 8 > BasicBlockNumbering;
111
+ SmallVector<const MachineBasicBlock*, 8 > BasicBlockNumbering;
111
112
112
113
// / Maps liveness intervals for each slot.
113
114
SmallVector<LiveInterval*, 16 > Intervals;
@@ -205,8 +206,7 @@ void StackColoring::dump() const {
205
206
DEBUG (dbgs ()<<" Inspecting block #" <<BasicBlocks.lookup (*FI)<<
206
207
" [" <<FI->getName ()<<" ]\n " );
207
208
208
- DenseMap<MachineBasicBlock*, BlockLifetimeInfo>::const_iterator BI =
209
- BlockLiveness.find (*FI);
209
+ LivenessMap::const_iterator BI = BlockLiveness.find (*FI);
210
210
assert (BI != BlockLiveness.end () && " Block not found" );
211
211
const BlockLifetimeInfo &BlockInfo = BI->second ;
212
212
@@ -299,26 +299,25 @@ void StackColoring::calculateLocalLiveness() {
299
299
// formulation, and END is equivalent to GEN. The result of this computation
300
300
// is a map from blocks to bitvectors where the bitvectors represent which
301
301
// allocas are live in/out of that block.
302
- SmallPtrSet<MachineBasicBlock*, 8 > BBSet (BasicBlockNumbering.begin (),
303
- BasicBlockNumbering.end ());
302
+ SmallPtrSet<const MachineBasicBlock*, 8 > BBSet (BasicBlockNumbering.begin (),
303
+ BasicBlockNumbering.end ());
304
304
unsigned NumSSMIters = 0 ;
305
305
bool changed = true ;
306
306
while (changed) {
307
307
changed = false ;
308
308
++NumSSMIters;
309
309
310
- SmallPtrSet<MachineBasicBlock*, 8 > NextBBSet;
310
+ SmallPtrSet<const MachineBasicBlock*, 8 > NextBBSet;
311
311
312
- for (SmallVector<MachineBasicBlock*, 8 >::iterator
312
+ for (SmallVector<const MachineBasicBlock*, 8 >::iterator
313
313
PI = BasicBlockNumbering.begin (), PE = BasicBlockNumbering.end ();
314
314
PI != PE; ++PI) {
315
315
316
- MachineBasicBlock *BB = *PI;
316
+ const MachineBasicBlock *BB = *PI;
317
317
if (!BBSet.count (BB)) continue ;
318
318
319
319
// Use an iterator to avoid repeated lookups.
320
- DenseMap<MachineBasicBlock*, BlockLifetimeInfo>::iterator BI =
321
- BlockLiveness.find (BB);
320
+ LivenessMap::iterator BI = BlockLiveness.find (BB);
322
321
assert (BI != BlockLiveness.end () && " Block not found" );
323
322
BlockLifetimeInfo &BlockInfo = BI->second ;
324
323
@@ -328,8 +327,7 @@ void StackColoring::calculateLocalLiveness() {
328
327
// Forward propagation from begins to ends.
329
328
for (MachineBasicBlock::const_pred_iterator PI = BB->pred_begin (),
330
329
PE = BB->pred_end (); PI != PE; ++PI) {
331
- DenseMap<MachineBasicBlock*, BlockLifetimeInfo>::const_iterator I =
332
- BlockLiveness.find (*PI);
330
+ LivenessMap::const_iterator I = BlockLiveness.find (*PI);
333
331
assert (I != BlockLiveness.end () && " Predecessor not found" );
334
332
LocalLiveIn |= I->second .LiveOut ;
335
333
}
@@ -339,8 +337,7 @@ void StackColoring::calculateLocalLiveness() {
339
337
// Reverse propagation from ends to begins.
340
338
for (MachineBasicBlock::const_succ_iterator SI = BB->succ_begin (),
341
339
SE = BB->succ_end (); SI != SE; ++SI) {
342
- DenseMap<MachineBasicBlock*, BlockLifetimeInfo>::const_iterator I =
343
- BlockLiveness.find (*SI);
340
+ LivenessMap::const_iterator I = BlockLiveness.find (*SI);
344
341
assert (I != BlockLiveness.end () && " Successor not found" );
345
342
LocalLiveOut |= I->second .LiveIn ;
346
343
}
@@ -371,7 +368,7 @@ void StackColoring::calculateLocalLiveness() {
371
368
changed = true ;
372
369
BlockInfo.LiveIn |= LocalLiveIn;
373
370
374
- for (MachineBasicBlock::pred_iterator PI = BB->pred_begin (),
371
+ for (MachineBasicBlock::const_pred_iterator PI = BB->pred_begin (),
375
372
PE = BB->pred_end (); PI != PE; ++PI)
376
373
NextBBSet.insert (*PI);
377
374
}
@@ -380,7 +377,7 @@ void StackColoring::calculateLocalLiveness() {
380
377
changed = true ;
381
378
BlockInfo.LiveOut |= LocalLiveOut;
382
379
383
- for (MachineBasicBlock::succ_iterator SI = BB->succ_begin (),
380
+ for (MachineBasicBlock::const_succ_iterator SI = BB->succ_begin (),
384
381
SE = BB->succ_end (); SI != SE; ++SI)
385
382
NextBBSet.insert (*SI);
386
383
}
0 commit comments