mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 19:25:00 +00:00
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
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user