LLVM  13.0.0git
RegAllocRegistry.h
Go to the documentation of this file.
1 //===- llvm/CodeGen/RegAllocRegistry.h --------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file contains the implementation for register allocator function
10 // pass registry (RegisterRegAlloc).
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CODEGEN_REGALLOCREGISTRY_H
15 #define LLVM_CODEGEN_REGALLOCREGISTRY_H
16 
18 
19 namespace llvm {
20 
21 class FunctionPass;
22 
23 //===----------------------------------------------------------------------===//
24 ///
25 /// RegisterRegAllocBase class - Track the registration of register allocators.
26 ///
27 //===----------------------------------------------------------------------===//
28 template <class SubClass>
29 class RegisterRegAllocBase : public MachinePassRegistryNode<FunctionPass *(*)()> {
30 public:
32 
34 
35  RegisterRegAllocBase(const char *N, const char *D, FunctionPassCtor C)
37  Registry.Add(this);
38  }
39 
40  ~RegisterRegAllocBase() { Registry.Remove(this); }
41 
42  // Accessors.
43  SubClass *getNext() const {
44  return static_cast<SubClass *>(MachinePassRegistryNode::getNext());
45  }
46 
47  static SubClass *getList() {
48  return static_cast<SubClass *>(Registry.getList());
49  }
50 
51  static FunctionPassCtor getDefault() { return Registry.getDefault(); }
52 
53  static void setDefault(FunctionPassCtor C) { Registry.setDefault(C); }
54 
56  Registry.setListener(L);
57  }
58 };
59 
60 class RegisterRegAlloc : public RegisterRegAllocBase<RegisterRegAlloc> {
61 public:
62  RegisterRegAlloc(const char *N, const char *D, FunctionPassCtor C)
63  : RegisterRegAllocBase(N, D, C) {}
64 };
65 
66 /// RegisterRegAlloc's global Registry tracks allocator registration.
67 template <class T>
68 MachinePassRegistry<RegisterRegAlloc::FunctionPassCtor>
70 
71 } // end namespace llvm
72 
73 #endif // LLVM_CODEGEN_REGALLOCREGISTRY_H
llvm::RegisterRegAllocBase::setDefault
static void setDefault(FunctionPassCtor C)
Definition: RegAllocRegistry.h:53
llvm
Definition: AllocatorList.h:23
MachinePassRegistry.h
llvm::MachinePassRegistryListener< FunctionPassCtor >
llvm::RegisterRegAlloc
Definition: RegAllocRegistry.h:60
llvm::RegisterRegAllocBase::RegisterRegAllocBase
RegisterRegAllocBase(const char *N, const char *D, FunctionPassCtor C)
Definition: RegAllocRegistry.h:35
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::MachinePassRegistryNode
MachinePassRegistryNode - Machine pass node stored in registration list.
Definition: MachinePassRegistry.h:48
llvm::RegisterRegAllocBase::setListener
static void setListener(MachinePassRegistryListener< FunctionPassCtor > *L)
Definition: RegAllocRegistry.h:55
llvm::RegisterRegAllocBase::Registry
static MachinePassRegistry< FunctionPassCtor > Registry
RegisterRegAlloc's global Registry tracks allocator registration.
Definition: RegAllocRegistry.h:33
llvm::RegisterRegAlloc::RegisterRegAlloc
RegisterRegAlloc(const char *N, const char *D, FunctionPassCtor C)
Definition: RegAllocRegistry.h:62
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::RegisterRegAllocBase< RegisterRegAlloc >::FunctionPassCtor
FunctionPass *(*)() FunctionPassCtor
Definition: RegAllocRegistry.h:31
llvm::RegisterRegAllocBase::getDefault
static FunctionPassCtor getDefault()
Definition: RegAllocRegistry.h:51
llvm::MachinePassRegistry< FunctionPassCtor >
llvm::RegisterRegAllocBase::getList
static SubClass * getList()
Definition: RegAllocRegistry.h:47
llvm::RegisterRegAllocBase::getNext
SubClass * getNext() const
Definition: RegAllocRegistry.h:43
llvm::RegisterRegAllocBase
RegisterRegAllocBase class - Track the registration of register allocators.
Definition: RegAllocRegistry.h:29
llvm::Registry
A global registry used in conjunction with static constructors to make pluggable components (like tar...
Definition: Registry.h:44
N
#define N
llvm::Registry::Add
A static registration template.
Definition: Registry.h:114
llvm::MachinePassRegistryNode::getNext
MachinePassRegistryNode * getNext() const
Definition: MachinePassRegistry.h:60
llvm::FunctionPass
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:298
llvm::RegisterRegAllocBase::~RegisterRegAllocBase
~RegisterRegAllocBase()
Definition: RegAllocRegistry.h:40