18 #ifndef LLVM_CODEGEN_MACHINEPASSREGISTRY_H 19 #define LLVM_CODEGEN_MACHINEPASSREGISTRY_H 34 virtual void anchor() {}
58 : Name(N), Description(D), Ctor(C) {}
65 PassCtorTy
getCtor()
const {
return Ctor; }
92 PassCtorTy Ctor =
nullptr;
95 if (R->getName() ==
Name) {
100 assert(Ctor &&
"Unregistered pass name");
119 I = (*I)->getNextAddress()) {
123 *
I = (*I)->getNext();
135 template <
class RegistryClass>
138 typename RegistryClass::FunctionPassCtor>,
139 public cl::parser<typename RegistryClass::FunctionPassCtor> {
142 : cl::parser<typename RegistryClass::FunctionPassCtor>(O) {}
149 for (RegistryClass *Node = RegistryClass::getList();
150 Node; Node = Node->getNext()) {
151 this->addLiteralOption(Node->getName(),
152 (
typename RegistryClass::FunctionPassCtor)Node->getCtor(),
153 Node->getDescription());
157 RegistryClass::setListener(
this);
163 this->addLiteralOption(N, C, D);
166 this->removeLiteralOption(N);
172 #endif // LLVM_CODEGEN_MACHINEPASSREGISTRY_H StringRef getDescription() const
This class represents lattice values for constants.
PassCtorTy getCtor() const
void Remove(MachinePassRegistryNode< PassCtorTy > *Node)
Remove - Removes a function pass from the registration list.
~RegisterPassParser() override
RegisterPassParser class - Handle the addition of new machine passes.
void setDefault(PassCtorTy C)
amdgpu Simplify well known AMD library false Value Value const Twine & Name
virtual void NotifyAdd(StringRef N, PassCtorTy C, StringRef D)=0
void setNext(MachinePassRegistryNode *N)
void NotifyAdd(StringRef N, typename RegistryClass::FunctionPassCtor C, StringRef D) override
void setListener(MachinePassRegistryListener< PassCtorTy > *L)
MachinePassRegistryListener()=default
void NotifyRemove(StringRef N) override
RegisterPassParser(cl::Option &O)
MachinePassRegistry - Track the registration of machine passes.
StringRef getName() const
void Add(MachinePassRegistryNode< PassCtorTy > *Node)
Add - Adds a function pass to the registration list.
virtual void NotifyRemove(StringRef N)=0
MachinePassRegistryNode< PassCtorTy > * getList()
virtual ~MachinePassRegistryListener()=default
MachinePassRegistryNode ** getNextAddress()
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
void setDefault(StringRef Name)
setDefault - Set the default constructor by name.
MachinePassRegistryListener - Listener to adds and removals of nodes in registration list...
MachinePassRegistryNode(const char *N, const char *D, PassCtorTy C)
MachinePassRegistryNode * getNext() const
MachinePassRegistryNode - Machine pass node stored in registration list.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.