[LLVMdev] [Query] Programming Register Allocation

Gergö Barany gergo at complang.tuwien.ac.at
Sun Aug 29 05:45:00 PDT 2010


On Sat, Aug 28, 2010 at 16:20:42 -0400, Jeff Kunkel wrote:
> What I need to know is how to access the machine register classes. Also, I
> need to know which virtual register is to be mapped into each specific
> register class. I assume there is type information on the registers. I need
> to know how to access it.

MachineRegisterInfo::getRegClass will give you the TargetRegisterClass for a
given virtual register. Each TargetRegisterClass has an "allocation order"
that enumerates all physical registers valid for that class.

> And a afterthought, does LLVM place casts into
> different virtual registers, or do I need to include casting of floats to
> integers or vice versa when I see ADD i32 float i32?

The instruction selector creates all necessary conversion instructions.

-- 
Gergö Barany, research assistant                   gergo at complang.tuwien.ac.at
Institute of Computer Languages        http://www.complang.tuwien.ac.at/gergo/
Vienna University of Technology                         Tel: +43-1-58801-58522
Argentinierstrasse 8/E185, 1040 Wien, Austria           Fax: +43-1-58801-18598



More information about the llvm-dev mailing list