diff options
author | Hans Wennborg <hans@hanshq.net> | 2016-03-31 18:33:38 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2016-03-31 18:33:38 +0000 |
commit | e1a2e90ffadd810ef6bd580e90b42a83958dfc11 (patch) | |
tree | ab342aa8c1dafe2bfd02a92e89b084c34cb29f77 /llvm/lib/Target/X86/X86FrameLowering.cpp | |
parent | 19cb9476a2beea3ed33bf001080e73de1d3b7220 (diff) | |
download | bcm5719-llvm-e1a2e90ffadd810ef6bd580e90b42a83958dfc11.tar.gz bcm5719-llvm-e1a2e90ffadd810ef6bd580e90b42a83958dfc11.zip |
Change eliminateCallFramePseudoInstr() to return an iterator
This will become necessary in a subsequent change to make this method
merge adjacent stack adjustments, i.e. it might erase the previous
and/or next instruction.
It also greatly simplifies the calls to this function from Prolog-
EpilogInserter. Previously, that had a bunch of logic to resume iteration
after the call; now it just continues with the returned iterator.
Note that this changes the behaviour of PEI a little. Previously,
it attempted to re-visit the new instruction created by
eliminateCallFramePseudoInstr(). That code was added in r36625,
but I can't see any reason for it: the new instructions will obviously
not be pseudo instructions, they will not have FrameIndex operands,
and we have already accounted for the stack adjustment.
Differential Revision: http://reviews.llvm.org/D18627
llvm-svn: 265036
Diffstat (limited to 'llvm/lib/Target/X86/X86FrameLowering.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86FrameLowering.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp index 9beb916d23d..413195f09c6 100644 --- a/llvm/lib/Target/X86/X86FrameLowering.cpp +++ b/llvm/lib/Target/X86/X86FrameLowering.cpp @@ -2477,7 +2477,7 @@ bool X86FrameLowering::adjustStackWithPops(MachineBasicBlock &MBB, return true; } -void X86FrameLowering:: +MachineBasicBlock::iterator X86FrameLowering:: eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const { bool reserveCallFrame = hasReservedCallFrame(MF); @@ -2521,7 +2521,7 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MCCFIInstruction::createGnuArgsSize(nullptr, Amount)); if (Amount == 0) - return; + return I; // Factor out the amount that gets handled inside the sequence // (Pushes of argument for frame setup, callee pops for frame destroy) @@ -2561,7 +2561,7 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, } } - return; + return I; } if (isDestroy && InternalAmt) { @@ -2571,11 +2571,14 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, // We are not tracking the stack pointer adjustment by the callee, so make // sure we restore the stack pointer immediately after the call, there may // be spill code inserted between the CALL and ADJCALLSTACKUP instructions. + MachineBasicBlock::iterator CI = I; MachineBasicBlock::iterator B = MBB.begin(); - while (I != B && !std::prev(I)->isCall()) + while (CI != B && !std::prev(I)->isCall()) --I; - BuildStackAdjustment(MBB, I, DL, -InternalAmt, /*InEpilogue=*/false); + BuildStackAdjustment(MBB, CI, DL, -InternalAmt, /*InEpilogue=*/false); } + + return I; } bool X86FrameLowering::canUseAsEpilogue(const MachineBasicBlock &MBB) const { |