Reverting back to original 1.8 version so I can manually merge in patch.
[llvm-complete.git] / lib / CodeGen / Passes.cpp
blob8cf1a587ac6003dad5a5bd3f7f5264dabc6db89e
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.
13 //===---------------------------------------------------------------------===//
15 #include "llvm/CodeGen/RegAllocRegistry.h"
16 #include "llvm/CodeGen/Passes.h"
17 #include <iostream>
19 using namespace llvm;
21 //===---------------------------------------------------------------------===//
22 ///
23 /// RegisterRegAlloc class - Track the registration of register allocators.
24 ///
25 //===---------------------------------------------------------------------===//
26 MachinePassRegistry RegisterRegAlloc::Registry;
29 //===---------------------------------------------------------------------===//
30 ///
31 /// RegAlloc command line options.
32 ///
33 //===---------------------------------------------------------------------===//
34 namespace {
35 cl::opt<RegisterRegAlloc::FunctionPassCtor, false,
36 RegisterPassParser<RegisterRegAlloc> >
37 RegAlloc("regalloc",
38 cl::init(&createLinearScanRegisterAllocator),
39 cl::desc("Register allocator to use: (default = linearscan)"));
43 //===---------------------------------------------------------------------===//
44 ///
45 /// createRegisterAllocator - choose the appropriate register allocator.
46 ///
47 //===---------------------------------------------------------------------===//
48 FunctionPass *llvm::createRegisterAllocator() {
49 RegisterRegAlloc::FunctionPassCtor Ctor = RegisterRegAlloc::getDefault();
51 if (!Ctor) {
52 Ctor = RegAlloc;
53 RegisterRegAlloc::setDefault(RegAlloc);
56 return Ctor();