[mips] Make NOP a pseudo instruction and expand it to "sll $zero, $zero, 0".
authorAkira Hatanaka <ahatanaka@mips.com>
Wed, 6 Feb 2013 21:50:15 +0000 (21:50 +0000)
committerAkira Hatanaka <ahatanaka@mips.com>
Wed, 6 Feb 2013 21:50:15 +0000 (21:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174546 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Mips/MipsAsmPrinter.cpp
lib/Target/Mips/MipsInstrFormats.td
lib/Target/Mips/MipsInstrInfo.td

index 07a4faa144c1a87b1074936aceaa8f6efdc109ce..e573e891cb6e415d7bc27c697f5c8b16c91dd038 100644 (file)
@@ -66,19 +66,18 @@ void MipsAsmPrinter::EmitInstruction(const MachineInstr *MI) {
     return;
   }
 
-  // Do any auto-generated pseudo lowerings.
-  if (emitPseudoExpansionLowering(OutStreamer, MI))
-    return;
-
   MachineBasicBlock::const_instr_iterator I = MI;
   MachineBasicBlock::const_instr_iterator E = MI->getParent()->instr_end();
 
   do {
-    MCInst TmpInst0;
-    MCInstLowering.Lower(I++, TmpInst0);
+    // Do any auto-generated pseudo lowerings.
+    if (emitPseudoExpansionLowering(OutStreamer, &*I))
+      continue;
 
+    MCInst TmpInst0;
+    MCInstLowering.Lower(I, TmpInst0);
     OutStreamer.EmitInstruction(TmpInst0);
-  } while ((I != E) && I->isInsideBundle()); // Delay slot check
+  } while ((++I != E) && I->isInsideBundle()); // Delay slot check
 }
 
 //===----------------------------------------------------------------------===//
index c026b5dae035c8e818c7cd564e49b6d8636a9e2f..6977e45264691758e4bf2475ab64a4b894c2fb23 100644 (file)
@@ -366,12 +366,6 @@ class LUI_FM {
   let Inst{15-0}  = imm16;
 }
 
-class NOP_FM {
-  bits<32> Inst;
-
-  let Inst{31-0} = 0;
-}
-
 class JALR_FM {
   bits<5> rs;
 
index f9e3af517b7fb063b2d31f39e75cc20de9d0a99b..7e33cb184680409a520b38f1aa06a82caee60bb2 100644 (file)
@@ -918,8 +918,7 @@ def CLO : CountLeading1<"clo", CPURegsOpnd>, CLO_FM<0x21>;
 def WSBH : SubwordSwap<"wsbh", CPURegsOpnd>, SEB_FM<2, 0x20>;
 
 /// No operation.
-/// FIXME: NOP should be an alias of "sll $0, $0, 0".
-def NOP : InstSE<(outs), (ins), "nop", [], IIAlu, FrmJ>, NOP_FM;
+def NOP : PseudoSE<(outs), (ins), []>, PseudoInstExpansion<(SLL ZERO, ZERO, 0)>;
 
 // FrameIndexes are legalized when they are operands from load/store
 // instructions. The same not happens for stack address copies, so an