LLVM 17.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
20namespace llvm {
21
22class FunctionPass;
23
24//===----------------------------------------------------------------------===//
25///
26/// RegisterRegAllocBase class - Track the registration of register allocators.
27///
28//===----------------------------------------------------------------------===//
29template <class SubClass>
30class RegisterRegAllocBase : public MachinePassRegistryNode<FunctionPass *(*)()> {
31public:
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
61class RegisterRegAlloc : public RegisterRegAllocBase<RegisterRegAlloc> {
62public:
63 RegisterRegAlloc(const char *N, const char *D, FunctionPassCtor C)
65};
66
67/// RegisterRegAlloc's global Registry tracks allocator registration.
68template <class T>
69MachinePassRegistry<RegisterRegAlloc::FunctionPassCtor>
71
72} // end namespace llvm
73
74#endif // LLVM_CODEGEN_REGALLOCREGISTRY_H
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:308
MachinePassRegistryListener - Listener to adds and removals of nodes in registration list.
MachinePassRegistryNode - Machine pass node stored in registration list.
MachinePassRegistryNode * getNext() const
MachinePassRegistry - Track the registration of machine passes.
RegisterRegAllocBase class - Track the registration of register allocators.
SubClass * getNext() const
static MachinePassRegistry< FunctionPassCtor > Registry
RegisterRegAlloc's global Registry tracks allocator registration.
static FunctionPassCtor getDefault()
static SubClass * getList()
static void setDefault(FunctionPassCtor C)
static void setListener(MachinePassRegistryListener< FunctionPassCtor > *L)
FunctionPass *(*)() FunctionPassCtor
RegisterRegAllocBase(const char *N, const char *D, FunctionPassCtor C)
RegisterRegAlloc(const char *N, const char *D, FunctionPassCtor C)
A static registration template.
Definition: Registry.h:114
A global registry used in conjunction with static constructors to make pluggable components (like tar...
Definition: Registry.h:44
@ C
The default llvm calling convention, compatible with C.
Definition: CallingConv.h:34
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
#define N