[llvm-commits] CVS: llvm/lib/CodeGen/Passes.cpp

Alkis Evlogimenos alkis at cs.uiuc.edu
Thu Oct 2 11:59:01 PDT 2003


Changes in directory llvm/lib/CodeGen:

Passes.cpp added (r1.1)

---
Log message:

Moved enum and command-line option in separate file. Also added function that returns the user selected register allocator to the caller.


---
Diffs of the changes:

Index: llvm/lib/CodeGen/Passes.cpp
diff -c /dev/null llvm/lib/CodeGen/Passes.cpp:1.1
*** /dev/null	Thu Oct  2 11:58:00 2003
--- llvm/lib/CodeGen/Passes.cpp	Thu Oct  2 11:57:49 2003
***************
*** 0 ****
--- 1,35 ----
+ //===-- Passes.cpp - Target independent code generation passes -*- C++ -*-===//
+ //
+ // 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"
+ 
+ namespace {
+   enum RegAllocName { simple, local };
+ 
+   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));
+ }
+ 
+ FunctionPass *createRegisterAllocator()
+ {
+   switch (RegAlloc) {
+   case simple:
+     return createSimpleRegisterAllocator();
+   case local:
+     return createLocalRegisterAllocator();
+   default:
+     assert(0 && "no register allocator selected");
+     return 0; // not reached
+   }
+ }





More information about the llvm-commits mailing list