LLVM API Documentation

RegAllocRegistry.h

Go to the documentation of this file.
00001 //===-- llvm/CodeGen/RegAllocRegistry.h -------------------------*- C++ -*-===//
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 implementation for register allocator function
00011 // pass registry (RegisterRegAlloc).
00012 //
00013 //===----------------------------------------------------------------------===//
00014 
00015 #ifndef LLVM_CODEGENREGALLOCREGISTRY_H
00016 #define LLVM_CODEGENREGALLOCREGISTRY_H
00017 
00018 #include "llvm/CodeGen/MachinePassRegistry.h"
00019 
00020 namespace llvm {
00021 
00022 //===----------------------------------------------------------------------===//
00023 ///
00024 /// RegisterRegAlloc class - Track the registration of register allocators.
00025 ///
00026 //===----------------------------------------------------------------------===//
00027 class RegisterRegAlloc : public MachinePassRegistryNode {
00028 
00029 public:
00030 
00031   typedef FunctionPass *(*FunctionPassCtor)();
00032 
00033   static MachinePassRegistry Registry;
00034 
00035   RegisterRegAlloc(const char *N, const char *D, FunctionPassCtor C)
00036   : MachinePassRegistryNode(N, D, (MachinePassCtor)C)
00037   { Registry.Add(this); }
00038   ~RegisterRegAlloc() { Registry.Remove(this); }
00039   
00040 
00041   // Accessors.
00042   //
00043   RegisterRegAlloc *getNext() const {
00044     return (RegisterRegAlloc *)MachinePassRegistryNode::getNext();
00045   }
00046   static RegisterRegAlloc *getList() {
00047     return (RegisterRegAlloc *)Registry.getList();
00048   }
00049   static FunctionPassCtor getDefault() {
00050     return (FunctionPassCtor)Registry.getDefault();
00051   }
00052   static void setDefault(FunctionPassCtor C) {
00053     Registry.setDefault((MachinePassCtor)C);
00054   }
00055   static void setListener(MachinePassRegistryListener *L) {
00056     Registry.setListener(L);
00057   }
00058   
00059 };
00060 
00061 } // end namespace llvm
00062 
00063 
00064 #endif