[llvm-commits] CVS: llvm/lib/CodeGen/RegAllocSimple.cpp
Alkis Evlogimenos
alkis at cs.uiuc.edu
Sun Feb 22 22:13:01 PST 2004
Changes in directory llvm/lib/CodeGen:
RegAllocSimple.cpp updated: 1.53 -> 1.54
---
Log message:
Simplify iterator usage now that we have next(). Also don't pass iterators by reference now that MachineInstr* are in an ilist
---
Diffs of the changes: (+7 -11)
Index: llvm/lib/CodeGen/RegAllocSimple.cpp
diff -u llvm/lib/CodeGen/RegAllocSimple.cpp:1.53 llvm/lib/CodeGen/RegAllocSimple.cpp:1.54
--- llvm/lib/CodeGen/RegAllocSimple.cpp:1.53 Thu Feb 19 00:19:09 2004
+++ llvm/lib/CodeGen/RegAllocSimple.cpp Sun Feb 22 22:12:30 2004
@@ -24,6 +24,7 @@
#include "llvm/Target/TargetMachine.h"
#include "Support/Debug.h"
#include "Support/Statistic.h"
+#include "Support/STLExtras.h"
#include <iostream>
using namespace llvm;
@@ -78,10 +79,10 @@
/// Moves value from memory into that register
unsigned reloadVirtReg(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator &I, unsigned VirtReg);
+ MachineBasicBlock::iterator I, unsigned VirtReg);
/// Saves reg value on the stack (maps virtual register to stack value)
- void spillVirtReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &I,
+ void spillVirtReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
unsigned VirtReg, unsigned PhysReg);
};
@@ -123,7 +124,7 @@
}
unsigned RegAllocSimple::reloadVirtReg(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator &I,
+ MachineBasicBlock::iterator I,
unsigned VirtReg) {
const TargetRegisterClass* RC = MF->getSSARegMap()->getRegClass(VirtReg);
int FrameIdx = getStackSpaceFor(VirtReg, RC);
@@ -136,7 +137,7 @@
}
void RegAllocSimple::spillVirtReg(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator &I,
+ MachineBasicBlock::iterator I,
unsigned VirtReg, unsigned PhysReg) {
const TargetRegisterClass* RC = MF->getSSARegMap()->getRegClass(VirtReg);
int FrameIdx = getStackSpaceFor(VirtReg, RC);
@@ -193,17 +194,12 @@
"Two address instruction invalid!");
physReg = MI->getOperand(1).getReg();
-
- ++MI;
- spillVirtReg(MBB, MI, virtualReg, physReg);
- --MI;
+ spillVirtReg(MBB, next(MI), virtualReg, physReg);
MI->getOperand(1).setDef();
MI->RemoveOperand(0);
break; // This is the last operand to process
}
- ++MI;
- spillVirtReg(MBB, MI, virtualReg, physReg);
- --MI;
+ spillVirtReg(MBB, next(MI), virtualReg, physReg);
} else {
physReg = reloadVirtReg(MBB, MI, virtualReg);
Virt2PhysRegMap[virtualReg] = physReg;
More information about the llvm-commits
mailing list