summaryrefslogtreecommitdiff
path: root/lib/Target/MRegisterInfo.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-03-28 13:48:33 +0000
committerJim Laskey <jlaskey@mac.com>2006-03-28 13:48:33 +0000
commita99791886d5d4af2b900cd8cc1c9ed1677b6f0f4 (patch)
tree42256e08be1793925558e994c319a07bc1a6c46b /lib/Target/MRegisterInfo.cpp
parentbf7637d59028a5d9911769810f537c499e23bb8e (diff)
downloadllvm-a99791886d5d4af2b900cd8cc1c9ed1677b6f0f4.tar.gz
llvm-a99791886d5d4af2b900cd8cc1c9ed1677b6f0f4.tar.bz2
llvm-a99791886d5d4af2b900cd8cc1c9ed1677b6f0f4.tar.xz
Expose base register for DwarfWriter. Refactor code accordingly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27225 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MRegisterInfo.cpp')
-rw-r--r--lib/Target/MRegisterInfo.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Target/MRegisterInfo.cpp b/lib/Target/MRegisterInfo.cpp
index 790f95f081..558783aedc 100644
--- a/lib/Target/MRegisterInfo.cpp
+++ b/lib/Target/MRegisterInfo.cpp
@@ -12,6 +12,11 @@
//===----------------------------------------------------------------------===//
#include "llvm/Target/MRegisterInfo.h"
+
+#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineFrameInfo.h"
+#include "llvm/CodeGen/MachineLocation.h"
+
using namespace llvm;
MRegisterInfo::MRegisterInfo(const TargetRegisterDesc *D, unsigned NR,
@@ -38,3 +43,14 @@ std::vector<bool> MRegisterInfo::getAllocatableSet(MachineFunction &MF) const {
}
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 {
+ MachineFrameInfo *MFI = MF.getFrameInfo();
+ ML.set(getFrameRegister(MF),
+ MFI->getObjectOffset(Index) + MFI->getStackSize());
+}