summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-05 05:49:50 +0000
committerChris Lattner <sabre@nondot.org>2010-04-05 05:49:50 +0000
commit820e55e9ad3cb3b17780e84863648e431b571d25 (patch)
tree1024993addefdc20ee3c5ba8818fce869392b237
parent00759c15e00e44214b752cc53829b1ef5f624cb0 (diff)
downloadllvm-820e55e9ad3cb3b17780e84863648e431b571d25.tar.gz
llvm-820e55e9ad3cb3b17780e84863648e431b571d25.tar.bz2
llvm-820e55e9ad3cb3b17780e84863648e431b571d25.tar.xz
enhance MachineFunction to have a MMI pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100414 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/CodeGen/MachineFunction.h14
-rw-r--r--lib/CodeGen/MachineFunction.cpp5
-rw-r--r--lib/CodeGen/MachineFunctionAnalysis.cpp2
3 files changed, 12 insertions, 9 deletions
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index 59b171850d..b3609c2ea7 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -32,6 +32,7 @@ class MachineRegisterInfo;
class MachineFrameInfo;
class MachineConstantPool;
class MachineJumpTableInfo;
+class MachineModuleInfo;
class MCContext;
class Pass;
class TargetMachine;
@@ -72,7 +73,8 @@ class MachineFunction {
Function *Fn;
const TargetMachine &Target;
MCContext &Ctx;
-
+ MachineModuleInfo &MMI;
+
// RegInfo - Information about each register in use in the function.
MachineRegisterInfo *RegInfo;
@@ -107,8 +109,8 @@ class MachineFunction {
typedef ilist<MachineBasicBlock> BasicBlockListType;
BasicBlockListType BasicBlocks;
- // Default debug location. Used to print out the debug label at the beginning
- // of a function.
+ /// Default debug location. Used to print out the debug label at the beginning
+ /// of a function.
DebugLoc DefaultDebugLoc;
/// FunctionNumber - This provides a unique ID for each function emitted in
@@ -116,17 +118,17 @@ class MachineFunction {
///
unsigned FunctionNumber;
- // The alignment of the function.
+ /// The alignment of the function.
unsigned Alignment;
MachineFunction(const MachineFunction &); // DO NOT IMPLEMENT
void operator=(const MachineFunction&); // DO NOT IMPLEMENT
-
public:
MachineFunction(Function *Fn, const TargetMachine &TM, unsigned FunctionNum,
- MCContext &Ctx);
+ MachineModuleInfo &MMI);
~MachineFunction();
+ MachineModuleInfo &getMMI() const { return MMI; }
MCContext &getContext() const { return Ctx; }
/// getFunction - Return the LLVM function that this machine code represents
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp
index beac0c630b..e4ed7dbac4 100644
--- a/lib/CodeGen/MachineFunction.cpp
+++ b/lib/CodeGen/MachineFunction.cpp
@@ -23,6 +23,7 @@
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/MC/MCAsmInfo.h"
@@ -51,8 +52,8 @@ void ilist_traits<MachineBasicBlock>::deleteNode(MachineBasicBlock *MBB) {
}
MachineFunction::MachineFunction(Function *F, const TargetMachine &TM,
- unsigned FunctionNum, MCContext &ctx)
- : Fn(F), Target(TM), Ctx(ctx) {
+ unsigned FunctionNum, MachineModuleInfo &mmi)
+ : Fn(F), Target(TM), Ctx(mmi.getContext()), MMI(mmi) {
if (TM.getRegisterInfo())
RegInfo = new (Allocator) MachineRegisterInfo(*TM.getRegisterInfo());
else
diff --git a/lib/CodeGen/MachineFunctionAnalysis.cpp b/lib/CodeGen/MachineFunctionAnalysis.cpp
index d3f1d8296d..faddcb2920 100644
--- a/lib/CodeGen/MachineFunctionAnalysis.cpp
+++ b/lib/CodeGen/MachineFunctionAnalysis.cpp
@@ -38,7 +38,7 @@ MachineFunctionAnalysis::~MachineFunctionAnalysis() {
bool MachineFunctionAnalysis::runOnFunction(Function &F) {
assert(!MF && "MachineFunctionAnalysis already initialized!");
MF = new MachineFunction(&F, TM, NextFnNum++,
- getAnalysis<MachineModuleInfo>().getContext());
+ getAnalysis<MachineModuleInfo>());
return false;
}