summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/MipsDelaySlotFiller.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2011-10-05 01:30:09 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2011-10-05 01:30:09 +0000
commit53120e0a9fde4b3e8057b9d5b9ad8ec50fbaa31d (patch)
treeafc6899ba526efe9f527a85a7bd5ab4b91f460d1 /lib/Target/Mips/MipsDelaySlotFiller.cpp
parent6f818abbe3dce0bee8257ea7d7dd4cb951f4dc7c (diff)
downloadllvm-53120e0a9fde4b3e8057b9d5b9ad8ec50fbaa31d.tar.gz
llvm-53120e0a9fde4b3e8057b9d5b9ad8ec50fbaa31d.tar.bz2
llvm-53120e0a9fde4b3e8057b9d5b9ad8ec50fbaa31d.tar.xz
Remove function Filler::isDelayFiller. Check if I is the same instruction that
filled the last delay slot visited. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141151 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsDelaySlotFiller.cpp')
-rw-r--r--lib/Target/Mips/MipsDelaySlotFiller.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/Target/Mips/MipsDelaySlotFiller.cpp b/lib/Target/Mips/MipsDelaySlotFiller.cpp
index 3c5f4314e5..690f4ffb38 100644
--- a/lib/Target/Mips/MipsDelaySlotFiller.cpp
+++ b/lib/Target/Mips/MipsDelaySlotFiller.cpp
@@ -41,6 +41,7 @@ namespace {
TargetMachine &TM;
const TargetInstrInfo *TII;
+ MachineBasicBlock::iterator LastFiller;
static char ID;
Filler(TargetMachine &tm)
@@ -92,6 +93,8 @@ namespace {
bool Filler::
runOnMachineBasicBlock(MachineBasicBlock &MBB) {
bool Changed = false;
+ LastFiller = MBB.end();
+
for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); ++I)
if (I->getDesc().hasDelaySlot()) {
++FilledSlots;
@@ -106,7 +109,9 @@ runOnMachineBasicBlock(MachineBasicBlock &MBB) {
else
BuildMI(MBB, llvm::next(I), I->getDebugLoc(), TII->get(Mips::NOP));
- ++I; // Skip instruction that has just been moved to delay slot.
+ // Record the filler instruction that filled the delay slot.
+ // The instruction after it will be visited in the next iteration.
+ LastFiller = ++I;
}
return Changed;
@@ -149,7 +154,7 @@ bool Filler::findDelayInstr(MachineBasicBlock &MBB,
if (I->hasUnmodeledSideEffects()
|| I->isInlineAsm()
|| I->isLabel()
- || isDelayFiller(MBB, I)
+ || I == LastFiller
|| I->getDesc().isPseudo()
//
// Should not allow:
@@ -264,12 +269,3 @@ bool Filler::IsRegInSet(SmallSet<unsigned, 32>& RegSet, unsigned Reg) {
return false;
}
-
-// return true if the candidate is a delay filler.
-bool Filler::isDelayFiller(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator candidate) {
- if (candidate == MBB.begin())
- return false;
- const MCInstrDesc &prevdesc = (--candidate)->getDesc();
- return prevdesc.hasDelaySlot();
-}