[LLVMdev] TargetRegisterInfo and "infinite" register files

Jakob Stoklund Olesen
Tue, 17 May 2011 16:54:38 -0000

On May 17, 2011, at 9:18 AM, Andrew Clinton wrote:

> I have faced this same problem in my backend, and I'm working around it
by providing a large physical register set.  There are two problems with this:
>
> 1. There's a chance that the register allocator will run out of
registers to assign, in which case the allocation will fail - making it
necessary to retry with a larger register set
> 2. The code generator consumes storage proportional to the number of
registers that could be assigned
>
> I'd be interested in an improvement to the code generator that makes it
possible to specify an infinite register set without the need to store the
registers explicitly.

As I explained to Justin, allocating against an infinite register file
doesn't really do anything. It's a quadratic time no-op.

What you can do instead is:

1) Just use virtual registers and skip register allocation, or

2) Allocate to a small register file, implement memory operand folding, and
pretend that spill slots are registers.

/jakob