1 //===- llvm/Analysis/FindUsedTypes.h - Find all Types in use ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This pass is used to seek out all of the types in use by the program.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_ANALYSIS_FINDUSEDTYPES_H
15 #define LLVM_ANALYSIS_FINDUSEDTYPES_H
17 #include "llvm/Pass.h"
22 class FindUsedTypes : public Pass {
23 std::set<const Type *> UsedTypes;
25 /// getTypes - After the pass has been run, return the set containing all of
26 /// the types used in the module.
28 const std::set<const Type *> &getTypes() const { return UsedTypes; }
30 /// Print the types found in the module. If the optional Module parameter is
31 /// passed in, then the types are printed symbolically if possible, using the
32 /// symbol table from the module.
34 void print(std::ostream &o, const Module *M) const;
37 /// IncorporateType - Incorporate one type and all of its subtypes into the
38 /// collection of used types.
40 void IncorporateType(const Type *Ty);
42 /// IncorporateSymbolTable - Include any named types.
44 void IncorporateSymbolTable(const SymbolTable &ST);
47 /// run - This incorporates all types used by the specified module
50 /// getAnalysisUsage - We do not modify anything.
51 virtual void getAnalysisUsage(AnalysisUsage &AU) const {
55 // stub - dummy function, just ignore it
59 // Make sure that any clients of this file link in PostDominators.cpp
61 FIND_USED_TYPES_INCLUDE_FILE((void*)&FindUsedTypes::stub);