PageRenderTime 19ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/3rd_party/llvm/include/llvm/Analysis/FindUsedTypes.h

https://code.google.com/p/softart/
C++ Header | 66 lines | 27 code | 13 blank | 26 comment | 0 complexity | 68ee5b2afad5e690653093f5e2123ddd MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, JSON, MPL-2.0-no-copyleft-exception, GPL-2.0, GPL-3.0, LGPL-3.0, BSD-2-Clause
 1//===- llvm/Analysis/FindUsedTypes.h - Find all Types in use ----*- C++ -*-===//
 2//
 3//                     The LLVM Compiler Infrastructure
 4//
 5// This file is distributed under the University of Illinois Open Source
 6// License. See LICENSE.TXT for details.
 7//
 8//===----------------------------------------------------------------------===//
 9//
10// This pass is used to seek out all of the types in use by the program.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_ANALYSIS_FINDUSEDTYPES_H
15#define LLVM_ANALYSIS_FINDUSEDTYPES_H
16
17#include "llvm/ADT/SetVector.h"
18#include "llvm/Pass.h"
19
20namespace llvm {
21
22class Type;
23class Value;
24
25class FindUsedTypes : public ModulePass {
26  SetVector<Type *> UsedTypes;
27public:
28  static char ID; // Pass identification, replacement for typeid
29  FindUsedTypes() : ModulePass(ID) {
30    initializeFindUsedTypesPass(*PassRegistry::getPassRegistry());
31  }
32
33  /// getTypes - After the pass has been run, return the set containing all of
34  /// the types used in the module.
35  ///
36  const SetVector<Type *> &getTypes() const { return UsedTypes; }
37
38  /// Print the types found in the module.  If the optional Module parameter is
39  /// passed in, then the types are printed symbolically if possible, using the
40  /// symbol table from the module.
41  ///
42  void print(raw_ostream &o, const Module *M) const;
43
44private:
45  /// IncorporateType - Incorporate one type and all of its subtypes into the
46  /// collection of used types.
47  ///
48  void IncorporateType(Type *Ty);
49
50  /// IncorporateValue - Incorporate all of the types used by this value.
51  ///
52  void IncorporateValue(const Value *V);
53
54public:
55  /// run - This incorporates all types used by the specified module
56  bool runOnModule(Module &M);
57
58  /// getAnalysisUsage - We do not modify anything.
59  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
60    AU.setPreservesAll();
61  }
62};
63
64} // End llvm namespace
65
66#endif