[LLVMdev] Adding register allocator to LLVM

Fernando Magno Quintao Pereira fernando at CS.UCLA.EDU
Sun Aug 20 11:13:52 PDT 2006

Dear Anton,

    you can add your register allocator strait iin the
"lib/CodeGen/Passes.cpp", and then 're-make' it: "makellvm llc", on the
top of lib/CodeGen. It is faster than running make from LLVMOBJDIR. The
problem is that it only add to llc the changes on the lib/CodeGen
directory. If you change other parts, a make from LLVMOBJDIR will
synchronize it.

Try adding code like this to your Passes.cpp file:

/// RegAlloc command line options.
namespace {
  cl::opt<RegisterRegAlloc::FunctionPassCtor, false,
          RegisterPassParser<RegisterRegAlloc> >
           cl::desc("Register allocator to use: (default = chordal)"));

All the best,


> Hi!
> I've did what Jim Laskey wrote but llc didn't reckognize my regalloc option.
> So I moved my allocator implementation into seperate folder within CodeGen
> and wrote separate makefile for it (like in "Writing an LLVM pass"
> tutorial). But when I run "make" from LLVMOBJDIR it doesn't enter the
> RegAlloc directory and when linking llc an error like
> "createGraphColoringRegAlloc not defined" occurs.
> What am I doing wrong? :)

More information about the llvm-dev mailing list