summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocLocal.cpp
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-02-23 18:14:48 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-02-23 18:14:48 +0000
commit743d0a1f831f1d5a3141a6ca730558f40c35690a (patch)
treed2c1a5eefbfb5fc6922dab4d3dc29b3fb2f42242 /lib/CodeGen/RegAllocLocal.cpp
parentfbc39d50455f1895117fe9796294942759026540 (diff)
downloadllvm-743d0a1f831f1d5a3141a6ca730558f40c35690a.tar.gz
llvm-743d0a1f831f1d5a3141a6ca730558f40c35690a.tar.bz2
llvm-743d0a1f831f1d5a3141a6ca730558f40c35690a.tar.xz
Refactor rewinding code for finding the first terminator of a basic
block into MachineBasicBlock::getFirstTerminator(). This also fixes a bug in the implementation of the above in both RegAllocLocal and InstrSched, where instructions where added after the terminator if the basic block's only instruction was a terminator (it shouldn't matter for RegAllocLocal since this case never occurs in practice). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11748 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLocal.cpp')
-rw-r--r--lib/CodeGen/RegAllocLocal.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp
index 38e0073360..a3d66391cc 100644
--- a/lib/CodeGen/RegAllocLocal.cpp
+++ b/lib/CodeGen/RegAllocLocal.cpp
@@ -649,11 +649,7 @@ void RA::AllocateBasicBlock(MachineBasicBlock &MBB) {
}
}
- // Rewind the iterator to point to the first flow control instruction...
- const TargetInstrInfo &TII = TM->getInstrInfo();
- MI = MBB.end();
- while (MI != MBB.begin() && TII.isTerminatorInstr((--MI)->getOpcode()));
- if (MI != MBB.end()) ++MI;
+ MI = MBB.getFirstTerminator();
// Spill all physical registers holding virtual registers now.
for (unsigned i = 0, e = RegInfo->getNumRegs(); i != e; ++i)