Added LLVM project notice to the top of every C++ source file.
[oota-llvm.git] / lib / CodeGen / Passes.cpp
1 //===-- Passes.cpp - Target independent code generation passes -*- C++ -*-===//
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
18 namespace {
19   enum RegAllocName { simple, local };
20
21   cl::opt<RegAllocName>
22   RegAlloc("regalloc",
23            cl::desc("Register allocator to use: (default = simple)"),
24            cl::Prefix,
25            cl::values(clEnumVal(simple, "  simple register allocator"),
26                       clEnumVal(local,  "  local register allocator"),
27                       0),
28            cl::init(local));
29 }
30
31 FunctionPass *createRegisterAllocator()
32 {
33   switch (RegAlloc) {
34   case simple:
35     return createSimpleRegisterAllocator();
36   case local:
37     return createLocalRegisterAllocator();
38   default:
39     assert(0 && "no register allocator selected");
40     return 0; // not reached
41   }
42 }