[mips] [IAS] Move NOP emission after pseudo-instruction expansion. NFC.
authorToma Tabacu <toma.tabacu@imgtec.com>
Thu, 23 Apr 2015 14:48:38 +0000 (14:48 +0000)
committerToma Tabacu <toma.tabacu@imgtec.com>
Thu, 23 Apr 2015 14:48:38 +0000 (14:48 +0000)
As suggested in the review for http://reviews.llvm.org/D8537.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235601 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/AsmParser/MipsAsmParser.cpp

index 7615f87f7211eda293e97e7807df4fe9358e8095..88b131104baa44a33d07cea603871a15592cbdcf 100644 (file)
@@ -1383,14 +1383,6 @@ bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
     }
   }
 
-  // If this instruction has a delay slot and .set reorder is active,
-  // emit a NOP after it.
-  if (MCID.hasDelaySlot() && AssemblerOptions.back()->isReorder()) {
-    Instructions.push_back(Inst);
-    createNop(hasShortDelaySlot(Inst.getOpcode()), IDLoc, Instructions);
-    return false;
-  }
-
   if (MCID.mayLoad() || MCID.mayStore()) {
     // Check the offset of memory operand, if it is a symbol
     // reference or immediate we may have to expand instructions.
@@ -1580,11 +1572,17 @@ bool MipsAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
     }
   }
 
-  if (needsExpansion(Inst))
-    return expandInstruction(Inst, IDLoc, Instructions);
-  else
+  if (needsExpansion(Inst)) {
+    if (expandInstruction(Inst, IDLoc, Instructions))
+      return true;
+  } else
     Instructions.push_back(Inst);
 
+  // If this instruction has a delay slot and .set reorder is active,
+  // emit a NOP after it.
+  if (MCID.hasDelaySlot() && AssemblerOptions.back()->isReorder())
+    createNop(hasShortDelaySlot(Inst.getOpcode()), IDLoc, Instructions);
+
   return false;
 }