LLVM  7.0.0svn
MachinePassRegistry.cpp
Go to the documentation of this file.
1 //===-- CodeGen/MachineInstr.cpp ------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the machine function pass registry for register allocators
11 // and instruction schedulers.
12 //
13 //===----------------------------------------------------------------------===//
14 
16 
17 using namespace llvm;
18 
19 void MachinePassRegistryListener::anchor() { }
20 
21 /// setDefault - Set the default constructor by name.
23  MachinePassCtor Ctor = nullptr;
24  for(MachinePassRegistryNode *R = getList(); R; R = R->getNext()) {
25  if (R->getName() == Name) {
26  Ctor = R->getCtor();
27  break;
28  }
29  }
30  assert(Ctor && "Unregistered pass name");
31  setDefault(Ctor);
32 }
33 
34 /// Add - Adds a function pass to the registration list.
35 ///
37  Node->setNext(List);
38  List = Node;
39  if (Listener) Listener->NotifyAdd(Node->getName(),
40  Node->getCtor(),
41  Node->getDescription());
42 }
43 
44 
45 /// Remove - Removes a function pass from the registration list.
46 ///
48  for (MachinePassRegistryNode **I = &List; *I; I = (*I)->getNextAddress()) {
49  if (*I == Node) {
50  if (Listener) Listener->NotifyRemove(Node->getName());
51  *I = (*I)->getNext();
52  break;
53  }
54  }
55 }
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
void Add(MachinePassRegistryNode *Node)
Add - Adds a function pass to the registration list.
void setNext(MachinePassRegistryNode *N)
MachinePassCtor getCtor() const
void Remove(MachinePassRegistryNode *Node)
Remove - Removes a function pass from the registration list.
const NodeList & List
Definition: RDFGraph.cpp:210
#define I(x, y, z)
Definition: MD5.cpp:58
MachinePassRegistryNode - Machine pass node stored in registration list.
void *(*)() MachinePassCtor
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
void setDefault(MachinePassCtor C)