Changes in directory llvm/lib/VMCore:
Pass.cpp updated: 1.85 -> 1.86 --- Log message: Fix a bug that prevented the JIT from working correctly after llvm_shutdown. Pass info objects are initialized by static ctors, so deleting them at llvm_shutdown time prevents resurrection from working. --- Diffs of the changes: (+16 -6) Pass.cpp | 22 ++++++++++++++++------ 1 files changed, 16 insertions(+), 6 deletions(-) Index: llvm/lib/VMCore/Pass.cpp diff -u llvm/lib/VMCore/Pass.cpp:1.85 llvm/lib/VMCore/Pass.cpp:1.86 --- llvm/lib/VMCore/Pass.cpp:1.85 Sun Mar 4 18:00:42 2007 +++ llvm/lib/VMCore/Pass.cpp Fri Apr 20 19:12:18 2007 @@ -189,9 +189,19 @@ }; } -static ManagedStatic<PassRegistrar> PassRegistrarObj; static std::vector<PassRegistrationListener*> *Listeners = 0; +// FIXME: This should use ManagedStatic to manage the pass registrar. +// Unfortunately, we can't do this, because passes are registered with static +// ctors, and having llvm_shutdown clear this map prevents successful +// ressurection after llvm_shutdown is run. +static PassRegistrar *getPassRegistrar() { + static PassRegistrar *PassRegistrarObj = 0; + if (!PassRegistrarObj) + PassRegistrarObj = new PassRegistrar(); + return PassRegistrarObj; +} + // getPassInfo - Return the PassInfo data structure that corresponds to this // pass... const PassInfo *Pass::getPassInfo() const { @@ -200,11 +210,11 @@ } const PassInfo *Pass::lookupPassInfo(const std::type_info &TI) { - return PassRegistrarObj->GetPassInfo(TI); + return getPassRegistrar()->GetPassInfo(TI); } void RegisterPassBase::registerPass() { - PassRegistrarObj->RegisterPass(PIObj); + getPassRegistrar()->RegisterPass(PIObj); // Notify any listeners. if (Listeners) @@ -214,7 +224,7 @@ } void RegisterPassBase::unregisterPass() { - PassRegistrarObj->UnregisterPass(PIObj); + getPassRegistrar()->UnregisterPass(PIObj); } //===----------------------------------------------------------------------===// @@ -247,7 +257,7 @@ PassInfo *IIPI = const_cast<PassInfo*>(ImplementationInfo); IIPI->addInterfaceImplemented(InterfaceInfo); - PassRegistrarObj->RegisterAnalysisGroup(InterfaceInfo, IIPI, isDefault); + getPassRegistrar()->RegisterAnalysisGroup(InterfaceInfo, IIPI, isDefault); } } @@ -286,7 +296,7 @@ // passEnumerate callback on each PassInfo object. // void PassRegistrationListener::enumeratePasses() { - PassRegistrarObj->EnumerateWith(this); + getPassRegistrar()->EnumerateWith(this); } //===----------------------------------------------------------------------===// _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits