aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2003-10-01 19:38:10 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2003-10-01 19:38:10 +0000
commit6ac2c8c6731fdebd9373aa9e0faa21df38dc6cfe (patch)
tree6a0dc8edfb59d7abbfa72f6dc25d50d28ffb2fea /lib/Target
parent99b2d3d8528f3bc4f03c852cb404e6e0b09e00a1 (diff)
downloadexternal_llvm-6ac2c8c6731fdebd9373aa9e0faa21df38dc6cfe.zip
external_llvm-6ac2c8c6731fdebd9373aa9e0faa21df38dc6cfe.tar.gz
external_llvm-6ac2c8c6731fdebd9373aa9e0faa21df38dc6cfe.tar.bz2
Added command line option for linear scan allocator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8804 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
-rw-r--r--lib/Target/X86/X86TargetMachine.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp
index 60f8bbc..e58ac31 100644
--- a/lib/Target/X86/X86TargetMachine.cpp
+++ b/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());