diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-08-19 17:06:35 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-08-19 17:06:35 +0000 |
commit | fcbcfaa95f6ca975094d0a832ecdc3f342d2ff46 (patch) | |
tree | e31b2e1fc877a77313f80dbdd13a90708262a6a0 /lib/CodeGen/GCStrategy.cpp | |
parent | 2d450ebe1857c60f382aa178d793664f895cf373 (diff) |
[PR2327] Leverage TargetRegisterInfo to compute frame offsets for GC metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54994 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/GCStrategy.cpp')
-rw-r--r-- | lib/CodeGen/GCStrategy.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/CodeGen/GCStrategy.cpp b/lib/CodeGen/GCStrategy.cpp index 6ca368240d..b02d1685ad 100644 --- a/lib/CodeGen/GCStrategy.cpp +++ b/lib/CodeGen/GCStrategy.cpp @@ -26,6 +26,7 @@ #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Support/Compiler.h" using namespace llvm; @@ -356,14 +357,12 @@ void MachineCodeAnalysis::FindSafePoints(MachineFunction &MF) { } void MachineCodeAnalysis::FindStackOffsets(MachineFunction &MF) { - uint64_t StackSize = MFI->getStackSize(); - uint64_t OffsetAdjustment = MFI->getOffsetAdjustment(); - uint64_t OffsetOfLocalArea = TM->getFrameInfo()->getOffsetOfLocalArea(); + const TargetRegisterInfo *TRI = TM->getRegisterInfo(); + assert(TRI && "TargetRegisterInfo not available!"); for (GCFunctionInfo::roots_iterator RI = FI->roots_begin(), RE = FI->roots_end(); RI != RE; ++RI) - RI->StackOffset = MFI->getObjectOffset(RI->Num) + StackSize - - OffsetOfLocalArea + OffsetAdjustment; + RI->StackOffset = TRI->getFrameIndexOffset(MF, RI->Num); } bool MachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) { @@ -378,10 +377,9 @@ bool MachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) { TM = &MF.getTarget(); MMI = &getAnalysis<MachineModuleInfo>(); TII = TM->getInstrInfo(); - MFI = MF.getFrameInfo(); // Find the size of the stack frame. - FI->setFrameSize(MFI->getStackSize()); + FI->setFrameSize(MF.getFrameInfo()->getStackSize()); // Find all safe points. FindSafePoints(MF); |