diff options
author | Alkis Evlogimenos <alkis@evlogimenos.com> | 2003-10-01 19:38:10 +0000 |
---|---|---|
committer | Alkis Evlogimenos <alkis@evlogimenos.com> | 2003-10-01 19:38:10 +0000 |
commit | 568e4386e88ba336e68aeb80cc7680e3bfeab618 (patch) | |
tree | 3b41e021c90547282973892967fa96cfe3031a78 /llvm/lib/Target/X86/X86TargetMachine.cpp | |
parent | cda288549944352b7af2a7b3dde79ed0e2914501 (diff) | |
download | bcm5719-llvm-568e4386e88ba336e68aeb80cc7680e3bfeab618.tar.gz bcm5719-llvm-568e4386e88ba336e68aeb80cc7680e3bfeab618.zip |
Added command line option for linear scan allocator
llvm-svn: 8804
Diffstat (limited to 'llvm/lib/Target/X86/X86TargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86TargetMachine.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp index 60f8bbca19b..e58ac31c7f2 100644 --- a/llvm/lib/Target/X86/X86TargetMachine.cpp +++ b/llvm/lib/Target/X86/X86TargetMachine.cpp @@ -16,6 +16,14 @@ #include "Support/Statistic.h" namespace { + cl::opt<RegAllocName> + RegAlloc("regalloc", + cl::desc("Register allocator to use:"), cl::Prefix, + cl::values(clEnumVal(simple, "simple register allocator)"), + clEnumVal(local, "local register allocator"), + clEnumVal(linearscan, "linear scan global register allocator")), + cl::init(local)); + cl::opt<bool> NoLocalRA("disable-local-ra", cl::desc("Use Simple RA instead of Local RegAlloc")); cl::opt<bool> PrintCode("print-machineinstrs", @@ -113,10 +121,19 @@ bool X86TargetMachine::addPassesToJITCompile(FunctionPassManager &PM) { PM.add(createMachineFunctionPrinterPass()); // Perform register allocation to convert to a concrete x86 representation - if (NoLocalRA) + switch (RegAlloc) { + case simple: PM.add(createSimpleRegisterAllocator()); - else + break; + case local: PM.add(createLocalRegisterAllocator()); + break; + case linearscan: + PM.add(createLinearScanRegisterAllocator()); + break; + default: + assert(0 && "no register allocator selected"); + } if (PrintCode) PM.add(createMachineFunctionPrinterPass()); |