[llvm-commits] CVS: llvm/lib/VMCore/Module.cpp
LLVM
llvm at cs.uiuc.edu
Sat Jul 17 16:53:33 PDT 2004
Changes in directory llvm/lib/VMCore:
Module.cpp updated: 1.52 -> 1.53
---
Log message:
bug 122: http://llvm.cs.uiuc.edu/PR122 :
- Module doesn't need to manage ConstantPointerRefs any more.
---
Diffs of the changes: (+1 -46)
Index: llvm/lib/VMCore/Module.cpp
diff -u llvm/lib/VMCore/Module.cpp:1.52 llvm/lib/VMCore/Module.cpp:1.53
--- llvm/lib/VMCore/Module.cpp:1.52 Sat Jul 10 11:37:42 2004
+++ llvm/lib/VMCore/Module.cpp Sat Jul 17 18:53:23 2004
@@ -56,17 +56,6 @@
template class SymbolTableListTraits<GlobalVariable, Module, Module>;
template class SymbolTableListTraits<Function, Module, Module>;
-// Define the GlobalValueRefMap as a struct that wraps a map so that we don't
-// have Module.h depend on <map>
-//
-namespace llvm {
- struct GlobalValueRefMap {
- typedef std::map<GlobalValue*, ConstantPointerRef*> MapTy;
- typedef MapTy::iterator iterator;
- std::map<GlobalValue*, ConstantPointerRef*> Map;
- };
-}
-
//===----------------------------------------------------------------------===//
// Primitive Module methods.
//
@@ -77,7 +66,6 @@
FunctionList.setParent(this);
GlobalList.setItemParent(this);
GlobalList.setParent(this);
- GVRefMap = 0;
SymTab = new SymbolTable();
}
@@ -300,38 +288,5 @@
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;
- }
}
+
More information about the llvm-commits
mailing list