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 | 7685ac8d35a0c74f6d341f9589fdaedcd1564310 (patch) | |
tree | b31bf215cde3f8cd28024c18692f3c26ca58a73c /lib/VMCore/SymbolTable.cpp | |
parent | 4797826e17d77e2f2aec2695ec3618ca237c463b (diff) | |
download | external_llvm-7685ac8d35a0c74f6d341f9589fdaedcd1564310.zip external_llvm-7685ac8d35a0c74f6d341f9589fdaedcd1564310.tar.gz external_llvm-7685ac8d35a0c74f6d341f9589fdaedcd1564310.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8842 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/SymbolTable.cpp')
-rw-r--r-- | lib/VMCore/SymbolTable.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp index bebc26c..9def6cb 100644 --- a/lib/VMCore/SymbolTable.cpp +++ b/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(); |