From 0f7eea5d0401a3aaff27d2fdb34044e5983db3d1 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Sat, 17 Jul 2004 23:53:23 +0000 Subject: [PATCH] bug 122: - Module doesn't need to manage ConstantPointerRefs any more. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14931 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Module.cpp | 45 ------------------------------------------- 1 file changed, 45 deletions(-) diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp index 8331eacd691..13493cac3bf 100644 --- a/lib/VMCore/Module.cpp +++ b/lib/VMCore/Module.cpp @@ -56,17 +56,6 @@ iplist &ilist_traits::getList(Module *M) { template class SymbolTableListTraits; template class SymbolTableListTraits; -// Define the GlobalValueRefMap as a struct that wraps a map so that we don't -// have Module.h depend on -// -namespace llvm { - struct GlobalValueRefMap { - typedef std::map MapTy; - typedef MapTy::iterator iterator; - std::map Map; - }; -} - //===----------------------------------------------------------------------===// // Primitive Module methods. // @@ -77,7 +66,6 @@ Module::Module(const std::string &MID) FunctionList.setParent(this); GlobalList.setItemParent(this); GlobalList.setParent(this); - GVRefMap = 0; SymTab = new SymbolTable(); } @@ -300,38 +288,5 @@ void Module::dropAllReferences() { for(Module::giterator I = gbegin(), E = gend(); I != E; ++I) I->dropAllReferences(); - - // If there are any GlobalVariable references still out there, nuke them now. - // Since all references are hereby dropped, nothing could possibly reference - // them still. Note that destroying all of the constant pointer refs will - // eventually cause the GVRefMap field to be set to null (by - // destroyConstantPointerRef, below). - // - while (GVRefMap) - // Delete the ConstantPointerRef node... - GVRefMap->Map.begin()->second->destroyConstant(); } -// Accessor for the underlying GlobalValRefMap... -ConstantPointerRef *Module::getConstantPointerRef(GlobalValue *V){ - // Create ref map lazily on demand... - if (GVRefMap == 0) GVRefMap = new GlobalValueRefMap(); - - GlobalValueRefMap::iterator I = GVRefMap->Map.find(V); - if (I != GVRefMap->Map.end()) return I->second; - - ConstantPointerRef *Ref = new ConstantPointerRef(V); - GVRefMap->Map[V] = Ref; - return Ref; -} - -void Module::destroyConstantPointerRef(ConstantPointerRef *CPR) { - assert(GVRefMap && "No map allocated, but we have a CPR?"); - if (!GVRefMap->Map.erase(CPR->getValue())) // Remove it from the map... - assert(0 && "ConstantPointerRef not found in module CPR map!"); - - if (GVRefMap->Map.empty()) { // If the map is empty, delete it. - delete GVRefMap; - GVRefMap = 0; - } -} -- 2.34.1