llvm.org GIT mirror llvm / 820e55e
enhance MachineFunction to have a MMI pointer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100414 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 10 years ago
3 changed file(s) with 12 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
3131 class MachineFrameInfo;
3232 class MachineConstantPool;
3333 class MachineJumpTableInfo;
34 class MachineModuleInfo;
3435 class MCContext;
3536 class Pass;
3637 class TargetMachine;
7172 Function *Fn;
7273 const TargetMachine &Target;
7374 MCContext &Ctx;
74
75 MachineModuleInfo &MMI;
76
7577 // RegInfo - Information about each register in use in the function.
7678 MachineRegisterInfo *RegInfo;
7779
106108 typedef ilist BasicBlockListType;
107109 BasicBlockListType BasicBlocks;
108110
109 // Default debug location. Used to print out the debug label at the beginning
110 // of a function.
111 /// Default debug location. Used to print out the debug label at the beginning
112 /// of a function.
111113 DebugLoc DefaultDebugLoc;
112114
113115 /// FunctionNumber - This provides a unique ID for each function emitted in
115117 ///
116118 unsigned FunctionNumber;
117119
118 // The alignment of the function.
120 /// The alignment of the function.
119121 unsigned Alignment;
120122
121123 MachineFunction(const MachineFunction &); // DO NOT IMPLEMENT
122124 void operator=(const MachineFunction&); // DO NOT IMPLEMENT
123
124125 public:
125126 MachineFunction(Function *Fn, const TargetMachine &TM, unsigned FunctionNum,
126 MCContext &Ctx);
127 MachineModuleInfo &MMI);
127128 ~MachineFunction();
128129
130 MachineModuleInfo &getMMI() const { return MMI; }
129131 MCContext &getContext() const { return Ctx; }
130132
131133 /// getFunction - Return the LLVM function that this machine code represents
2222 #include "llvm/CodeGen/MachineFrameInfo.h"
2323 #include "llvm/CodeGen/MachineInstr.h"
2424 #include "llvm/CodeGen/MachineJumpTableInfo.h"
25 #include "llvm/CodeGen/MachineModuleInfo.h"
2526 #include "llvm/CodeGen/MachineRegisterInfo.h"
2627 #include "llvm/CodeGen/Passes.h"
2728 #include "llvm/MC/MCAsmInfo.h"
5051 }
5152
5253 MachineFunction::MachineFunction(Function *F, const TargetMachine &TM,
53 unsigned FunctionNum, MCContext &ctx)
54 : Fn(F), Target(TM), Ctx(ctx) {
54 unsigned FunctionNum, MachineModuleInfo &mmi)
55 : Fn(F), Target(TM), Ctx(mmi.getContext()), MMI(mmi) {
5556 if (TM.getRegisterInfo())
5657 RegInfo = new (Allocator) MachineRegisterInfo(*TM.getRegisterInfo());
5758 else
3737 bool MachineFunctionAnalysis::runOnFunction(Function &F) {
3838 assert(!MF && "MachineFunctionAnalysis already initialized!");
3939 MF = new MachineFunction(&F, TM, NextFnNum++,
40 getAnalysis().getContext());
40 getAnalysis());
4141 return false;
4242 }
4343