X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FGCStrategy.cpp;h=517b3a7762e7e3c70ff2f542bf42b46907fa276b;hb=ef5b199905cee0b78eb30cd44836e5b6ca5cbd09;hp=26667759964314fee9a8b8449774237e3679c88e;hpb=5eca075b74d62c621b160aa216b4cd50829a2cc7;p=oota-llvm.git diff --git a/lib/CodeGen/GCStrategy.cpp b/lib/CodeGen/GCStrategy.cpp index 26667759964..517b3a7762e 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; @@ -65,7 +66,6 @@ namespace { GCFunctionInfo *FI; MachineModuleInfo *MMI; const TargetInstrInfo *TII; - MachineFrameInfo *MFI; void FindSafePoints(MachineFunction &MF); void VisitCallPoint(MachineBasicBlock::iterator MI); @@ -88,13 +88,6 @@ namespace { // ----------------------------------------------------------------------------- -template<> GCRegistry::node *GCRegistry::Head = 0; -template<> GCRegistry::node *GCRegistry::Tail = 0; -template<> GCRegistry::listener *GCRegistry::ListenerHead = 0; -template<> GCRegistry::listener *GCRegistry::ListenerTail = 0; - -// ----------------------------------------------------------------------------- - GCStrategy::GCStrategy() : NeededSafePoints(0), CustomReadBarriers(false), @@ -134,7 +127,7 @@ FunctionPass *llvm::createGCLoweringPass() { char LowerIntrinsics::ID = 0; LowerIntrinsics::LowerIntrinsics() - : FunctionPass((intptr_t)&ID) {} + : FunctionPass(&ID) {} const char *LowerIntrinsics::getPassName() const { return "Lower Garbage Collection Instructions"; @@ -363,14 +356,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) { @@ -385,10 +376,9 @@ bool MachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) { TM = &MF.getTarget(); MMI = &getAnalysis(); 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);