Evaluating the register allocators

Hello,

I’m trying to evaluate the different register allocation algorithms on LLVM using the same level of optimizations. Using version 3.3 the current register allocators available to use are “basic, fast, greedy and pbqp”. However, I’m facing the following issues:

  1. I can’t run basic and PBQP allocators using the command line flags of the dragonegg (-fplugin-arg-dragonegg-llvm-option="-regalloc:basic"). I get this error message “for the -regalloc option: Cannot find option named ‘pbqp’!” or basic. Note that I didn’t get this error when I used the LLC tool.

  2. I can’t run the fast register allocator while using the “O1/O2/O3” optimizations flags. Is there any purpose behind disabling this pass while the optimizations are enabled?

Thanks,
Najem.

Regalloc is a pipeline of passes that need to cooperate. If you want to run all the usual llc optimizations with fast regalloc you probably need “-O2 -optimize-regalloc=false”

-Andy

Hi Najem,

Regarding your first question, clang does not reference any symbols in
RegAllocPBQP.cpp or RegAllocBasic.cpp, so the corresponding allocators
are not linked in to the clang binary. An easy fix for this, if you
are building your own compiler from source, is to add the following
include directive to cc1_main.cpp:

#include "llvm/CodeGen/LinkAllCodeGenComponents.h"

Once you have re-compiled, you should be able to use '-mllvm
-regalloc=pbqp/basic'.

I hope this helps.

Regards,
Lang.