aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-01-31 03:37:28 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-01-31 03:37:28 +0000
commit72bebb9205c1628601b052d25555aabe6e15e6f4 (patch)
tree46aec03f1542a43687367daa215ba8134eb259bf /lib
parent0a75538a68cda3bddbda3980ea0128d9f6e6339d (diff)
MRegisterInfo::getLocation() is a really bad idea. Its function is to calculate the offset from frame pointer to a stack slot and then storing the delta in a MachineLocation object. The name is bad (it implies a getter), and MRegisterInfo doesn't need to know about MachineLocation.
Replace getLocation() with getFrameIndexOffset() which returns the delta from frame pointer to stack slot. Dwarf writer can then use the information for whatever it wants. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46597 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/DwarfWriter.cpp3
-rw-r--r--lib/Target/MRegisterInfo.cpp18
2 files changed, 8 insertions, 13 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp
index 1068f68991..de5709622b 100644
--- a/lib/CodeGen/DwarfWriter.cpp
+++ b/lib/CodeGen/DwarfWriter.cpp
@@ -1875,7 +1875,8 @@ private:
// Add variable address.
MachineLocation Location;
- RI->getLocation(*MF, DV->getFrameIndex(), Location);
+ Location.set(RI->getFrameRegister(*MF),
+ RI->getFrameIndexOffset(*MF, DV->getFrameIndex()));
AddAddress(VariableDie, DW_AT_location, Location);
return VariableDie;
diff --git a/lib/Target/MRegisterInfo.cpp b/lib/Target/MRegisterInfo.cpp
index d7e161107e..0d14aeea55 100644
--- a/lib/Target/MRegisterInfo.cpp
+++ b/lib/Target/MRegisterInfo.cpp
@@ -16,7 +16,6 @@
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
-#include "llvm/CodeGen/MachineLocation.h"
#include "llvm/ADT/BitVector.h"
using namespace llvm;
@@ -72,19 +71,14 @@ BitVector MRegisterInfo::getAllocatableSet(MachineFunction &MF,
return Allocatable;
}
-/// getLocation - This method should return the actual location of a frame
-/// variable given the frame index. The location is returned in ML.
-/// Subclasses should override this method for special handling of frame
-/// variables and then call MRegisterInfo::getLocation for the default action.
-void MRegisterInfo::getLocation(MachineFunction &MF, unsigned Index,
- MachineLocation &ML) const {
+/// getFrameIndexOffset - Returns the displacement from the frame register to
+/// the stack frame of the specified index. This is the default implementation
+/// which is likely incorrect for the target.
+int MRegisterInfo::getFrameIndexOffset(MachineFunction &MF, unsigned FI) const {
const TargetFrameInfo &TFI = *MF.getTarget().getFrameInfo();
MachineFrameInfo *MFI = MF.getFrameInfo();
- ML.set(getFrameRegister(MF),
- MFI->getObjectOffset(Index) +
- MFI->getStackSize() -
- TFI.getOffsetOfLocalArea() +
- MFI->getOffsetAdjustment());
+ return MFI->getObjectOffset(FI) + MFI->getStackSize() -
+ TFI.getOffsetOfLocalArea() + MFI->getOffsetAdjustment();
}
/// getInitialFrameState - Returns a list of machine moves that are assumed