X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FPasses.cpp;h=6742146a3833aa5a63c469d661e3879230114e99;hb=a9407f593778c3eff02dbb1fa11129865a59c6d3;hp=a896f83526e2dfeb590caebff63e41e4691774c6;hpb=9ff542f2cce5bf7bf3cf9f692cf3ec0690ad2b3b;p=oota-llvm.git diff --git a/lib/CodeGen/Passes.cpp b/lib/CodeGen/Passes.cpp index a896f83526e..6742146a383 100644 --- a/lib/CodeGen/Passes.cpp +++ b/lib/CodeGen/Passes.cpp @@ -2,8 +2,8 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // @@ -12,31 +12,45 @@ // //===---------------------------------------------------------------------===// -#include "llvm/CodeGen/MachinePassRegistry.h" +#include "llvm/CodeGen/RegAllocRegistry.h" #include "llvm/CodeGen/Passes.h" -#include "llvm/Support/CommandLine.h" -#include using namespace llvm; +//===---------------------------------------------------------------------===// +/// +/// RegisterRegAlloc class - Track the registration of register allocators. +/// +//===---------------------------------------------------------------------===// +MachinePassRegistry RegisterRegAlloc::Registry; + + +//===---------------------------------------------------------------------===// +/// +/// RegAlloc command line options. +/// +//===---------------------------------------------------------------------===// namespace { - cl::opt > + cl::opt > 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(); }