[llvm-commits] [llvm] r54994 - /llvm/trunk/lib/CodeGen/GCStrategy.cpp
Gordon Henriksen
gordonhenriksen at mac.com
Tue Aug 19 10:06:35 PDT 2008
Author: gordon
Date: Tue Aug 19 12:06:35 2008
New Revision: 54994
URL: http://llvm.org/viewvc/llvm-project?rev=54994&view=rev
Log:
[PR2327] Leverage TargetRegisterInfo to compute frame offsets for GC metadata.
Modified:
llvm/trunk/lib/CodeGen/GCStrategy.cpp
Modified: llvm/trunk/lib/CodeGen/GCStrategy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GCStrategy.cpp?rev=54994&r1=54993&r2=54994&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GCStrategy.cpp (original)
+++ llvm/trunk/lib/CodeGen/GCStrategy.cpp Tue Aug 19 12:06:35 2008
@@ -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::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 @@
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);
More information about the llvm-commits
mailing list