diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-02-12 02:27:10 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2004-02-12 02:27:10 +0000 |
commit | c0b9dc5be79f009d260edb5cd5e1d8346587aaa2 (patch) | |
tree | f68d35cea961a4c0fdb0c5bd9f943e77c5f34161 /lib/CodeGen/RegAllocSimple.cpp | |
parent | 918cdd420b52a4745ce7d4495759c87fd1b32fd5 (diff) |
Change MachineBasicBlock's vector of MachineInstr pointers into an
ilist of MachineInstr objects. This allows constant time removal and
insertion of MachineInstr instances from anywhere in each
MachineBasicBlock. It also allows for constant time splicing of
MachineInstrs into or out of MachineBasicBlocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocSimple.cpp')
-rw-r--r-- | lib/CodeGen/RegAllocSimple.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/CodeGen/RegAllocSimple.cpp b/lib/CodeGen/RegAllocSimple.cpp index ac76220bc0..a40ec64077 100644 --- a/lib/CodeGen/RegAllocSimple.cpp +++ b/lib/CodeGen/RegAllocSimple.cpp @@ -150,12 +150,10 @@ void RegAllocSimple::spillVirtReg(MachineBasicBlock &MBB, void RegAllocSimple::AllocateBasicBlock(MachineBasicBlock &MBB) { // loop over each instruction - for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); ++I) { + for (MachineBasicBlock::iterator MI = MBB.begin(); MI != MBB.end(); ++MI) { // Made to combat the incorrect allocation of r2 = add r1, r1 std::map<unsigned, unsigned> Virt2PhysRegMap; - MachineInstr *MI = *I; - RegsUsed.resize(MRegisterInfo::FirstVirtualRegister); // a preliminary pass that will invalidate any registers that @@ -197,11 +195,11 @@ void RegAllocSimple::AllocateBasicBlock(MachineBasicBlock &MBB) { } else { physReg = getFreeReg(virtualReg); } - ++I; - spillVirtReg(MBB, I, virtualReg, physReg); - --I; + ++MI; + spillVirtReg(MBB, MI, virtualReg, physReg); + --MI; } else { - physReg = reloadVirtReg(MBB, I, virtualReg); + physReg = reloadVirtReg(MBB, MI, virtualReg); Virt2PhysRegMap[virtualReg] = physReg; } } |