Added support for mcpu krait
[oota-llvm.git] / lib / Target / ARM / ARMFrameLowering.cpp
index 3e72d3690aa59f4d8ba9cfac17adbb80ee203ee5..79e5de14ddd837d28f0e3b043f1ffb7b70e7f3b8 100644 (file)
@@ -256,7 +256,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF) const {
 
   if (NumBytes) {
     // Adjust SP after all the callee-save spills.
-    if (tryFoldSPUpdateIntoPushPop(MF, LastPush, NumBytes))
+    if (tryFoldSPUpdateIntoPushPop(STI, MF, LastPush, NumBytes))
       FramePtrOffsetInPush += NumBytes;
     else
       emitSPUpdate(isARM, MBB, MBBI, dl, TII, -NumBytes,
@@ -380,15 +380,10 @@ void ARMFrameLowering::emitEpilogue(MachineFunction &MF,
     if (NumBytes != 0)
       emitSPUpdate(isARM, MBB, MBBI, dl, TII, NumBytes);
   } else {
-    MachineBasicBlock::iterator FirstPop = MBBI;
-
     // Unwind MBBI to point to first LDR / VLDRD.
     const uint16_t *CSRegs = RegInfo->getCalleeSavedRegs(&MF);
     if (MBBI != MBB.begin()) {
       do {
-        if (isPopOpcode(MBBI->getOpcode()))
-          FirstPop = MBBI;
-
         --MBBI;
       } while (MBBI != MBB.begin() && isCSRestore(MBBI, TII, CSRegs));
       if (!isCSRestore(MBBI, TII, CSRegs))
@@ -434,7 +429,8 @@ void ARMFrameLowering::emitEpilogue(MachineFunction &MF,
                                  ARM::SP)
             .addReg(FramePtr));
       }
-    } else if (NumBytes && !tryFoldSPUpdateIntoPushPop(MF, FirstPop, NumBytes))
+    } else if (NumBytes &&
+               !tryFoldSPUpdateIntoPushPop(STI, MF, MBBI, NumBytes))
         emitSPUpdate(isARM, MBB, MBBI, dl, TII, NumBytes);
 
     // Increment past our save areas.