summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/MipsDelaySlotFiller.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2011-10-05 02:18:58 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2011-10-05 02:18:58 +0000
commit0c419a7c4bec0a4931dd1dbd9f1adb43ec9b15c2 (patch)
tree3fe2cf19c3cb72ec57a33c641a370015bf8046ac /lib/Target/Mips/MipsDelaySlotFiller.cpp
parent0f0c59a0f881d7743bc518ed16022109447e5a4b (diff)
downloadllvm-0c419a7c4bec0a4931dd1dbd9f1adb43ec9b15c2.tar.gz
llvm-0c419a7c4bec0a4931dd1dbd9f1adb43ec9b15c2.tar.bz2
llvm-0c419a7c4bec0a4931dd1dbd9f1adb43ec9b15c2.tar.xz
Clean up function Filler::delayHasHazard.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141156 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsDelaySlotFiller.cpp')
-rw-r--r--lib/Target/Mips/MipsDelaySlotFiller.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Target/Mips/MipsDelaySlotFiller.cpp b/lib/Target/Mips/MipsDelaySlotFiller.cpp
index e848a7b025..91a80a71aa 100644
--- a/lib/Target/Mips/MipsDelaySlotFiller.cpp
+++ b/lib/Target/Mips/MipsDelaySlotFiller.cpp
@@ -190,12 +190,14 @@ bool Filler::delayHasHazard(MachineBasicBlock::iterator candidate,
return true;
}
+ assert(!candidate->getDesc().isCall() && "Cannot put calls in delay slot.");
+
for (unsigned i = 0, e = candidate->getNumOperands(); i!= e; ++i) {
const MachineOperand &MO = candidate->getOperand(i);
- if (!MO.isReg())
- continue; // skip
+ unsigned Reg;
- unsigned Reg = MO.getReg();
+ if (!MO.isReg() || !(Reg = MO.getReg()))
+ continue; // skip
if (MO.isDef()) {
// check whether Reg is defined or used before delay slot.
@@ -215,7 +217,7 @@ bool Filler::delayHasHazard(MachineBasicBlock::iterator candidate,
void Filler::insertDefsUses(MachineBasicBlock::iterator MI,
SmallSet<unsigned, 32>& RegDefs,
SmallSet<unsigned, 32>& RegUses) {
- // If MI is a call, just examine the explicit non-variadic operands.
+ // If MI is a call or return, just examine the explicit non-variadic operands.
// NOTE: $ra is not added to RegDefs, since currently $ra is reserved and
// no instruction that can possibly be put in a delay slot can read or
// write it.