Add support for variable argument functions!
[oota-llvm.git] / lib / Analysis / IPA / FindUsedTypes.cpp
index 8cfe1085a3acd2f97607702723e44d310d1d68b9..0916ab8c65f2a5cd427331bd11646a0dfe20871c 100644 (file)
 #include "llvm/Module.h"
 #include "llvm/Support/InstIterator.h"
 
-AnalysisID FindUsedTypes::ID(AnalysisID::create<FindUsedTypes>());
-AnalysisID FindUsedTypes::IncludeSymbolTableID(AnalysisID::create<FindUsedTypes>());
+static RegisterAnalysis<FindUsedTypes>
+X("printusedtypes", "Find Used Types");
+
+// stub to help linkage
+void FindUsedTypes::stub() {}
 
 // IncorporateType - Incorporate one type and all of its subtypes into the
 // collection of used types.
@@ -31,29 +34,18 @@ void FindUsedTypes::IncorporateType(const Type *Ty) {
     IncorporateType(*I);
 }
 
-// IncorporateSymbolTable - Add all types referenced by the specified symtab
-// into the collection of used types.
-//
-void FindUsedTypes::IncorporateSymbolTable(const SymbolTable *ST) {
-  assert(0 && "Unimp");
-}
 
 // run - This incorporates all types used by the specified module
 //
 bool FindUsedTypes::run(Module &m) {
   UsedTypes.clear();  // reset if run multiple times...
 
-  if (IncludeSymbolTables && m.hasSymbolTable())
-    IncorporateSymbolTable(m.getSymbolTable()); // Add symtab first...
-
   // Loop over global variables, incorporating their types
   for (Module::const_giterator I = m.gbegin(), E = m.gend(); I != E; ++I)
     IncorporateType(I->getType());
 
   for (Module::iterator MI = m.begin(), ME = m.end(); MI != ME; ++MI) {
     const Function &F = *MI;
-    if (IncludeSymbolTables && F.hasSymbolTable())
-      IncorporateSymbolTable(F.getSymbolTable()); // Add symtab first...
   
     // Loop over all of the instructions in the function, adding their return
     // type as well as the types of their operands.
@@ -78,7 +70,7 @@ bool FindUsedTypes::run(Module &m) {
 // passed in, then the types are printed symbolically if possible, using the
 // symbol table from the module.
 //
-void FindUsedTypes::printTypes(std::ostream &o, const Module *M = 0) const {
+void FindUsedTypes::print(std::ostream &o, const Module *M) const {
   o << "Types in use by this module:\n";
   if (M) {
     CachedWriter CW(M, o);