Fix off-by-one stack offset computations (dwarf information) for callee-saved

registers in case, when FP pointer was eliminated. This should fixes misc. random
EH-related crahses, when stuff is compiled with -fomit-frame-pointer.
Thanks Duncan for nailing this bug!

llvm-svn: 43381
This commit is contained in:
Anton Korobeynikov 2007-10-26 09:13:24 +00:00
parent 82c77dd85b
commit 0d3f43480e

View File

@ -1816,10 +1816,11 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
MFI->getObjectOffset(CSI[I].getFrameIdx()));
// Calculate offsets
int64_t saveAreaOffset = (hasFP(MF) ? 3 : 2)*stackGrowth;
for (unsigned I = 0, E = CSI.size(); I!=E; ++I) {
int64_t Offset = MFI->getObjectOffset(CSI[I].getFrameIdx());
unsigned Reg = CSI[I].getReg();
Offset = (MaxOffset-Offset+3*stackGrowth);
Offset = (MaxOffset-Offset+saveAreaOffset);
MachineLocation CSDst(MachineLocation::VirtualFP, Offset);
MachineLocation CSSrc(Reg);
Moves.push_back(MachineMove(FrameLabelId, CSDst, CSSrc));