diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2007-07-24 21:07:39 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2007-07-24 21:07:39 +0000 |
commit | f38d0d00d160dc689967c8056af057086313ccf9 (patch) | |
tree | 5152e5cd8db28f07b06b477b5c864a00d7064064 /lib | |
parent | 85c4064356246ca7398ad4815f2aca56be9e1442 (diff) | |
download | external_llvm-f38d0d00d160dc689967c8056af057086313ccf9.zip external_llvm-f38d0d00d160dc689967c8056af057086313ccf9.tar.gz external_llvm-f38d0d00d160dc689967c8056af057086313ccf9.tar.bz2 |
Heal EH handling stuff by emitting correct offsets to callee-saved registers.
Pretty hackish, but code itself is dirty mess, so we won't make anything worse. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40472 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/X86/X86RegisterInfo.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp index f4fd452..29bdf94 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/lib/Target/X86/X86RegisterInfo.cpp @@ -1297,9 +1297,21 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const { // Add callee saved registers to move list. const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo(); - for (unsigned I = 0, E = CSI.size(); I != E; ++I) { + + // FIXME: This is dirty hack. The code itself is pretty mess right now. + // It should be rewritten from scratch and generalized sometimes. + + // Determine maximum offset (minumum due to stack growth) + int64_t MaxOffset = 0; + for (unsigned I = 0, E = CSI.size(); I!=E; ++I) + MaxOffset = std::min(MaxOffset, + MFI->getObjectOffset(CSI[I].getFrameIdx())); + + // Calculate offsets + 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); MachineLocation CSDst(MachineLocation::VirtualFP, Offset); MachineLocation CSSrc(Reg); Moves.push_back(MachineMove(FrameLabelId, CSDst, CSSrc)); |