summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/MachineFunctionAnalysis.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/MachineFunctionAnalysis.cpp')
-rw-r--r--lib/CodeGen/MachineFunctionAnalysis.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/CodeGen/MachineFunctionAnalysis.cpp b/lib/CodeGen/MachineFunctionAnalysis.cpp
index d3f1d82..3b2eb6d 100644
--- a/lib/CodeGen/MachineFunctionAnalysis.cpp
+++ b/lib/CodeGen/MachineFunctionAnalysis.cpp
@@ -35,10 +35,23 @@ MachineFunctionAnalysis::~MachineFunctionAnalysis() {
assert(!MF && "MachineFunctionAnalysis left initialized!");
}
+void MachineFunctionAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ AU.addRequired<MachineModuleInfo>();
+}
+
+bool MachineFunctionAnalysis::doInitialization(Module &M) {
+ MachineModuleInfo *MMI = getAnalysisIfAvailable<MachineModuleInfo>();
+ assert(MMI && "MMI not around yet??");
+ MMI->setModule(&M);
+ NextFnNum = 1; return false;
+}
+
+
bool MachineFunctionAnalysis::runOnFunction(Function &F) {
assert(!MF && "MachineFunctionAnalysis already initialized!");
MF = new MachineFunction(&F, TM, NextFnNum++,
- getAnalysis<MachineModuleInfo>().getContext());
+ getAnalysis<MachineModuleInfo>());
return false;
}
@@ -46,8 +59,3 @@ void MachineFunctionAnalysis::releaseMemory() {
delete MF;
MF = 0;
}
-
-void MachineFunctionAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
- AU.setPreservesAll();
- AU.addRequired<MachineModuleInfo>();
-}
OpenPOWER on IntegriCloud