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 Function;
class GCModuleInfo;
class MachineRegisterInfo;
class MachineFrameInfo;
class MachineConstantPool;
@ -75,6 +76,7 @@ class MachineFunction {
const TargetMachine &Target;
MCContext &Ctx;
MachineModuleInfo &MMI;
GCModuleInfo *GMI;
// RegInfo - Information about each register in use in the function.
MachineRegisterInfo *RegInfo;
@ -127,10 +129,12 @@ class MachineFunction {
void operator=(const MachineFunction&); // DO NOT IMPLEMENT
public:
MachineFunction(const Function *Fn, const TargetMachine &TM,
unsigned FunctionNum, MachineModuleInfo &MMI);
unsigned FunctionNum, MachineModuleInfo &MMI,
GCModuleInfo* GMI);
~MachineFunction();
MachineModuleInfo &getMMI() const { return MMI; }
GCModuleInfo *getGMI() const { return GMI; }
MCContext &getContext() const { return Ctx; }
/// 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,
unsigned FunctionNum, MachineModuleInfo &mmi)
: Fn(F), Target(TM), Ctx(mmi.getContext()), MMI(mmi) {
unsigned FunctionNum, MachineModuleInfo &mmi,
GCModuleInfo* gmi)
: Fn(F), Target(TM), Ctx(mmi.getContext()), MMI(mmi), GMI(gmi) {
if (TM.getRegisterInfo())
RegInfo = new (Allocator) MachineRegisterInfo(*TM.getRegisterInfo());
else

View File

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