[PATCH] [mips] Expand on r206218 to put the prologue_end marker in the correct place.

Daniel Sanders daniel.sanders at imgtec.com
Tue Apr 29 03:52:08 PDT 2014


I started off adding it to the construction of each instruction but I switched to the post-processing method after noticing the loadImmediate() call in adjustStackPtr(). I was a bit reluctant to add an argument to a general function to deal with a special case needed by one caller. The same applies to storeRegToStackSlot().

It's also slightly more convenient to implement as a post-process step but that's not a very good reason to do it that way since emitPrologue() is rarely changed once it's implemented.

================
Comment at: lib/Target/Mips/MipsSEFrameLowering.cpp:360-361
@@ -359,4 +359,4 @@
         MBB.addLiveIn(ehDataReg(I));
       TII.storeRegToStackSlot(MBB, MBBI, ehDataReg(I), false,
                               MipsFI->getEhDataRegFI(I), RC, &RegInfo);
     }
----------------
The storeRegToStackSlot() call

================
Comment at: lib/Target/Mips/MipsSEInstrInfo.cpp:372
@@ -370,3 +371,3 @@
   else { // Expand immediate that doesn't fit in 16-bit.
     unsigned Reg = loadImmediate(Amount, MBB, I, DL, nullptr);
     BuildMI(MBB, I, DL, get(ADDu), SP).addReg(SP).addReg(Reg, RegState::Kill);
----------------
This is the loadImmediate() call

================
Comment at: lib/Target/Mips/MipsSEInstrInfo.cpp:376-382
@@ -374,1 +375,9 @@
+
+  // Mark stack decrements as being part of a frame setup.
+  if (Amount < 0) {
+    for (MachineBasicBlock::iterator MI = MBB.begin(); MI != I; ++MI) {
+      errs() << "Flagging "; MI->print(errs()); errs() << "\n";
+      MI->setFlag(MachineInstr::FrameSetup);
+    }
+  }
 }
----------------
I just noticed that the loop in emitPrologue() should cover a superset of the instructions that this loop covers. I'll have to try removing this loop to see if it makes a difference. Also, I've left some debugging output here which I'll remove.

http://reviews.llvm.org/D3511






More information about the llvm-commits mailing list