From c67aa7cbd507eb0ecf65724dd22a1bc968a2a549 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Thu, 31 Jan 2008 04:06:00 +0000 Subject: [PATCH] Add x86 specific getFrameIndexOffset(). This fixes local variable debugging info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46598 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86RegisterInfo.cpp | 14 ++++++++++++++ lib/Target/X86/X86RegisterInfo.h | 1 + 2 files changed, 15 insertions(+) diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp index 2f8ee1dadd8..53efdc8d554 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/lib/Target/X86/X86RegisterInfo.cpp @@ -835,6 +835,20 @@ unsigned X86RegisterInfo::getFrameRegister(MachineFunction &MF) const { return hasFP(MF) ? FramePtr : StackPtr; } +int +X86RegisterInfo::getFrameIndexOffset(MachineFunction &MF, unsigned FI) const { + int Offset = MF.getFrameInfo()->getObjectOffset(FI) + SlotSize; + if (!hasFP(MF)) + return Offset + MF.getFrameInfo()->getStackSize(); + + Offset += SlotSize; // Skip the saved EBP + // Skip the RETADDR move area + X86MachineFunctionInfo *X86FI = MF.getInfo(); + int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta(); + if (TailCallReturnAddrDelta < 0) Offset -= TailCallReturnAddrDelta; + return Offset; +} + void X86RegisterInfo::getInitialFrameState(std::vector &Moves) const { // Calculate amount of bytes used for return address storing diff --git a/lib/Target/X86/X86RegisterInfo.h b/lib/Target/X86/X86RegisterInfo.h index 16bbf074898..fd18c4135db 100644 --- a/lib/Target/X86/X86RegisterInfo.h +++ b/lib/Target/X86/X86RegisterInfo.h @@ -122,6 +122,7 @@ public: // Debug information queries. unsigned getRARegister() const; unsigned getFrameRegister(MachineFunction &MF) const; + int getFrameIndexOffset(MachineFunction &MF, unsigned FI) const; void getInitialFrameState(std::vector &Moves) const; // Exception handling queries.