2003-12-28 08:59:53 +01:00
|
|
|
//===-- Passes.cpp - Target independent code generation passes ------------===//
|
2005-04-22 00:36:52 +02:00
|
|
|
//
|
2003-10-20 21:43:21 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and is distributed under
|
|
|
|
// the University of Illinois Open Source License. See LICENSE.TXT for details.
|
2005-04-22 00:36:52 +02:00
|
|
|
//
|
2003-10-20 21:43:21 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2003-10-02 18:57:49 +02:00
|
|
|
//
|
|
|
|
// This file defines interfaces to access the target independent code
|
|
|
|
// generation passes provided by the LLVM backend.
|
|
|
|
//
|
|
|
|
//===---------------------------------------------------------------------===//
|
|
|
|
|
2006-08-02 14:30:23 +02:00
|
|
|
#include "llvm/CodeGen/RegAllocRegistry.h"
|
2003-10-02 18:57:49 +02:00
|
|
|
#include "llvm/CodeGen/Passes.h"
|
2003-12-28 08:59:53 +01:00
|
|
|
#include <iostream>
|
2006-08-01 16:21:23 +02:00
|
|
|
|
2003-12-28 08:59:53 +01:00
|
|
|
using namespace llvm;
|
2003-11-11 23:41:34 +01:00
|
|
|
|
2006-08-02 14:30:23 +02:00
|
|
|
//===---------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// RegisterRegAlloc class - Track the registration of register allocators.
|
|
|
|
///
|
|
|
|
//===---------------------------------------------------------------------===//
|
|
|
|
MachinePassRegistry RegisterRegAlloc::Registry;
|
|
|
|
|
|
|
|
|
|
|
|
//===---------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// RegAlloc command line options.
|
|
|
|
///
|
|
|
|
//===---------------------------------------------------------------------===//
|
2003-10-02 18:57:49 +02:00
|
|
|
namespace {
|
2006-08-02 14:30:23 +02:00
|
|
|
cl::opt<RegisterRegAlloc::FunctionPassCtor, false,
|
|
|
|
RegisterPassParser<RegisterRegAlloc> >
|
2006-08-01 16:21:23 +02:00
|
|
|
RegAlloc("regalloc",
|
2006-08-03 02:16:56 +02:00
|
|
|
cl::init(&createLinearScanRegisterAllocator),
|
2006-08-01 16:21:23 +02:00
|
|
|
cl::desc("Register allocator to use: (default = linearscan)"));
|
2006-07-27 22:05:00 +02:00
|
|
|
}
|
|
|
|
|
2006-08-02 14:30:23 +02:00
|
|
|
|
|
|
|
//===---------------------------------------------------------------------===//
|
|
|
|
///
|
|
|
|
/// createRegisterAllocator - choose the appropriate register allocator.
|
|
|
|
///
|
|
|
|
//===---------------------------------------------------------------------===//
|
2006-07-27 22:05:00 +02:00
|
|
|
FunctionPass *llvm::createRegisterAllocator() {
|
2006-08-01 20:29:48 +02:00
|
|
|
RegisterRegAlloc::FunctionPassCtor Ctor = RegisterRegAlloc::getDefault();
|
2006-08-01 16:21:23 +02:00
|
|
|
|
|
|
|
if (!Ctor) {
|
2006-08-02 14:30:23 +02:00
|
|
|
Ctor = RegAlloc;
|
|
|
|
RegisterRegAlloc::setDefault(RegAlloc);
|
2006-08-01 16:21:23 +02:00
|
|
|
}
|
2006-07-27 22:05:00 +02:00
|
|
|
|
|
|
|
return Ctor();
|
|
|
|
}
|