mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 02:52:53 +02:00
CodeGen: Use MachineInstr& in StackSlotColoring, NFC
Avoid implicit iterator to pointer conversions. llvm-svn: 274892
This commit is contained in:
parent
1660b62035
commit
654bb6a756
@ -107,7 +107,7 @@ namespace {
|
|||||||
bool OverlapWithAssignments(LiveInterval *li, int Color) const;
|
bool OverlapWithAssignments(LiveInterval *li, int Color) const;
|
||||||
int ColorSlot(LiveInterval *li);
|
int ColorSlot(LiveInterval *li);
|
||||||
bool ColorSlots(MachineFunction &MF);
|
bool ColorSlots(MachineFunction &MF);
|
||||||
void RewriteInstruction(MachineInstr *MI, SmallVectorImpl<int> &SlotMapping,
|
void RewriteInstruction(MachineInstr &MI, SmallVectorImpl<int> &SlotMapping,
|
||||||
MachineFunction &MF);
|
MachineFunction &MF);
|
||||||
bool RemoveDeadStores(MachineBasicBlock* MBB);
|
bool RemoveDeadStores(MachineBasicBlock* MBB);
|
||||||
};
|
};
|
||||||
@ -326,13 +326,10 @@ bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rewrite all MO_FrameIndex operands. Look for dead stores.
|
// Rewrite all MO_FrameIndex operands. Look for dead stores.
|
||||||
for (MachineFunction::iterator MBBI = MF.begin(), E = MF.end();
|
for (MachineBasicBlock &MBB : MF) {
|
||||||
MBBI != E; ++MBBI) {
|
for (MachineInstr &MI : MBB)
|
||||||
MachineBasicBlock *MBB = &*MBBI;
|
RewriteInstruction(MI, SlotMapping, MF);
|
||||||
for (MachineBasicBlock::iterator MII = MBB->begin(), EE = MBB->end();
|
RemoveDeadStores(&MBB);
|
||||||
MII != EE; ++MII)
|
|
||||||
RewriteInstruction(MII, SlotMapping, MF);
|
|
||||||
RemoveDeadStores(MBB);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete unused stack slots.
|
// Delete unused stack slots.
|
||||||
@ -347,12 +344,12 @@ bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
|
|||||||
|
|
||||||
/// RewriteInstruction - Rewrite specified instruction by replacing references
|
/// RewriteInstruction - Rewrite specified instruction by replacing references
|
||||||
/// to old frame index with new one.
|
/// to old frame index with new one.
|
||||||
void StackSlotColoring::RewriteInstruction(MachineInstr *MI,
|
void StackSlotColoring::RewriteInstruction(MachineInstr &MI,
|
||||||
SmallVectorImpl<int> &SlotMapping,
|
SmallVectorImpl<int> &SlotMapping,
|
||||||
MachineFunction &MF) {
|
MachineFunction &MF) {
|
||||||
// Update the operands.
|
// Update the operands.
|
||||||
for (unsigned i = 0, ee = MI->getNumOperands(); i != ee; ++i) {
|
for (unsigned i = 0, ee = MI.getNumOperands(); i != ee; ++i) {
|
||||||
MachineOperand &MO = MI->getOperand(i);
|
MachineOperand &MO = MI.getOperand(i);
|
||||||
if (!MO.isFI())
|
if (!MO.isFI())
|
||||||
continue;
|
continue;
|
||||||
int OldFI = MO.getIndex();
|
int OldFI = MO.getIndex();
|
||||||
@ -390,7 +387,7 @@ bool StackSlotColoring::RemoveDeadStores(MachineBasicBlock* MBB) {
|
|||||||
FirstSS != -1) {
|
FirstSS != -1) {
|
||||||
++NumDead;
|
++NumDead;
|
||||||
changed = true;
|
changed = true;
|
||||||
toErase.push_back(I);
|
toErase.push_back(&*I);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,10 +407,10 @@ bool StackSlotColoring::RemoveDeadStores(MachineBasicBlock* MBB) {
|
|||||||
|
|
||||||
if (NextMI->findRegisterUseOperandIdx(LoadReg, true, nullptr) != -1) {
|
if (NextMI->findRegisterUseOperandIdx(LoadReg, true, nullptr) != -1) {
|
||||||
++NumDead;
|
++NumDead;
|
||||||
toErase.push_back(I);
|
toErase.push_back(&*I);
|
||||||
}
|
}
|
||||||
|
|
||||||
toErase.push_back(NextMI);
|
toErase.push_back(&*NextMI);
|
||||||
++I;
|
++I;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user