Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
3.2 KiB

  1. //===- llvm/PassRegistry.h - Pass Information Registry ----------*- 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 file defines PassRegistry, a class that is used in the initialization
  11. // and registration of passes. At application startup, passes are registered
  12. // with the PassRegistry, which is later provided to the PassManager for
  13. // dependency resolution and similar tasks.
  14. //
  15. //===----------------------------------------------------------------------===//
  16. #ifndef LLVM_PASSREGISTRY_H
  17. #define LLVM_PASSREGISTRY_H
  18. #include "llvm/ADT/StringRef.h"
  19. namespace llvm {
  20. class PassInfo;
  21. struct PassRegistrationListener;
  22. /// PassRegistry - This class manages the registration and intitialization of
  23. /// the pass subsystem as application startup, and assists the PassManager
  24. /// in resolving pass dependencies.
  25. /// NOTE: PassRegistry is NOT thread-safe. If you want to use LLVM on multiple
  26. /// threads simultaneously, you will need to use a separate PassRegistry on
  27. /// each thread.
  28. class PassRegistry {
  29. mutable void *pImpl;
  30. void *getImpl() const;
  31. public:
  32. PassRegistry() : pImpl(0) { }
  33. ~PassRegistry();
  34. /// getPassRegistry - Access the global registry object, which is
  35. /// automatically initialized at application launch and destroyed by
  36. /// llvm_shutdown.
  37. static PassRegistry *getPassRegistry();
  38. /// getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass'
  39. /// type identifier (&MyPass::ID).
  40. const PassInfo *getPassInfo(const void *TI) const;
  41. /// getPassInfo - Look up a pass' corresponding PassInfo, indexed by the pass'
  42. /// argument string.
  43. const PassInfo *getPassInfo(StringRef Arg) const;
  44. /// registerPass - Register a pass (by means of its PassInfo) with the
  45. /// registry. Required in order to use the pass with a PassManager.
  46. void registerPass(const PassInfo &PI, bool ShouldFree = false);
  47. /// registerPass - Unregister a pass (by means of its PassInfo) with the
  48. /// registry.
  49. void unregisterPass(const PassInfo &PI);
  50. /// registerAnalysisGroup - Register an analysis group (or a pass implementing
  51. // an analysis group) with the registry. Like registerPass, this is required
  52. // in order for a PassManager to be able to use this group/pass.
  53. void registerAnalysisGroup(const void *InterfaceID, const void *PassID,
  54. PassInfo& Registeree, bool isDefault,
  55. bool ShouldFree = false);
  56. /// enumerateWith - Enumerate the registered passes, calling the provided
  57. /// PassRegistrationListener's passEnumerate() callback on each of them.
  58. void enumerateWith(PassRegistrationListener *L);
  59. /// addRegistrationListener - Register the given PassRegistrationListener
  60. /// to receive passRegistered() callbacks whenever a new pass is registered.
  61. void addRegistrationListener(PassRegistrationListener *L);
  62. /// removeRegistrationListener - Unregister a PassRegistrationListener so that
  63. /// it no longer receives passRegistered() callbacks.
  64. void removeRegistrationListener(PassRegistrationListener *L);
  65. };
  66. }
  67. #endif