Attach a GCModuleInfo to a MachineFunction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117867 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nicolas Geoffray 2010-10-31 20:38:38 +00:00
parent d6d9dd9f5e
commit 7a5a3f75eb
3 changed files with 11 additions and 4 deletions

View File

@ -28,6 +28,7 @@ namespace llvm {
class Value; class Value;
class Function; class Function;
class GCModuleInfo;
class MachineRegisterInfo; class MachineRegisterInfo;
class MachineFrameInfo; class MachineFrameInfo;
class MachineConstantPool; class MachineConstantPool;
@ -75,6 +76,7 @@ class MachineFunction {
const TargetMachine &Target; const TargetMachine &Target;
MCContext &Ctx; MCContext &Ctx;
MachineModuleInfo &MMI; MachineModuleInfo &MMI;
GCModuleInfo *GMI;
// RegInfo - Information about each register in use in the function. // RegInfo - Information about each register in use in the function.
MachineRegisterInfo *RegInfo; MachineRegisterInfo *RegInfo;
@ -127,10 +129,12 @@ class MachineFunction {
void operator=(const MachineFunction&); // DO NOT IMPLEMENT void operator=(const MachineFunction&); // DO NOT IMPLEMENT
public: public:
MachineFunction(const Function *Fn, const TargetMachine &TM, MachineFunction(const Function *Fn, const TargetMachine &TM,
unsigned FunctionNum, MachineModuleInfo &MMI); unsigned FunctionNum, MachineModuleInfo &MMI,
GCModuleInfo* GMI);
~MachineFunction(); ~MachineFunction();
MachineModuleInfo &getMMI() const { return MMI; } MachineModuleInfo &getMMI() const { return MMI; }
GCModuleInfo *getGMI() const { return GMI; }
MCContext &getContext() const { return Ctx; } MCContext &getContext() const { return Ctx; }
/// getFunction - Return the LLVM function that this machine code represents /// getFunction - Return the LLVM function that this machine code represents

View File

@ -52,8 +52,9 @@ void ilist_traits<MachineBasicBlock>::deleteNode(MachineBasicBlock *MBB) {
} }
MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM, MachineFunction::MachineFunction(const Function *F, const TargetMachine &TM,
unsigned FunctionNum, MachineModuleInfo &mmi) unsigned FunctionNum, MachineModuleInfo &mmi,
: Fn(F), Target(TM), Ctx(mmi.getContext()), MMI(mmi) { GCModuleInfo* gmi)
: Fn(F), Target(TM), Ctx(mmi.getContext()), MMI(mmi), GMI(gmi) {
if (TM.getRegisterInfo()) if (TM.getRegisterInfo())
RegInfo = new (Allocator) MachineRegisterInfo(*TM.getRegisterInfo()); RegInfo = new (Allocator) MachineRegisterInfo(*TM.getRegisterInfo());
else else

View File

@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "llvm/CodeGen/MachineFunctionAnalysis.h" #include "llvm/CodeGen/MachineFunctionAnalysis.h"
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h"
using namespace llvm; using namespace llvm;
@ -52,7 +53,8 @@ bool MachineFunctionAnalysis::doInitialization(Module &M) {
bool MachineFunctionAnalysis::runOnFunction(Function &F) { bool MachineFunctionAnalysis::runOnFunction(Function &F) {
assert(!MF && "MachineFunctionAnalysis already initialized!"); assert(!MF && "MachineFunctionAnalysis already initialized!");
MF = new MachineFunction(&F, TM, NextFnNum++, MF = new MachineFunction(&F, TM, NextFnNum++,
getAnalysis<MachineModuleInfo>()); getAnalysis<MachineModuleInfo>(),
getAnalysisIfAvailable<GCModuleInfo>());
return false; return false;
} }