aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachinePassRegistry.cpp
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-08-02 12:30:23 +0000
committerJim Laskey <jlaskey@mac.com>2006-08-02 12:30:23 +0000
commiteb577ba3b815a1fa4627b060dd2345d17abf672d (patch)
treef5f23cb7f23616cf9f252122da8610cea888ff95 /lib/CodeGen/MachinePassRegistry.cpp
parent9b9528d8f6da5e79b8ef060eab941d07e0860f20 (diff)
Final polish on machine pass registries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29471 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachinePassRegistry.cpp')
-rw-r--r--lib/CodeGen/MachinePassRegistry.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/lib/CodeGen/MachinePassRegistry.cpp b/lib/CodeGen/MachinePassRegistry.cpp
index c440992476..a7ba5bb3ca 100644
--- a/lib/CodeGen/MachinePassRegistry.cpp
+++ b/lib/CodeGen/MachinePassRegistry.cpp
@@ -16,20 +16,26 @@
using namespace llvm;
-
-//===---------------------------------------------------------------------===//
-///
-/// RegisterRegAlloc class - Track the registration of register allocators.
+
+/// Add - Adds a function pass to the registration list.
///
-//===---------------------------------------------------------------------===//
-MachinePassRegistry<RegisterRegAlloc::FunctionPassCtor>
-RegisterRegAlloc::Registry;
+void MachinePassRegistry::Add(MachinePassRegistryNode *Node) {
+ Node->setNext(List);
+ List = Node;
+ if (Listener) Listener->NotifyAdd(Node->getName(),
+ Node->getCtor(),
+ Node->getDescription());
+}
-//===---------------------------------------------------------------------===//
-///
-/// RegisterScheduler class - Track the registration of instruction schedulers.
+/// Remove - Removes a function pass from the registration list.
///
-//===---------------------------------------------------------------------===//
-MachinePassRegistry<RegisterScheduler::FunctionPassCtor>
-RegisterScheduler::Registry;
+void MachinePassRegistry::Remove(MachinePassRegistryNode *Node) {
+ for (MachinePassRegistryNode **I = &List; *I; I = (*I)->getNextAddress()) {
+ if (*I == Node) {
+ if (Listener) Listener->NotifyRemove(Node->getName());
+ *I = (*I)->getNext();
+ break;
+ }
+ }
+}