2001-11-09 05:27:10 +00:00
|
|
|
//===- llvm/Analysis/FindUsedTypes.h - Find all Types in use -----*- C++ -*--=//
|
|
|
|
//
|
|
|
|
// This pass is used to seek out all of the types in use by the program.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_ANALYSIS_FINDUSEDTYPES_H
|
|
|
|
#define LLVM_ANALYSIS_FINDUSEDTYPES_H
|
|
|
|
|
|
|
|
#include "llvm/Pass.h"
|
|
|
|
#include <set>
|
|
|
|
class SymbolTable;
|
2002-01-30 23:27:55 +00:00
|
|
|
class Type;
|
2001-11-09 05:27:10 +00:00
|
|
|
|
2002-01-30 23:27:55 +00:00
|
|
|
class FindUsedTypes : public Pass {
|
2002-01-20 22:54:45 +00:00
|
|
|
std::set<const Type *> UsedTypes;
|
2001-11-09 05:27:10 +00:00
|
|
|
public:
|
2002-09-24 00:07:17 +00:00
|
|
|
/// getTypes - After the pass has been run, return the set containing all of
|
|
|
|
/// the types used in the module.
|
|
|
|
///
|
2002-07-26 21:11:42 +00:00
|
|
|
const std::set<const Type *> &getTypes() const { return UsedTypes; }
|
2001-11-09 05:27:10 +00:00
|
|
|
|
2002-09-24 00:07:17 +00:00
|
|
|
/// Print the types found in the module. If the optional Module parameter is
|
|
|
|
/// passed in, then the types are printed symbolically if possible, using the
|
|
|
|
/// symbol table from the module.
|
|
|
|
///
|
2002-07-27 01:12:15 +00:00
|
|
|
void print(std::ostream &o, const Module *M) const;
|
2001-11-09 05:27:10 +00:00
|
|
|
|
|
|
|
private:
|
2002-09-24 00:07:17 +00:00
|
|
|
/// IncorporateType - Incorporate one type and all of its subtypes into the
|
|
|
|
/// collection of used types.
|
|
|
|
///
|
2001-11-09 05:27:10 +00:00
|
|
|
void IncorporateType(const Type *Ty);
|
|
|
|
|
2001-11-15 15:24:31 +00:00
|
|
|
public:
|
2002-09-24 00:07:17 +00:00
|
|
|
/// run - This incorporates all types used by the specified module
|
2002-06-25 16:13:24 +00:00
|
|
|
bool run(Module &M);
|
2001-11-09 05:27:10 +00:00
|
|
|
|
2002-09-24 00:07:17 +00:00
|
|
|
/// getAnalysisUsage - We do not modify anything.
|
2002-04-27 06:56:12 +00:00
|
|
|
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
|
|
|
|
AU.setPreservesAll();
|
|
|
|
}
|
2002-09-24 00:07:17 +00:00
|
|
|
|
|
|
|
// stub - dummy function, just ignore it
|
|
|
|
static void stub();
|
2001-11-09 05:27:10 +00:00
|
|
|
};
|
|
|
|
|
2002-09-24 00:07:17 +00:00
|
|
|
// Make sure that any clients of this file link in PostDominators.cpp
|
|
|
|
static IncludeFile
|
|
|
|
FIND_USED_TYPES_INCLUDE_FILE((void*)&FindUsedTypes::stub);
|
|
|
|
|
2001-11-09 05:27:10 +00:00
|
|
|
#endif
|