From 556135d8139dfe8ea91927bcb82395301ffb1322 Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Wed, 6 Feb 2013 21:50:15 +0000 Subject: [PATCH] [mips] Make NOP a pseudo instruction and expand it to "sll $zero, $zero, 0". llvm-svn: 174546 --- llvm/lib/Target/Mips/MipsAsmPrinter.cpp | 13 ++++++------- llvm/lib/Target/Mips/MipsInstrFormats.td | 6 ------ llvm/lib/Target/Mips/MipsInstrInfo.td | 3 +-- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp index 07a4faa..e573e89 100644 --- a/llvm/lib/Target/Mips/MipsAsmPrinter.cpp +++ b/llvm/lib/Target/Mips/MipsAsmPrinter.cpp @@ -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 } //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/Mips/MipsInstrFormats.td b/llvm/lib/Target/Mips/MipsInstrFormats.td index c026b5d..6977e45 100644 --- a/llvm/lib/Target/Mips/MipsInstrFormats.td +++ b/llvm/lib/Target/Mips/MipsInstrFormats.td @@ -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; diff --git a/llvm/lib/Target/Mips/MipsInstrInfo.td b/llvm/lib/Target/Mips/MipsInstrInfo.td index f9e3af5..7e33cb1 100644 --- a/llvm/lib/Target/Mips/MipsInstrInfo.td +++ b/llvm/lib/Target/Mips/MipsInstrInfo.td @@ -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 -- 2.7.4