aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Criswell <criswell@uiuc.edu>2003-10-24 13:28:12 +0000
committerJohn Criswell <criswell@uiuc.edu>2003-10-24 13:28:12 +0000
commitfaa1d1f04da3f9e1766d63f0a8b32382581030e4 (patch)
tree5d4df78c1b0064d7e9a49ae6393ac0337c06bf2c
parent0d6d28b38f51e1df4c80c378dbee2cd3d0f55795 (diff)
downloadllvm-faa1d1f04da3f9e1766d63f0a8b32382581030e4.zip
llvm-faa1d1f04da3f9e1766d63f0a8b32382581030e4.tar.gz
llvm-faa1d1f04da3f9e1766d63f0a8b32382581030e4.tar.bz2
Merged revision 1.21.
llvm-svn: 9462
-rw-r--r--llvm/lib/Analysis/IPA/FindUsedTypes.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/IPA/FindUsedTypes.cpp b/llvm/lib/Analysis/IPA/FindUsedTypes.cpp
index ad548d0..91b5990 100644
--- a/llvm/lib/Analysis/IPA/FindUsedTypes.cpp
+++ b/llvm/lib/Analysis/IPA/FindUsedTypes.cpp
@@ -41,12 +41,22 @@ void FindUsedTypes::IncorporateType(const Type *Ty) {
IncorporateType(*I);
}
+void FindUsedTypes::IncorporateSymbolTable(const SymbolTable &ST) {
+ SymbolTable::const_iterator TI = ST.find(Type::TypeTy);
+ if (TI == ST.end()) return; // No named types
+
+ for (SymbolTable::type_const_iterator I = TI->second.begin(),
+ E = TI->second.end(); I != E; ++I)
+ IncorporateType(cast<Type>(I->second));
+}
// run - This incorporates all types used by the specified module
//
bool FindUsedTypes::run(Module &m) {
UsedTypes.clear(); // reset if run multiple times...
+ IncorporateSymbolTable(m.getSymbolTable());
+
// Loop over global variables, incorporating their types
for (Module::const_giterator I = m.gbegin(), E = m.gend(); I != E; ++I)
IncorporateType(I->getType());
@@ -54,6 +64,7 @@ bool FindUsedTypes::run(Module &m) {
for (Module::iterator MI = m.begin(), ME = m.end(); MI != ME; ++MI) {
IncorporateType(MI->getType());
const Function &F = *MI;
+ IncorporateSymbolTable(F.getSymbolTable());
// Loop over all of the instructions in the function, adding their return
// type as well as the types of their operands.