diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2010-01-27 20:34:15 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2010-01-27 20:34:15 +0000 |
commit | f0356fe140af1a30587b9a86bcfb1b2c51b8ce20 (patch) | |
tree | b93c54de2473a5a87afd13ebccdd234b509b6b72 /lib/VMCore/PassManager.cpp | |
parent | 5deb57c68552a85094b786dfdbd16e3744716733 (diff) | |
download | external_llvm-f0356fe140af1a30587b9a86bcfb1b2c51b8ce20.zip external_llvm-f0356fe140af1a30587b9a86bcfb1b2c51b8ce20.tar.gz external_llvm-f0356fe140af1a30587b9a86bcfb1b2c51b8ce20.tar.bz2 |
Kill ModuleProvider and ghost linkage by inverting the relationship between
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
GlobalValues now, and doesn't provide modules, it's renamed to
"GVMaterializer". Code that used to need a ModuleProvider to materialize
Functions can now materialize the Functions directly. Functions no longer use a
magic linkage to record that they're materializable; they simply ask the
GVMaterializer.
Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
the functions that refer to it. Instead, because Module now exposes the same
functionality ModuleProvider used to, we store a Module* in any
LLVMModuleProviderRef and translate in the wrapper methods. The bindings to
other languages still use the ModuleProvider concept. It would probably be
worth some time to update them to follow the C++ more closely, but I don't
intend to do it.
Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94686 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/PassManager.cpp')
-rw-r--r-- | lib/VMCore/PassManager.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 0c0d64e..a1d554e 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -18,7 +18,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/Timer.h" #include "llvm/Module.h" -#include "llvm/ModuleProvider.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/raw_ostream.h" @@ -1194,15 +1193,13 @@ bool BBPassManager::doFinalization(Function &F) { // FunctionPassManager implementation /// Create new Function pass manager -FunctionPassManager::FunctionPassManager(ModuleProvider *P) { +FunctionPassManager::FunctionPassManager(Module *m) : M(m) { FPM = new FunctionPassManagerImpl(0); // FPM is the top level manager. FPM->setTopLevelManager(FPM); AnalysisResolver *AR = new AnalysisResolver(*FPM); FPM->setResolver(AR); - - MP = P; } FunctionPassManager::~FunctionPassManager() { @@ -1224,7 +1221,7 @@ void FunctionPassManager::add(Pass *P) { /// bool FunctionPassManager::run(Function &F) { std::string errstr; - if (MP->materializeFunction(&F, &errstr)) { + if (F.Materialize(&errstr)) { llvm_report_error("Error reading bitcode file: " + errstr); } return FPM->run(F); @@ -1234,13 +1231,13 @@ bool FunctionPassManager::run(Function &F) { /// doInitialization - Run all of the initializers for the function passes. /// bool FunctionPassManager::doInitialization() { - return FPM->doInitialization(*MP->getModule()); + return FPM->doInitialization(*M); } /// doFinalization - Run all of the finalizers for the function passes. /// bool FunctionPassManager::doFinalization() { - return FPM->doFinalization(*MP->getModule()); + return FPM->doFinalization(*M); } //===----------------------------------------------------------------------===// |