[llvm-commits] [llvm] r141156 - /llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp

Akira Hatanaka ahatanaka at mips.com
Tue Oct 4 19:19:01 PDT 2011


Author: ahatanak
Date: Tue Oct  4 21:18:58 2011
New Revision: 141156

URL: http://llvm.org/viewvc/llvm-project?rev=141156&view=rev
Log:
Clean up function Filler::delayHasHazard. 


Modified:
    llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp

Modified: llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp?rev=141156&r1=141155&r2=141156&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp Tue Oct  4 21:18:58 2011
@@ -190,12 +190,14 @@
       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 @@
 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.





More information about the llvm-commits mailing list