LLVM API Documentation

MachinePassRegistry.cpp

Go to the documentation of this file.
00001 //===-- CodeGen/MachineInstr.cpp ------------------------------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // This file contains the machine function pass registry for register allocators
00011 // and instruction schedulers.
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #include "llvm/CodeGen/MachinePassRegistry.h"
00016 
00017 using namespace llvm;
00018 
00019 
00020 /// Add - Adds a function pass to the registration list.
00021 ///
00022 void MachinePassRegistry::Add(MachinePassRegistryNode *Node) {
00023   Node->setNext(List);
00024   List = Node;
00025   if (Listener) Listener->NotifyAdd(Node->getName(),
00026                                     Node->getCtor(),
00027                                     Node->getDescription());
00028 }
00029 
00030 
00031 /// Remove - Removes a function pass from the registration list.
00032 ///
00033 void MachinePassRegistry::Remove(MachinePassRegistryNode *Node) {
00034   for (MachinePassRegistryNode **I = &List; *I; I = (*I)->getNextAddress()) {
00035     if (*I == Node) {
00036       if (Listener) Listener->NotifyRemove(Node->getName());
00037       *I = (*I)->getNext();
00038       break;
00039     }
00040   }
00041 }