LLVM  14.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 
19 
20 namespace llvm {
21 
22 class FunctionPass;
23 
24 //===----------------------------------------------------------------------===//
25 ///
26 /// RegisterRegAllocBase class - Track the registration of register allocators.
27 ///
28 //===----------------------------------------------------------------------===//
29 template <class SubClass>
30 class RegisterRegAllocBase : public MachinePassRegistryNode<FunctionPass *(*)()> {
31 public:
33 
35 
36  RegisterRegAllocBase(const char *N, const char *D, FunctionPassCtor C)
38  Registry.Add(this);
39  }
40 
41  ~RegisterRegAllocBase() { Registry.Remove(this); }
42 
43  // Accessors.
44  SubClass *getNext() const {
45  return static_cast<SubClass *>(MachinePassRegistryNode::getNext());
46  }
47 
48  static SubClass *getList() {
49  return static_cast<SubClass *>(Registry.getList());
50  }
51 
52  static FunctionPassCtor getDefault() { return Registry.getDefault(); }
53 
54  static void setDefault(FunctionPassCtor C) { Registry.setDefault(C); }
55 
57  Registry.setListener(L);
58  }
59 };
60 
61 class RegisterRegAlloc : public RegisterRegAllocBase<RegisterRegAlloc> {
62 public:
63  RegisterRegAlloc(const char *N, const char *D, FunctionPassCtor C)
64  : RegisterRegAllocBase(N, D, C) {}
65 };
66 
67 /// RegisterRegAlloc's global Registry tracks allocator registration.
68 template <class T>
69 MachinePassRegistry<RegisterRegAlloc::FunctionPassCtor>
71 
72 } // end namespace llvm
73 
74 #endif // LLVM_CODEGEN_REGALLOCREGISTRY_H
llvm::RegisterRegAllocBase::setDefault
static void setDefault(FunctionPassCtor C)
Definition: RegAllocRegistry.h:54
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
RegAllocCommon.h
MachinePassRegistry.h
llvm::MachinePassRegistryListener< FunctionPassCtor >
llvm::RegisterRegAlloc
Definition: RegAllocRegistry.h:61
llvm::RegisterRegAllocBase::RegisterRegAllocBase
RegisterRegAllocBase(const char *N, const char *D, FunctionPassCtor C)
Definition: RegAllocRegistry.h:36
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:56
llvm::RegisterRegAllocBase::Registry
static MachinePassRegistry< FunctionPassCtor > Registry
RegisterRegAlloc's global Registry tracks allocator registration.
Definition: RegAllocRegistry.h:34
llvm::RegisterRegAlloc::RegisterRegAlloc
RegisterRegAlloc(const char *N, const char *D, FunctionPassCtor C)
Definition: RegAllocRegistry.h:63
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::RegisterRegAllocBase< RegisterRegAlloc >::FunctionPassCtor
FunctionPass *(*)() FunctionPassCtor
Definition: RegAllocRegistry.h:32
llvm::RegisterRegAllocBase::getDefault
static FunctionPassCtor getDefault()
Definition: RegAllocRegistry.h:52
llvm::MachinePassRegistry< FunctionPassCtor >
llvm::RegisterRegAllocBase::getList
static SubClass * getList()
Definition: RegAllocRegistry.h:48
llvm::RegisterRegAllocBase::getNext
SubClass * getNext() const
Definition: RegAllocRegistry.h:44
llvm::RegisterRegAllocBase
RegisterRegAllocBase class - Track the registration of register allocators.
Definition: RegAllocRegistry.h:30
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:41