Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 261abf5

Browse files
committed
More const correcting of stack coloring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175490 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 04fbcb5 commit 261abf5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/CodeGen/StackColoring.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ unsigned StackColoring::collectMarkers(unsigned NumSlot) {
262262
Markers.push_back(BI);
263263

264264
bool IsStart = BI->getOpcode() == TargetOpcode::LIFETIME_START;
265-
MachineOperand &MI = BI->getOperand(0);
265+
const MachineOperand &MI = BI->getOperand(0);
266266
unsigned Slot = MI.getIndex();
267267

268268
MarkersFound++;
@@ -401,9 +401,9 @@ void StackColoring::calculateLiveIntervals(unsigned NumSlots) {
401401
Finishes.resize(NumSlots);
402402

403403
// Create the interval for the basic blocks with lifetime markers in them.
404-
for (SmallVector<MachineInstr*, 8>::iterator it = Markers.begin(),
404+
for (SmallVectorImpl<MachineInstr*>::const_iterator it = Markers.begin(),
405405
e = Markers.end(); it != e; ++it) {
406-
MachineInstr *MI = *it;
406+
const MachineInstr *MI = *it;
407407
if (MI->getParent() != MBB)
408408
continue;
409409

@@ -412,7 +412,7 @@ void StackColoring::calculateLiveIntervals(unsigned NumSlots) {
412412
"Invalid Lifetime marker");
413413

414414
bool IsStart = MI->getOpcode() == TargetOpcode::LIFETIME_START;
415-
MachineOperand &Mo = MI->getOperand(0);
415+
const MachineOperand &Mo = MI->getOperand(0);
416416
int Slot = Mo.getIndex();
417417
assert(Slot >= 0 && "Invalid slot");
418418

@@ -499,7 +499,7 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
499499

500500
// Keep a list of *allocas* which need to be remapped.
501501
DenseMap<const AllocaInst*, const AllocaInst*> Allocas;
502-
for (DenseMap<int, int>::iterator it = SlotRemap.begin(),
502+
for (DenseMap<int, int>::const_iterator it = SlotRemap.begin(),
503503
e = SlotRemap.end(); it != e; ++it) {
504504
const AllocaInst *From = MFI->getObjectAllocation(it->first);
505505
const AllocaInst *To = MFI->getObjectAllocation(it->second);
@@ -594,8 +594,8 @@ void StackColoring::remapInstructions(DenseMap<int, int> &SlotRemap) {
594594
}
595595

596596
void StackColoring::removeInvalidSlotRanges() {
597-
MachineFunction::iterator BB, BBE;
598-
MachineBasicBlock::iterator I, IE;
597+
MachineFunction::const_iterator BB, BBE;
598+
MachineBasicBlock::const_iterator I, IE;
599599
for (BB = MF->begin(), BBE = MF->end(); BB != BBE; ++BB)
600600
for (I = BB->begin(), IE = BB->end(); I != IE; ++I) {
601601

@@ -614,7 +614,7 @@ void StackColoring::removeInvalidSlotRanges() {
614614

615615
// Check all of the machine operands.
616616
for (unsigned i = 0 ; i < I->getNumOperands(); ++i) {
617-
MachineOperand &MO = I->getOperand(i);
617+
const MachineOperand &MO = I->getOperand(i);
618618

619619
if (!MO.isFI())
620620
continue;

0 commit comments

Comments
 (0)