1 //===- llvm/CodeGen/RegAllocRegistry.h --------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the implementation for register allocator function
11 // pass registry (RegisterRegAlloc).
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_CODEGEN_REGALLOCREGISTRY_H
16 #define LLVM_CODEGEN_REGALLOCREGISTRY_H
18 #include "llvm/CodeGen/MachinePassRegistry.h"
24 //===----------------------------------------------------------------------===//
26 /// RegisterRegAlloc class - Track the registration of register allocators.
28 //===----------------------------------------------------------------------===//
29 class RegisterRegAlloc : public MachinePassRegistryNode {
31 using FunctionPassCtor = FunctionPass *(*)();
33 static MachinePassRegistry Registry;
35 RegisterRegAlloc(const char *N, const char *D, FunctionPassCtor C)
36 : MachinePassRegistryNode(N, D, (MachinePassCtor)C) {
40 ~RegisterRegAlloc() { Registry.Remove(this); }
43 RegisterRegAlloc *getNext() const {
44 return (RegisterRegAlloc *)MachinePassRegistryNode::getNext();
47 static RegisterRegAlloc *getList() {
48 return (RegisterRegAlloc *)Registry.getList();
51 static FunctionPassCtor getDefault() {
52 return (FunctionPassCtor)Registry.getDefault();
55 static void setDefault(FunctionPassCtor C) {
56 Registry.setDefault((MachinePassCtor)C);
59 static void setListener(MachinePassRegistryListener *L) {
60 Registry.setListener(L);
64 } // end namespace llvm
66 #endif // LLVM_CODEGEN_REGALLOCREGISTRY_H