LLVM API Documentation
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_CODEGEN_REGALLOCREGISTRY_H 00016 #define LLVM_CODEGEN_REGALLOCREGISTRY_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 { 00038 Registry.Add(this); 00039 } 00040 ~RegisterRegAlloc() { Registry.Remove(this); } 00041 00042 00043 // Accessors. 00044 // 00045 RegisterRegAlloc *getNext() const { 00046 return (RegisterRegAlloc *)MachinePassRegistryNode::getNext(); 00047 } 00048 static RegisterRegAlloc *getList() { 00049 return (RegisterRegAlloc *)Registry.getList(); 00050 } 00051 static FunctionPassCtor getDefault() { 00052 return (FunctionPassCtor)Registry.getDefault(); 00053 } 00054 static void setDefault(FunctionPassCtor C) { 00055 Registry.setDefault((MachinePassCtor)C); 00056 } 00057 static void setListener(MachinePassRegistryListener *L) { 00058 Registry.setListener(L); 00059 } 00060 00061 }; 00062 00063 } // end namespace llvm 00064 00065 00066 #endif