diff options
author | Evan Cheng <evan.cheng@apple.com> | 2010-12-07 19:59:34 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2010-12-07 19:59:34 +0000 |
commit | 9801b5c822bf475e859e3fe18b87dbb308b0e22c (patch) | |
tree | 0c8f1e59199c488750fd5a749f8057401d801003 /lib/Target/ARM/ARMFrameInfo.cpp | |
parent | a6399ae08967109b1427b34b5bde775a38bb4d75 (diff) |
Code clean up; no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121172 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMFrameInfo.cpp')
-rw-r--r-- | lib/Target/ARM/ARMFrameInfo.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/Target/ARM/ARMFrameInfo.cpp b/lib/Target/ARM/ARMFrameInfo.cpp index 58a7c61d90..bcd776c466 100644 --- a/lib/Target/ARM/ARMFrameInfo.cpp +++ b/lib/Target/ARM/ARMFrameInfo.cpp @@ -508,11 +508,7 @@ void ARMFrameInfo::emitPushInst(MachineBasicBlock &MBB, DebugLoc DL; if (MI != MBB.end()) DL = MI->getDebugLoc(); - MachineInstrBuilder MIB = BuildMI(MF, DL, TII.get(Opc)); - MIB.addReg(ARM::SP, getDefRegState(true)); - MIB.addReg(ARM::SP); - AddDefaultPred(MIB); - bool NumRegs = false; + SmallVector<std::pair<unsigned,bool>, 4> Regs; for (unsigned i = CSI.size(); i != 0; --i) { unsigned Reg = CSI[i-1].getReg(); if (!(Func)(Reg, STI.isTargetDarwin())) continue; @@ -530,15 +526,16 @@ void ARMFrameInfo::emitPushInst(MachineBasicBlock &MBB, if (isKill) MBB.addLiveIn(Reg); - NumRegs = true; - MIB.addReg(Reg, getKillRegState(isKill)); + Regs.push_back(std::make_pair(Reg, isKill)); } // It's illegal to emit push instruction without operands. - if (NumRegs) - MBB.insert(MI, &*MIB); - else - MF.DeleteMachineInstr(MIB); + if (!Regs.empty()) { + MachineInstrBuilder MIB = AddDefaultPred(BuildMI(MBB, MI, DL, TII.get(Opc), + ARM::SP).addReg(ARM::SP)); + for (unsigned i = 0, e = Regs.size(); i < e; ++i) + MIB.addReg(Regs[i].first, getKillRegState(Regs[i].second)); + } } bool ARMFrameInfo::spillCalleeSavedRegisters(MachineBasicBlock &MBB, |