summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitaf2de4848ee302d18c3894fb12ebcde71752dbdd (patch)
tree43590363403eb45df671710b2bc40d05c0f6bd3e /llvm/lib/CodeGen/RegAllocLocal.cpp
parentcb185a34bbed7fbf1fb84c8b00d4a81011363b16 (diff)
downloadbcm5719-llvm-af2de4848ee302d18c3894fb12ebcde71752dbdd.tar.gz
bcm5719-llvm-af2de4848ee302d18c3894fb12ebcde71752dbdd.zip
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). llvm-svn: 11748
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocLocal.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocLocal.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/RegAllocLocal.cpp b/llvm/lib/CodeGen/RegAllocLocal.cpp
index 38e00733602..a3d66391cce 100644
--- a/llvm/lib/CodeGen/RegAllocLocal.cpp
+++ b/llvm/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)
OpenPOWER on IntegriCloud