[LLVMdev] Adding register allocator to LLVM
Jim Laskey
jlaskey at apple.com
Thu Aug 3 02:38:26 PDT 2006
Welcome to the world of pluggable machine passes. This work was done
to lighten the load of some llvm tools, ie., only link in the
register allocators and instruction schedulers that are actually
needed in a particular circumstance. I guess I will have to write
this up, but generally it works like this.
In your register allocator .cpp file add the following include;
#include ""llvm/CodeGen/RegAllocRegistry.h""
In your register allocator .cpp file define a create function in the
form;
FunctionPass *createMyRegisterAllocator() {
return new MyRegisterAllocator();
}
and the "installing" static constructor declaration, in the form;
static RegisterRegAlloc myRegAlloc("myregalloc",
" my register allocator help string",
createMyRegisterAllocator);
To force the load/linking of your register allocator into the llc/lli
tools, add your create function's global declaration to "Passes.h"
and add a "pseudo" call line to "llvm/Codegen/
LinkAllCodegenComponents.h" .
And that should do it.
Cheers,
-- Jim
On Aug 3, 2006, at 6:00 AM, Anton Vayvod wrote:
> Hi!
>
> I'm developing a register allocator and need it to be available as
> an option for llc tool. I used to edit /lib/CodeGen/Passes.cpp for
> this aim but after yesterday's update these options are defined
> somewhere else and I can't find the place.
>
> Thanks for your help.
>
> Tony.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20060803/3033f963/attachment.bin>
More information about the llvm-dev
mailing list