Alkis agrees that that iterative scan allocator isn't going to be worked on
[oota-llvm.git] / lib / CodeGen / Passes.cpp
1 //===-- Passes.cpp - Target independent code generation passes ------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines interfaces to access the target independent code
11 // generation passes provided by the LLVM backend.
12 //
13 //===---------------------------------------------------------------------===//
14
15 #include "llvm/CodeGen/Passes.h"
16 #include "llvm/Support/CommandLine.h"
17 #include <iostream>
18 using namespace llvm;
19
20 namespace {
21   enum RegAllocName { simple, local, linearscan };
22
23   cl::opt<RegAllocName>
24   RegAlloc(
25     "regalloc",
26     cl::desc("Register allocator to use: (default = linearscan)"),
27     cl::Prefix,
28     cl::values(
29        clEnumVal(simple,        "  simple register allocator"),
30        clEnumVal(local,         "  local register allocator"),
31        clEnumVal(linearscan,    "  linear scan register allocator"),
32        clEnumValEnd),
33     cl::init(linearscan));
34 }
35
36 FunctionPass *llvm::createRegisterAllocator() {
37   switch (RegAlloc) {
38   default:
39     std::cerr << "no register allocator selected";
40     abort();
41   case simple:
42     return createSimpleRegisterAllocator();
43   case local:
44     return createLocalRegisterAllocator();
45   case linearscan:
46     return createLinearScanRegisterAllocator();
47   }
48 }
49