Add LeakDetection to MachineInstr.
[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 "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("regalloc",
25            cl::desc("Register allocator to use: (default = simple)"),
26            cl::Prefix,
27            cl::values(clEnumVal(simple,      "  simple register allocator"),
28                       clEnumVal(local,       "  local register allocator"),
29                       clEnumVal(linearscan,  "  linear-scan global register allocator"),
30                       0),
31            cl::init(local));
32 }
33
34 FunctionPass *llvm::createRegisterAllocator() {
35   switch (RegAlloc) {
36   default:
37     std::cerr << "no register allocator selected";
38     abort();
39   case simple:
40     return createSimpleRegisterAllocator();
41   case local:
42     return createLocalRegisterAllocator();
43   case linearscan:
44     return createLinearScanRegisterAllocator();
45   }
46 }
47