[PATCH] D19166: [mips][ias] Prevent double-filling of delay slots by generating '.set noreorder' regions.

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 18 05:41:17 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL266608: [mips][ias] Prevent double-filling of delay slots by generating '.set… (authored by dsanders).

Changed prior to commit:
  http://reviews.llvm.org/D19166?vs=53908&id=54049#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D19166

Files:
  llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
  llvm/trunk/test/MC/Mips/double-expand.s

Index: llvm/trunk/test/MC/Mips/double-expand.s
===================================================================
--- llvm/trunk/test/MC/Mips/double-expand.s
+++ llvm/trunk/test/MC/Mips/double-expand.s
@@ -0,0 +1,10 @@
+# RUN: llvm-mc -triple=mipsel-unknown-linux < %s | FileCheck %s
+# RUN: llvm-mc -triple=mipsel-unknown-linux < %s | \
+# RUN:     llvm-mc -triple=mipsel-unknown-linux | FileCheck %s
+
+# CHECK: bnez $2, foo
+# CHECK: nop
+# CHECK-NOT: nop
+
+        .text
+	bnez $2, foo
Index: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -1930,6 +1930,11 @@
     }
   }
 
+  bool FillDelaySlot =
+      MCID.hasDelaySlot() && AssemblerOptions.back()->isReorder();
+  if (FillDelaySlot)
+    getTargetStreamer().emitDirectiveSetNoReorder();
+
   MacroExpanderResultTy ExpandResult =
       tryExpandInstruction(Inst, IDLoc, Out, STI);
   switch (ExpandResult) {
@@ -1944,8 +1949,10 @@
 
   // If this instruction has a delay slot and .set reorder is active,
   // emit a NOP after it.
-  if (MCID.hasDelaySlot() && AssemblerOptions.back()->isReorder())
+  if (FillDelaySlot) {
     createNop(hasShortDelaySlot(Inst.getOpcode()), IDLoc, Out, STI);
+    getTargetStreamer().emitDirectiveSetReorder();
+  }
 
   if ((Inst.getOpcode() == Mips::JalOneReg ||
        Inst.getOpcode() == Mips::JalTwoReg || ExpandedJalSym) &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19166.54049.patch
Type: text/x-patch
Size: 1523 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160418/1c4ddd40/attachment.bin>


More information about the llvm-commits mailing list