2003-12-28 08:59:53 +01:00
|
|
|
//===-- Passes.cpp - Target independent code generation passes ------------===//
|
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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
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.
|
|
|
|
//
|
|
|
|
//===---------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "llvm/CodeGen/Passes.h"
|
|
|
|
#include "Support/CommandLine.h"
|
2003-12-28 08:59:53 +01:00
|
|
|
#include <iostream>
|
|
|
|
using namespace llvm;
|
2003-11-11 23:41:34 +01:00
|
|
|
|
2003-10-02 18:57:49 +02:00
|
|
|
namespace {
|
2003-11-20 04:32:25 +01:00
|
|
|
enum RegAllocName { simple, local, linearscan };
|
2003-10-02 18:57:49 +02:00
|
|
|
|
|
|
|
cl::opt<RegAllocName>
|
|
|
|
RegAlloc("regalloc",
|
|
|
|
cl::desc("Register allocator to use: (default = simple)"),
|
|
|
|
cl::Prefix,
|
2003-11-20 04:32:25 +01:00
|
|
|
cl::values(clEnumVal(simple, " simple register allocator"),
|
|
|
|
clEnumVal(local, " local register allocator"),
|
|
|
|
clEnumVal(linearscan, " linear-scan global register allocator"),
|
2003-10-02 18:57:49 +02:00
|
|
|
0),
|
|
|
|
cl::init(local));
|
|
|
|
}
|
|
|
|
|
2003-12-28 08:59:53 +01:00
|
|
|
FunctionPass *llvm::createRegisterAllocator() {
|
2003-10-02 18:57:49 +02:00
|
|
|
switch (RegAlloc) {
|
2003-12-28 08:59:53 +01:00
|
|
|
default:
|
|
|
|
std::cerr << "no register allocator selected";
|
|
|
|
abort();
|
2003-10-02 18:57:49 +02:00
|
|
|
case simple:
|
|
|
|
return createSimpleRegisterAllocator();
|
|
|
|
case local:
|
|
|
|
return createLocalRegisterAllocator();
|
2003-11-20 04:32:25 +01:00
|
|
|
case linearscan:
|
|
|
|
return createLinearScanRegisterAllocator();
|
2003-10-02 18:57:49 +02:00
|
|
|
}
|
|
|
|
}
|
2003-11-11 23:41:34 +01:00
|
|
|
|