[llvm-commits] [llvm] r100508 - in /llvm/trunk: include/llvm/CodeGen/MachineFunctionAnalysis.h include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/MachineFunctionAnalysis.cpp lib/CodeGen/MachineModuleInfo.cpp
Chris Lattner
sabre at nondot.org
Mon Apr 5 17:51:52 PDT 2010
Author: lattner
Date: Mon Apr 5 19:51:52 2010
New Revision: 100508
URL: http://llvm.org/viewvc/llvm-project?rev=100508&view=rev
Log:
Give MachineModuleInfo an actual Module*.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineFunctionAnalysis.h
llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp
llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineFunctionAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunctionAnalysis.h?rev=100508&r1=100507&r2=100508&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFunctionAnalysis.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFunctionAnalysis.h Mon Apr 5 19:51:52 2010
@@ -39,7 +39,7 @@
CodeGenOpt::Level getOptLevel() const { return OptLevel; }
private:
- virtual bool doInitialization(Module &) { NextFnNum = 1; return false; }
+ virtual bool doInitialization(Module &M);
virtual bool runOnFunction(Function &F);
virtual void releaseMemory();
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=100508&r1=100507&r2=100508&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Mon Apr 5 19:51:52 2010
@@ -100,6 +100,9 @@
/// Context - This is the MCContext used for the entire code generator.
MCContext Context;
+ /// TheModule - This is the LLVM Module being worked on.
+ Module *TheModule;
+
/// ObjFileMMI - This is the object-file-format-specific implementation of
/// MachineModuleInfoImpl, which lets targets accumulate whatever info they
/// want.
@@ -176,6 +179,9 @@
const MCContext &getContext() const { return Context; }
MCContext &getContext() { return Context; }
+ void setModule(Module *M) { TheModule = M; }
+ Module *getModule() const { return TheModule; }
+
/// getInfo - Keep track of various per-function pieces of information for
/// backends that would like to do so.
///
Modified: llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp?rev=100508&r1=100507&r2=100508&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineFunctionAnalysis.cpp Mon Apr 5 19:51:52 2010
@@ -35,6 +35,19 @@
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++,
@@ -46,8 +59,3 @@
delete MF;
MF = 0;
}
-
-void MachineFunctionAnalysis::getAnalysisUsage(AnalysisUsage &AU) const {
- AU.setPreservesAll();
- AU.addRequired<MachineModuleInfo>();
-}
Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=100508&r1=100507&r2=100508&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Mon Apr 5 19:51:52 2010
@@ -262,6 +262,7 @@
// Always emit some info, by default "no personality" info.
Personalities.push_back(NULL);
AddrLabelSymbols = 0;
+ TheModule = 0;
}
MachineModuleInfo::MachineModuleInfo()
More information about the llvm-commits
mailing list