mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
Final polish on machine pass registries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29471 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -12,31 +12,46 @@
|
||||
//
|
||||
//===---------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/CodeGen/MachinePassRegistry.h"
|
||||
#include "llvm/CodeGen/RegAllocRegistry.h"
|
||||
#include "llvm/CodeGen/Passes.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
///
|
||||
/// RegisterRegAlloc class - Track the registration of register allocators.
|
||||
///
|
||||
//===---------------------------------------------------------------------===//
|
||||
MachinePassRegistry RegisterRegAlloc::Registry;
|
||||
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
///
|
||||
/// RegAlloc command line options.
|
||||
///
|
||||
//===---------------------------------------------------------------------===//
|
||||
namespace {
|
||||
cl::opt<const char *, false, RegisterPassParser<RegisterRegAlloc> >
|
||||
cl::opt<RegisterRegAlloc::FunctionPassCtor, false,
|
||||
RegisterPassParser<RegisterRegAlloc> >
|
||||
RegAlloc("regalloc",
|
||||
cl::init("linearscan"),
|
||||
cl::init(createLinearScanRegisterAllocator),
|
||||
cl::desc("Register allocator to use: (default = linearscan)"));
|
||||
}
|
||||
|
||||
|
||||
//===---------------------------------------------------------------------===//
|
||||
///
|
||||
/// createRegisterAllocator - choose the appropriate register allocator.
|
||||
///
|
||||
//===---------------------------------------------------------------------===//
|
||||
FunctionPass *llvm::createRegisterAllocator() {
|
||||
RegisterRegAlloc::FunctionPassCtor Ctor = RegisterRegAlloc::getDefault();
|
||||
|
||||
if (!Ctor) {
|
||||
Ctor = RegisterRegAlloc::FindCtor(RegAlloc);
|
||||
assert(Ctor && "No register allocator found");
|
||||
if (!Ctor) Ctor = RegisterRegAlloc::FirstCtor();
|
||||
RegisterRegAlloc::setDefault(Ctor);
|
||||
Ctor = RegAlloc;
|
||||
RegisterRegAlloc::setDefault(RegAlloc);
|
||||
}
|
||||
|
||||
assert(Ctor && "No register allocator found");
|
||||
|
||||
return Ctor();
|
||||
}
|
||||
|
Reference in New Issue
Block a user