diff options
author | Chris Lattner <sabre@nondot.org> | 2003-10-03 18:46:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-10-03 18:46:24 +0000 |
commit | 0f21ab75fa67d1ab470d12d20d90bb0b104304e4 (patch) | |
tree | 2e2df19ece44a556969ccfb745ee1a69469ad54e /llvm/lib/VMCore/SymbolTable.cpp | |
parent | ad7fd5f1225399667bda0001d9137b0cbe63df74 (diff) | |
download | bcm5719-llvm-0f21ab75fa67d1ab470d12d20d90bb0b104304e4.tar.gz bcm5719-llvm-0f21ab75fa67d1ab470d12d20d90bb0b104304e4.zip |
This checkin basically amounts to a complete rewrite of the type-resolution
machinery. This dramatically simplifies how things works, removes irritating
little corner cases, and overall improves speed and reliability.
Highlights of this change are:
1. The exponential algorithm built into the code is now gone. For example
the time to disassemble one bytecode file from the mesa benchmark went
from taking 12.5s to taking 0.16s.
2. The linker bugs should be dramatically reduced. The one remaining bug
has to do with constant handling, which I actually introduced in
"union-find" checkins.
3. The code is much easier to follow, as a result of fewer special cases.
It's probably also smaller. yaay.
llvm-svn: 8842
Diffstat (limited to 'llvm/lib/VMCore/SymbolTable.cpp')
-rw-r--r-- | llvm/lib/VMCore/SymbolTable.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/llvm/lib/VMCore/SymbolTable.cpp b/llvm/lib/VMCore/SymbolTable.cpp index bebc26c15df..9def6cb5122 100644 --- a/llvm/lib/VMCore/SymbolTable.cpp +++ b/llvm/lib/VMCore/SymbolTable.cpp @@ -195,7 +195,7 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType, // Search to see if we have any values of the type oldtype. If so, we need to // move them into the newtype plane... iterator TPI = find(OldType); - if (OldType != NewType && TPI != end()) { + if (TPI != end()) { // Get a handle to the new type plane... iterator NewTypeIt = find(NewType); if (NewTypeIt == super::end()) { // If no plane exists, add one @@ -281,12 +281,6 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType, // Remove the plane that is no longer used erase(TPI); - } else if (TPI != end()) { - assert(OldType == NewType); -#if DEBUG_ABSTYPE - std::cerr << "Removing SELF type " << OldType->getDescription() << "\n"; -#endif - OldType->removeAbstractTypeUser(this); } TPI = find(Type::TypeTy); @@ -315,6 +309,27 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType, } } +void SymbolTable::typeBecameConcrete(const DerivedType *AbsTy) { + iterator TPI = find(AbsTy); + + // If there are any values in the symbol table of this type, then the type + // plan is a use of the abstract type which must be dropped. + if (TPI != end()) + AbsTy->removeAbstractTypeUser(this); + + TPI = find(Type::TypeTy); + if (TPI != end()) { + // Loop over all of the types in the symbol table, dropping any abstract + // type user entries for AbsTy which occur because there are names for the + // type. + // + VarMap &TyPlane = TPI->second; + for (VarMap::iterator I = TyPlane.begin(), E = TyPlane.end(); I != E; ++I) + if (I->second == (Value*)AbsTy) // FIXME when Types aren't const. + AbsTy->removeAbstractTypeUser(this); + } +} + static void DumpVal(const std::pair<const std::string, Value *> &V) { std::cout << " '" << V.first << "' = "; V.second->dump(); |