RegAllocRegistry.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //===-- llvm/CodeGen/RegAllocRegistry.h -------------------------*- 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 contains the implementation for register allocator function
  11. // pass registry (RegisterRegAlloc).
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_CODEGEN_REGALLOCREGISTRY_H
  15. #define LLVM_CODEGEN_REGALLOCREGISTRY_H
  16. #include "llvm/CodeGen/MachinePassRegistry.h"
  17. namespace llvm {
  18. //===----------------------------------------------------------------------===//
  19. ///
  20. /// RegisterRegAlloc class - Track the registration of register allocators.
  21. ///
  22. // //
  23. ///////////////////////////////////////////////////////////////////////////////
  24. class RegisterRegAlloc : public MachinePassRegistryNode {
  25. public:
  26. typedef FunctionPass *(*FunctionPassCtor)();
  27. static MachinePassRegistry Registry;
  28. RegisterRegAlloc(const char *N, const char *D, FunctionPassCtor C)
  29. : MachinePassRegistryNode(N, D, (MachinePassCtor)C)
  30. {
  31. Registry.Add(this);
  32. }
  33. ~RegisterRegAlloc() { Registry.Remove(this); }
  34. // Accessors.
  35. //
  36. RegisterRegAlloc *getNext() const {
  37. return (RegisterRegAlloc *)MachinePassRegistryNode::getNext();
  38. }
  39. static RegisterRegAlloc *getList() {
  40. return (RegisterRegAlloc *)Registry.getList();
  41. }
  42. static FunctionPassCtor getDefault() {
  43. return (FunctionPassCtor)Registry.getDefault();
  44. }
  45. static void setDefault(FunctionPassCtor C) {
  46. Registry.setDefault((MachinePassCtor)C);
  47. }
  48. static void setListener(MachinePassRegistryListener *L) {
  49. Registry.setListener(L);
  50. }
  51. };
  52. } // end namespace llvm
  53. #endif