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