aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/ValueSymbolTable.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-02-05 20:47:22 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-02-05 20:47:22 +0000
commitef9b9a793949469cdaa4ab6d0173136229dcab7b (patch)
tree137b30d24ba219e5e745a11abb3807a9c4964aaa /lib/VMCore/ValueSymbolTable.cpp
parent15468bfc22302b4f79300252425d74cd6865f8b1 (diff)
For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does not support types planes. This means that all symbol names in LLVM must now be unique. The patch addresses the necessary changes to deal with this and removes code no longer needed as a result. This completes the bulk of the changes for this PR. Some cleanup patches will follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33918 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ValueSymbolTable.cpp')
-rw-r--r--lib/VMCore/ValueSymbolTable.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/lib/VMCore/ValueSymbolTable.cpp b/lib/VMCore/ValueSymbolTable.cpp
index 6efb998387..51197b6bf3 100644
--- a/lib/VMCore/ValueSymbolTable.cpp
+++ b/lib/VMCore/ValueSymbolTable.cpp
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#define DEBUG_TYPE "valuesymtab"
#include "llvm/GlobalValue.h"
#include "llvm/Type.h"
#include "llvm/ValueSymbolTable.h"
@@ -19,18 +20,15 @@
#include <algorithm>
using namespace llvm;
-#define DEBUG_SYMBOL_TABLE 0
-#define DEBUG_ABSTYPE 0
-
// Class destructor
ValueSymbolTable::~ValueSymbolTable() {
#ifndef NDEBUG // Only do this in -g mode...
bool LeftoverValues = true;
for (iterator VI = vmap.begin(), VE = vmap.end(); VI != VE; ++VI)
if (!isa<Constant>(VI->second) ) {
- DOUT << "Value still in symbol table! Type = '"
+ DEBUG(DOUT << "Value still in symbol table! Type = '"
<< VI->second->getType()->getDescription() << "' Name = '"
- << VI->first << "'\n";
+ << VI->first << "'\n");
LeftoverValues = false;
}
assert(LeftoverValues && "Values remain in symbol table!");
@@ -83,29 +81,24 @@ void ValueSymbolTable::insert(Value* V) {
assert(V && "Can't insert null Value into symbol table!");
assert(V->hasName() && "Can't insert nameless Value into symbol table");
- // Check to see if there is a naming conflict. If so, rename this type!
+ // Check to see if there is a naming conflict. If so, rename this value
std::string UniqueName = getUniqueName(V->getName());
-#if DEBUG_SYMBOL_TABLE
- dump();
- DOUT << " Inserting value: " << UniqueName << ": " << V->dump() << "\n";
-#endif
+ DEBUG(DOUT << " Inserting value: " << UniqueName << ": " << *V << "\n");
// Insert the vmap entry
- vmap.insert(make_pair(UniqueName, V));
+ V->Name = UniqueName;
+ vmap.insert(make_pair(V->Name, V));
}
// Remove a value
-bool ValueSymbolTable::erase(Value *V) {
+bool ValueSymbolTable::remove(Value *V) {
assert(V->hasName() && "Value doesn't have name!");
iterator Entry = vmap.find(V->getName());
if (Entry == vmap.end())
return false;
-#if DEBUG_SYMBOL_TABLE
- dump();
- DOUT << " Removing Value: " << Entry->second->getName() << "\n";
-#endif
+ DEBUG(DOUT << " Removing Value: " << Entry->second->getName() << "\n");
// Remove the value from the plane...
vmap.erase(Entry);
@@ -143,7 +136,7 @@ bool ValueSymbolTable::rename(Value *V, const std::string &name) {
vmap.insert(make_pair(V->Name, V));
} else {
V->Name = name;
- vmap.insert(VI, make_pair(name, V));
+ vmap.insert(VI, make_pair(V->Name, V));
}
return true;