diff options
| author | Wesley Peck <peckw@wesleypeck.com> | 2011-01-05 17:34:20 +0000 |
|---|---|---|
| committer | Wesley Peck <peckw@wesleypeck.com> | 2011-01-05 17:34:20 +0000 |
| commit | 07fd1efcfa6ac0b5f2abfb25df29b002180ab380 (patch) | |
| tree | 00d9ac4840e5363524fd5fe352d7e894fb7d13e9 /llvm | |
| parent | e9a803596254876b2df91f090e3bb57d85206632 (diff) | |
| download | bcm5719-llvm-07fd1efcfa6ac0b5f2abfb25df29b002180ab380.tar.gz bcm5719-llvm-07fd1efcfa6ac0b5f2abfb25df29b002180ab380.zip | |
Commit 122778 broke DWARF debug output when using the MBlaze backend. Fixed by overriding TargetFrameInfo::getFrameIndexOffset to take into account the new frame index information.
llvm-svn: 122889
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Target/MBlaze/MBlazeFrameInfo.cpp | 10 | ||||
| -rw-r--r-- | llvm/lib/Target/MBlaze/MBlazeFrameInfo.h | 2 | ||||
| -rw-r--r-- | llvm/lib/Target/MBlaze/MBlazeMachineFunction.h | 18 |
3 files changed, 30 insertions, 0 deletions
diff --git a/llvm/lib/Target/MBlaze/MBlazeFrameInfo.cpp b/llvm/lib/Target/MBlaze/MBlazeFrameInfo.cpp index 1e4f337fe5a..ab888c9348c 100644 --- a/llvm/lib/Target/MBlaze/MBlazeFrameInfo.cpp +++ b/llvm/lib/Target/MBlaze/MBlazeFrameInfo.cpp @@ -43,6 +43,7 @@ namespace llvm { static void replaceFrameIndexes(MachineFunction &MF, SmallVector<std::pair<int,int64_t>, 16> &FR) { MachineFrameInfo *MFI = MF.getFrameInfo(); + MBlazeFunctionInfo *MBlazeFI = MF.getInfo<MBlazeFunctionInfo>(); const SmallVector<std::pair<int,int64_t>, 16>::iterator FRB = FR.begin(); const SmallVector<std::pair<int,int64_t>, 16>::iterator FRE = FR.end(); @@ -50,6 +51,7 @@ static void replaceFrameIndexes(MachineFunction &MF, for (; FRI != FRE; ++FRI) { MFI->RemoveStackObject(FRI->first); int NFI = MFI->CreateFixedObject(4, FRI->second, true); + MBlazeFI->recordReplacement(FRI->first, NFI); for (MachineFunction::iterator MB=MF.begin(), ME=MF.end(); MB!=ME; ++MB) { MachineBasicBlock::iterator MBB = MB->begin(); @@ -321,6 +323,14 @@ static void determineFrameLayout(MachineFunction &MF) { DEBUG(dbgs() << "Aligned Frame Size: " << FrameSize << "\n" ); } +int MBlazeFrameInfo::getFrameIndexOffset(const MachineFunction &MF, int FI) + const { + const MBlazeFunctionInfo *MBlazeFI = MF.getInfo<MBlazeFunctionInfo>(); + if (MBlazeFI->hasReplacement(FI)) + FI = MBlazeFI->getReplacement(FI); + return TargetFrameInfo::getFrameIndexOffset(MF,FI); +} + // hasFP - Return true if the specified function should have a dedicated frame // pointer register. This is true if the function has variable sized allocas or // if frame pointer elimination is disabled. diff --git a/llvm/lib/Target/MBlaze/MBlazeFrameInfo.h b/llvm/lib/Target/MBlaze/MBlazeFrameInfo.h index 03c39f05024..8c8bfeb9969 100644 --- a/llvm/lib/Target/MBlaze/MBlazeFrameInfo.h +++ b/llvm/lib/Target/MBlaze/MBlazeFrameInfo.h @@ -42,6 +42,8 @@ public: bool hasFP(const MachineFunction &MF) const; + int getFrameIndexOffset(const MachineFunction &MF, int FI) const; + virtual void processFunctionBeforeCalleeSavedScan(MachineFunction &MF, RegScavenger *RS) const; }; diff --git a/llvm/lib/Target/MBlaze/MBlazeMachineFunction.h b/llvm/lib/Target/MBlaze/MBlazeMachineFunction.h index 8340d921ba4..df395094282 100644 --- a/llvm/lib/Target/MBlaze/MBlazeMachineFunction.h +++ b/llvm/lib/Target/MBlaze/MBlazeMachineFunction.h @@ -14,6 +14,7 @@ #ifndef MBLAZE_MACHINE_FUNCTION_INFO_H #define MBLAZE_MACHINE_FUNCTION_INFO_H +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/VectorExtras.h" #include "llvm/CodeGen/MachineFunction.h" @@ -63,6 +64,11 @@ private: SmallVector<MBlazeFIHolder, 4> FnStoreVarArgs; bool HasStoreVarArgs; + // When determining the final stack layout some of the frame indexes may + // be replaced by new frame indexes that reside in the caller's stack + // frame. The replacements are recorded in this structure. + DenseMap<int,int> FIReplacements; + /// SRetReturnReg - Some subtargets require that sret lowering includes /// returning the value of the returned struct in a register. This field /// holds the virtual register into which the sret argument is passed. @@ -115,6 +121,18 @@ public: const SmallVector<int, 16>& getLiveIn() const { return LiveInFI; } + void recordReplacement(int OFI, int NFI) { + FIReplacements.insert(std::make_pair(OFI,NFI)); + } + + bool hasReplacement(int OFI) const { + return FIReplacements.find(OFI) != FIReplacements.end(); + } + + int getReplacement(int OFI) const { + return FIReplacements.lookup(OFI); + } + void recordLoadArgsFI(int FI, int SPOffset) { if (!HasLoadArgs) HasLoadArgs=true; FnLoadArgs.push_back(MBlazeFIHolder(FI, SPOffset)); |

