Chris Lattner | aa4c91f | 2003-12-28 07:59:53 +0000 | [diff] [blame] | 1 | //===-- Passes.cpp - Target independent code generation passes ------------===// |
Misha Brukman | edf128a | 2005-04-21 22:36:52 +0000 | [diff] [blame] | 2 | // |
John Criswell | b576c94 | 2003-10-20 19:43:21 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Misha Brukman | edf128a | 2005-04-21 22:36:52 +0000 | [diff] [blame] | 7 | // |
John Criswell | b576c94 | 2003-10-20 19:43:21 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Alkis Evlogimenos | 7237ece | 2003-10-02 16:57:49 +0000 | [diff] [blame] | 9 | // |
| 10 | // This file defines interfaces to access the target independent code |
| 11 | // generation passes provided by the LLVM backend. |
| 12 | // |
| 13 | //===---------------------------------------------------------------------===// |
| 14 | |
Jim Laskey | eb577ba | 2006-08-02 12:30:23 +0000 | [diff] [blame] | 15 | #include "llvm/CodeGen/RegAllocRegistry.h" |
Alkis Evlogimenos | 7237ece | 2003-10-02 16:57:49 +0000 | [diff] [blame] | 16 | #include "llvm/CodeGen/Passes.h" |
Jim Laskey | 13ec702 | 2006-08-01 14:21:23 +0000 | [diff] [blame] | 17 | |
Chris Lattner | aa4c91f | 2003-12-28 07:59:53 +0000 | [diff] [blame] | 18 | using namespace llvm; |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 19 | |
Jim Laskey | eb577ba | 2006-08-02 12:30:23 +0000 | [diff] [blame] | 20 | //===---------------------------------------------------------------------===// |
| 21 | /// |
| 22 | /// RegisterRegAlloc class - Track the registration of register allocators. |
| 23 | /// |
| 24 | //===---------------------------------------------------------------------===// |
| 25 | MachinePassRegistry RegisterRegAlloc::Registry; |
| 26 | |
| 27 | |
| 28 | //===---------------------------------------------------------------------===// |
| 29 | /// |
| 30 | /// RegAlloc command line options. |
| 31 | /// |
| 32 | //===---------------------------------------------------------------------===// |
Dan Gohman | 844731a | 2008-05-13 00:00:25 +0000 | [diff] [blame] | 33 | static cl::opt<RegisterRegAlloc::FunctionPassCtor, false, |
| 34 | RegisterPassParser<RegisterRegAlloc> > |
| 35 | RegAlloc("regalloc", |
| 36 | cl::init(&createLinearScanRegisterAllocator), |
| 37 | cl::desc("Register allocator to use: (default = linearscan)")); |
Alkis Evlogimenos | 7237ece | 2003-10-02 16:57:49 +0000 | [diff] [blame] | 38 | |
Jim Laskey | eb577ba | 2006-08-02 12:30:23 +0000 | [diff] [blame] | 39 | |
| 40 | //===---------------------------------------------------------------------===// |
| 41 | /// |
| 42 | /// createRegisterAllocator - choose the appropriate register allocator. |
| 43 | /// |
| 44 | //===---------------------------------------------------------------------===// |
Jim Laskey | 33a0a6d | 2006-07-27 20:05:00 +0000 | [diff] [blame] | 45 | FunctionPass *llvm::createRegisterAllocator() { |
Jim Laskey | 9ff542f | 2006-08-01 18:29:48 +0000 | [diff] [blame] | 46 | RegisterRegAlloc::FunctionPassCtor Ctor = RegisterRegAlloc::getDefault(); |
Jim Laskey | 33a0a6d | 2006-07-27 20:05:00 +0000 | [diff] [blame] | 47 | |
Jim Laskey | 13ec702 | 2006-08-01 14:21:23 +0000 | [diff] [blame] | 48 | if (!Ctor) { |
Jim Laskey | eb577ba | 2006-08-02 12:30:23 +0000 | [diff] [blame] | 49 | Ctor = RegAlloc; |
| 50 | RegisterRegAlloc::setDefault(RegAlloc); |
Jim Laskey | 13ec702 | 2006-08-01 14:21:23 +0000 | [diff] [blame] | 51 | } |
| 52 | |
Jim Laskey | 33a0a6d | 2006-07-27 20:05:00 +0000 | [diff] [blame] | 53 | return Ctor(); |
| 54 | } |