Remove some really gross and hard to understand code now that

InternallyInconsistent is always false.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20477 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-03-06 05:21:40 +00:00
parent ee4da939b0
commit a98cbe57ea

View File

@ -94,7 +94,6 @@ Type* SymbolTable::lookupType( const std::string& Name ) const {
// Remove a value // Remove a value
void SymbolTable::remove(Value *N) { void SymbolTable::remove(Value *N) {
assert(N->hasName() && "Value doesn't have name!"); assert(N->hasName() && "Value doesn't have name!");
if (InternallyInconsistent) return;
plane_iterator PI = pmap.find(N->getType()); plane_iterator PI = pmap.find(N->getType());
assert(PI != pmap.end() && assert(PI != pmap.end() &&
@ -115,15 +114,11 @@ void SymbolTable::changeName(Value *V, const std::string &name) {
assert(PI != pmap.end() && "Value doesn't have an entry in this table?"); assert(PI != pmap.end() && "Value doesn't have an entry in this table?");
ValueMap &VM = PI->second; ValueMap &VM = PI->second;
value_iterator VI; value_iterator VI = VM.find(V->getName());
assert(VI != VM.end() && "Value does have an entry in this table?");
if (!InternallyInconsistent) { // Remove the old entry.
VI = VM.find(V->getName()); VM.erase(VI);
assert(VI != VM.end() && "Value does have an entry in this table?");
// Remove the old entry.
VM.erase(VI);
}
// See if we can insert the new name. // See if we can insert the new name.
VI = VM.lower_bound(name); VI = VM.lower_bound(name);
@ -141,7 +136,6 @@ void SymbolTable::changeName(Value *V, const std::string &name) {
// removeEntry - Remove a value from the symbol table... // removeEntry - Remove a value from the symbol table...
Value *SymbolTable::removeEntry(plane_iterator Plane, value_iterator Entry) { Value *SymbolTable::removeEntry(plane_iterator Plane, value_iterator Entry) {
if (InternallyInconsistent) return 0;
assert(Plane != pmap.end() && assert(Plane != pmap.end() &&
Entry != Plane->second.end() && "Invalid entry to remove!"); Entry != Plane->second.end() && "Invalid entry to remove!");
@ -189,7 +183,6 @@ void SymbolTable::remove(const Type* Ty ) {
// removeEntry - Remove a type from the symbol table... // removeEntry - Remove a type from the symbol table...
Type* SymbolTable::removeEntry(type_iterator Entry) { Type* SymbolTable::removeEntry(type_iterator Entry) {
if (InternallyInconsistent) return 0;
assert( Entry != tmap.end() && "Invalid entry to remove!"); assert( Entry != tmap.end() && "Invalid entry to remove!");
const Type* Result = Entry->second; const Type* Result = Entry->second;
@ -249,11 +242,8 @@ void SymbolTable::insertEntry(const std::string &Name, const Type *VTy,
VM = &PI->second; VM = &PI->second;
VI = VM->lower_bound(Name); VI = VM->lower_bound(Name);
if (VI != VM->end() && VI->first == Name) { if (VI != VM->end() && VI->first == Name) {
std::string UniqueName = getUniqueName(VTy, Name); V->Name = getUniqueName(VTy, Name);
assert(InternallyInconsistent == false && VM->insert(make_pair(V->Name, V));
"Infinite loop inserting value!");
V->Name = UniqueName;
VM->insert(VI, make_pair(UniqueName, V));
return; return;
} }
} }
@ -371,17 +361,6 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType,
// one use the old one... // one use the old one...
NewGV->uncheckedReplaceAllUsesWith(ExistGV); NewGV->uncheckedReplaceAllUsesWith(ExistGV);
// Now we just convert it to an unnamed method... which won't get
// added to our symbol table. The problem is that if we call
// setName on the method that it will try to remove itself from
// the symbol table and die... because it's not in the symtab
// right now. To fix this, we have an internally consistent flag
// that turns remove into a noop. Thus the name will get null'd
// out, but the symbol table won't get upset.
//
assert(InternallyInconsistent == false &&
"Symbol table already inconsistent!");
// Update NewGV's name, we're about the remove it from the symbol // Update NewGV's name, we're about the remove it from the symbol
// table. // table.
NewGV->Name = ""; NewGV->Name = "";