Change llc command line for register allocators
authorAlkis Evlogimenos <alkis@evlogimenos.com>
Thu, 2 Oct 2003 06:13:19 +0000 (06:13 +0000)
committerAlkis Evlogimenos <alkis@evlogimenos.com>
Thu, 2 Oct 2003 06:13:19 +0000 (06:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8815 91177308-0d34-0410-b5e6-96231b3b80d8

docs/CommandGuide/llc.html
include/llvm/CodeGen/Passes.h
lib/Target/X86/X86TargetMachine.cpp
test/CodeGen/X86/2002-12-23-LocalRAProblem.llx
test/CodeGen/X86/2002-12-23-SubProblem.llx

index 26e680342cd67ffe4f35fe9b688ea7f3fe16c15e..8788a7a608a6cd2219a50046751c860214a9c3cb 100644 (file)
@@ -95,11 +95,6 @@ OPTIONS
        Disable frame pointer elimination optimization.
        <p>
 
-       <li>-disable-local-ra    
-       <br>
-       Use Simple RA instead of Local RegAlloc.
-       <p>
-
        <li>-disable-pattern-isel
        <br>
        Use the 'simple' X86 instruction selector.
@@ -146,13 +141,11 @@ OPTIONS
        architectures are:
 
        <dl compact>
-               <di> x86               
-               <dd>
-               IA-32 (Pentium and above)
-               <p>
+               <di> x86
+               <dd>IA-32 (Pentium and above)</dd>
 
-               <di> sparc             
-               <dd>SPARC V9
+               <di> sparc
+               <dd>SPARC V9</dd>
        </dl>
        <p>
 
@@ -166,6 +159,19 @@ OPTIONS
        Print generated machine code.
        <p>
 
+       <li>-regalloc=&lt;ra&gt;
+       <br>
+        Specify the register allocator to use. The default is <i>simple<i>.
+        Valid register allocators are:
+       <dl compact>
+               <di> simple
+               <dd>Very simple register allocator</dd>
+
+               <di> local
+               <dd>Local register allocator</dd>
+       </dl>
+       <p>
+
        <li> -help
        <br>
        Print a summary of command line options.
index 5f8a19df7fa3af715dc6c199834690456a38d93a..309bf66cf81967749629b630cd8abf1a3b985305 100644 (file)
@@ -19,6 +19,8 @@ class TargetMachine;
 //
 extern const PassInfo *PHIEliminationID;
 
+enum RegAllocName { simple, local };
+
 /// SimpleRegisterAllocation Pass - This pass converts the input machine code
 /// from SSA form to use explicit registers by spilling every register.  Wow,
 /// great policy huh?
index 60f8bbca19b87b4021cd8bd82d69a787dc6861b3..8f6829f6de4ad49341048714df9e58e013257e98 100644 (file)
 #include "Support/Statistic.h"
 
 namespace {
-  cl::opt<bool> NoLocalRA("disable-local-ra",
-                          cl::desc("Use Simple RA instead of Local RegAlloc"));
+  cl::opt<RegAllocName>
+  RegAlloc("regalloc",
+           cl::desc("Register allocator to use: (default = simple)"),
+           cl::Prefix,
+           cl::values(clEnumVal(simple, "  simple register allocator"),
+                      clEnumVal(local,  "  local register allocator"),
+                      0),
+           cl::init(local));
+
   cl::opt<bool> PrintCode("print-machineinstrs",
                          cl::desc("Print generated machine code"));
   cl::opt<bool> NoPatternISel("disable-pattern-isel", cl::init(true),
@@ -66,10 +73,16 @@ bool X86TargetMachine::addPassesToEmitAssembly(PassManager &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;
+  default:
+    assert(0 && "no register allocator selected");
+  }
 
   if (PrintCode)
     PM.add(createMachineFunctionPrinterPass());
@@ -113,10 +126,16 @@ 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;
+  default:
+    assert(0 && "no register allocator selected");
+  }
 
   if (PrintCode)
     PM.add(createMachineFunctionPrinterPass());
index 05b760a5c5eceaf82f33e42313299386f745f53c..1511df3431196d1164bd7db55b3608f172b08872 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | lli -force-interpreter=false -disable-local-ra=false
+; RUN: llvm-as < %s | lli -force-interpreter=false -regalloc=simple
 ;-print-machineinstrs 
 
 int %main() {
index 2782325484122e8ffffbfd4106fa9403d3bc7a16..5f5a4cffd17d9c288b40ed491d0b790438b757ba 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | lli -force-interpreter=false -disable-local-ra
+; RUN: llvm-as < %s | lli -force-interpreter=false -regalloc=simple
 
 int %main(int %B) {
        ;%B = add int 0, 1