[LLVMdev] request for help writing a register allocator

Jim Grosbach grosbach at apple.com
Mon Oct 19 18:01:27 PDT 2009


Hi Susan,

You may find the PBQP allocator implementation useful as a reference  
to what's involved in adding a new allocator to LLVM. It's located in  
lib/CodeGen/RegAllocPBQP.cpp, with supporting files in the lib/CodeGen/ 
PBQP directory.

I'm no expert on the LLVM register allocation interfaces, so I'll  
defer to those who are regarding the specifics of your questions.

-Jim

On Oct 19, 2009, at 5:20 PM, Susan Horwitz wrote:

> I'm using LLVM for a compiler course, and I'd like to have my students
> implement a graph-coloring register allocator.  I'm having a lot of
> trouble figuring out how this should be done.
>
> Is there anyone who has written an LLVM register allocator who would  
> be
> willing to help me understand the basic ideas?  I understand the
> algorithm, it's LLVM that I don't understand.  For example:
>
> - When allocating registers, how do I know which register class to  
> use,
>   and which registers of that class are available?
>
> - How do I know which operands of a Machine Instruction are candidates
>   for (simple) register allocation (e.g., are of type int)?
>
> - How do I replace a virtual register with a physical one?
>
> - Do I need to generate spill code to handle virtual registers that
>   cannot be replaced with physical ones, and if so, how?
>
>
> Susan Horwitz
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list