[PATCH] D18181: [mips][microMIPS] Delay slot filler modifications

Hrvoje Varga via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 15 06:00:04 PDT 2016


hvarga created this revision.
hvarga added reviewers: dsanders, zoran.jovanovic, zbuljan.
hvarga added subscribers: llvm-commits, petarj.
Herald added a reviewer: vkalintiris.
Herald added a subscriber: dsanders.

This patch implements the microMIPSr6 delay slot filler optimization.

microMIPS32r6 and microMIPS64r6 do not have any instructions for which the delay slot is needed. But the current delay slot filler implementation doesn't care about this fact. This patch optimizes this by breaking out from the MIPS delay slot filler functionality if the CPU is microMIPSr6.

http://reviews.llvm.org/D18181

Files:
  lib/Target/Mips/MipsDelaySlotFiller.cpp
  test/CodeGen/Mips/micromips-delay-slot.ll

Index: test/CodeGen/Mips/micromips-delay-slot.ll
===================================================================
--- test/CodeGen/Mips/micromips-delay-slot.ll
+++ test/CodeGen/Mips/micromips-delay-slot.ll
@@ -1,5 +1,7 @@
 ; RUN: llc -march=mipsel -mcpu=mips32r2 -mattr=+micromips \
 ; RUN:   -relocation-model=static -O2 < %s | FileCheck %s
+; RUN: llc -march=mipsel -mcpu=mips32r6 -mattr=+micromips \
+; RUN:   -relocation-model=static -O2 < %s | FileCheck %s -check-prefix=CHECK-MMR6
 
 ; Function Attrs: nounwind
 define i32 @foo(i32 signext %a) #0 {
@@ -16,3 +18,5 @@
 
 ; CHECK:      jals
 ; CHECK-NEXT: sll16
+; CHECK-MMR6: jal
+; CHECK-MMR6-NOT: sll16
Index: lib/Target/Mips/MipsDelaySlotFiller.cpp
===================================================================
--- lib/Target/Mips/MipsDelaySlotFiller.cpp
+++ lib/Target/Mips/MipsDelaySlotFiller.cpp
@@ -562,6 +562,12 @@
   bool InMicroMipsMode = STI.inMicroMipsMode();
   const MipsInstrInfo *TII = STI.getInstrInfo();
 
+  if (InMicroMipsMode && STI.hasMips32r6()) {
+    // This is microMIPS32r6 or microMIPS64r6 processor. Delay slot for
+    // branching instructions is not needed.
+    return Changed;
+  }
+
   for (Iter I = MBB.begin(); I != MBB.end(); ++I) {
     if (!hasUnoccupiedSlot(&*I))
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18181.50716.patch
Type: text/x-patch
Size: 1286 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160315/92cdb2a8/attachment.bin>


More information about the llvm-commits mailing list