Changes in directory llvm/lib/CodeGen:
MachinePassRegistry.cpp updated: 1.2 -> 1.3 Passes.cpp updated: 1.20 -> 1.21 RegAllocLinearScan.cpp updated: 1.126 -> 1.127 RegAllocLocal.cpp updated: 1.84 -> 1.85 RegAllocSimple.cpp updated: 1.71 -> 1.72 --- Log message: Final polish on machine pass registries. --- Diffs of the changes: (+47 -26) MachinePassRegistry.cpp | 32 +++++++++++++++++++------------- Passes.cpp | 35 +++++++++++++++++++++++++---------- RegAllocLinearScan.cpp | 2 +- RegAllocLocal.cpp | 2 +- RegAllocSimple.cpp | 2 +- 5 files changed, 47 insertions(+), 26 deletions(-) Index: llvm/lib/CodeGen/MachinePassRegistry.cpp diff -u llvm/lib/CodeGen/MachinePassRegistry.cpp:1.2 llvm/lib/CodeGen/MachinePassRegistry.cpp:1.3 --- llvm/lib/CodeGen/MachinePassRegistry.cpp:1.2 Tue Aug 1 13:29:48 2006 +++ llvm/lib/CodeGen/MachinePassRegistry.cpp Wed Aug 2 07:30:23 2006 @@ -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; + } + } +} Index: llvm/lib/CodeGen/Passes.cpp diff -u llvm/lib/CodeGen/Passes.cpp:1.20 llvm/lib/CodeGen/Passes.cpp:1.21 --- llvm/lib/CodeGen/Passes.cpp:1.20 Tue Aug 1 13:29:48 2006 +++ llvm/lib/CodeGen/Passes.cpp Wed Aug 2 07:30:23 2006 @@ -12,31 +12,46 @@ // //===---------------------------------------------------------------------===// -#include "llvm/CodeGen/MachinePassRegistry.h" +#include "llvm/CodeGen/RegAllocRegistry.h" #include "llvm/CodeGen/Passes.h" -#include "llvm/Support/CommandLine.h" #include <iostream> using namespace llvm; +//===---------------------------------------------------------------------===// +/// +/// RegisterRegAlloc class - Track the registration of register allocators. +/// +//===---------------------------------------------------------------------===// +MachinePassRegistry RegisterRegAlloc::Registry; + + +//===---------------------------------------------------------------------===// +/// +/// RegAlloc command line options. +/// +//===---------------------------------------------------------------------===// namespace { - cl::opt<const char *, false, RegisterPassParser<RegisterRegAlloc> > + cl::opt<RegisterRegAlloc::FunctionPassCtor, false, + RegisterPassParser<RegisterRegAlloc> > RegAlloc("regalloc", - cl::init("linearscan"), + cl::init(createLinearScanRegisterAllocator), cl::desc("Register allocator to use: (default = linearscan)")); } + +//===---------------------------------------------------------------------===// +/// +/// createRegisterAllocator - choose the appropriate register allocator. +/// +//===---------------------------------------------------------------------===// FunctionPass *llvm::createRegisterAllocator() { RegisterRegAlloc::FunctionPassCtor Ctor = RegisterRegAlloc::getDefault(); if (!Ctor) { - Ctor = RegisterRegAlloc::FindCtor(RegAlloc); - assert(Ctor && "No register allocator found"); - if (!Ctor) Ctor = RegisterRegAlloc::FirstCtor(); - RegisterRegAlloc::setDefault(Ctor); + Ctor = RegAlloc; + RegisterRegAlloc::setDefault(RegAlloc); } - assert(Ctor && "No register allocator found"); - return Ctor(); } Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.126 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.127 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.126 Tue Aug 1 09:21:23 2006 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Wed Aug 2 07:30:23 2006 @@ -18,8 +18,8 @@ #include "llvm/Function.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/CodeGen/MachinePassRegistry.h" #include "llvm/CodeGen/Passes.h" +#include "llvm/CodeGen/RegAllocRegistry.h" #include "llvm/CodeGen/SSARegMap.h" #include "llvm/Target/MRegisterInfo.h" #include "llvm/Target/TargetMachine.h" Index: llvm/lib/CodeGen/RegAllocLocal.cpp diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.84 llvm/lib/CodeGen/RegAllocLocal.cpp:1.85 --- llvm/lib/CodeGen/RegAllocLocal.cpp:1.84 Tue Aug 1 09:21:23 2006 +++ llvm/lib/CodeGen/RegAllocLocal.cpp Wed Aug 2 07:30:23 2006 @@ -18,8 +18,8 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/SSARegMap.h" #include "llvm/CodeGen/MachineFrameInfo.h" -#include "llvm/CodeGen/MachinePassRegistry.h" #include "llvm/CodeGen/LiveVariables.h" +#include "llvm/CodeGen/RegAllocRegistry.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/CommandLine.h" Index: llvm/lib/CodeGen/RegAllocSimple.cpp diff -u llvm/lib/CodeGen/RegAllocSimple.cpp:1.71 llvm/lib/CodeGen/RegAllocSimple.cpp:1.72 --- llvm/lib/CodeGen/RegAllocSimple.cpp:1.71 Tue Aug 1 09:21:23 2006 +++ llvm/lib/CodeGen/RegAllocSimple.cpp Wed Aug 2 07:30:23 2006 @@ -20,7 +20,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/SSARegMap.h" #include "llvm/CodeGen/MachineFrameInfo.h" -#include "llvm/CodeGen/MachinePassRegistry.h" +#include "llvm/CodeGen/RegAllocRegistry.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Debug.h" _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits