[llvm] r221612 - [mips][microMIPS] Fix issue with delay slot filler and microMIPS
Zoran Jovanovic
zoran.jovanovic at imgtec.com
Mon Nov 10 09:27:56 PST 2014
Author: zjovanovic
Date: Mon Nov 10 11:27:56 2014
New Revision: 221612
URL: http://llvm.org/viewvc/llvm-project?rev=221612&view=rev
Log:
[mips][microMIPS] Fix issue with delay slot filler and microMIPS
Differential Revision: http://reviews.llvm.org/D6193
Added:
llvm/trunk/test/CodeGen/Mips/micromips-delay-slot.ll
Modified:
llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp
Modified: llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp?rev=221612&r1=221611&r2=221612&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp Mon Nov 10 11:27:56 2014
@@ -497,24 +497,32 @@ getUnderlyingObjects(const MachineInstr
/// We assume there is only one delay slot per delayed instruction.
bool Filler::runOnMachineBasicBlock(MachineBasicBlock &MBB) {
bool Changed = false;
+ bool InMicroMipsMode = TM.getSubtarget<MipsSubtarget>().inMicroMipsMode();
for (Iter I = MBB.begin(); I != MBB.end(); ++I) {
if (!hasUnoccupiedSlot(&*I))
continue;
- ++FilledSlots;
- Changed = true;
+ // For microMIPS, at the moment, do not fill delay slots of call
+ // instructions.
+ //
+ // TODO: Support for replacing regular call instructions with corresponding
+ // short delay slot instructions should be implemented.
+ if (!InMicroMipsMode || !I->isCall()) {
+ ++FilledSlots;
+ Changed = true;
- // Delay slot filling is disabled at -O0.
- if (!DisableDelaySlotFiller && (TM.getOptLevel() != CodeGenOpt::None)) {
- if (searchBackward(MBB, I))
- continue;
+ // Delay slot filling is disabled at -O0.
+ if (!DisableDelaySlotFiller && (TM.getOptLevel() != CodeGenOpt::None)) {
+ if (searchBackward(MBB, I))
+ continue;
- if (I->isTerminator()) {
- if (searchSuccBBs(MBB, I))
+ if (I->isTerminator()) {
+ if (searchSuccBBs(MBB, I))
+ continue;
+ } else if (searchForward(MBB, I)) {
continue;
- } else if (searchForward(MBB, I)) {
- continue;
+ }
}
}
Added: llvm/trunk/test/CodeGen/Mips/micromips-delay-slot.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/micromips-delay-slot.ll?rev=221612&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/micromips-delay-slot.ll (added)
+++ llvm/trunk/test/CodeGen/Mips/micromips-delay-slot.ll Mon Nov 10 11:27:56 2014
@@ -0,0 +1,18 @@
+; RUN: llc -march=mipsel -mcpu=mips32r2 -mattr=+micromips \
+; RUN: -relocation-model=pic -O3 < %s | FileCheck %s
+
+; Function Attrs: nounwind uwtable
+define i32 @foo(i32 %a) #0 {
+entry:
+ %a.addr = alloca i32, align 4
+ store i32 %a, i32* %a.addr, align 4
+ %0 = load i32* %a.addr, align 4
+ %shl = shl i32 %0, 2
+ %call = call i32 @bar(i32 %shl)
+ ret i32 %call
+}
+
+declare i32 @bar(i32) #1
+
+; CHECK: nop
+
More information about the llvm-commits
mailing list