[LLVMdev] Spilling predicate registers

Arnold Schwaighofer arnolds at codeaurora.org
Fri Dec 9 14:03:29 PST 2011

> I am not sure extending the scavenger is the right way to go about this.
> There are two different situations where we might need extra registers to
> spill something:
> 1. When spilling a weird register class like predicate registers, we
> already known during register allocation that we will need a scratch GPR
> to assist with the spill.
> 2. When spilling to a stack slot that may be out of reach of the offset
> encoding.
> The scavenger is really meant to handle the second case, although there is
> nothing wrong with using it for the first case as well.
> However, in the first case we know immediately that a scratch register is
> necessary, so why not just ask the register allocator for one?  Basically,
> I think storeRegToStackSlot should be allowed to call
> MRI->createVirtualRegister() when it needs a scratch register.

That was an alternative I was looking at (extending the scavenger seemed
the quicker fix). The greedy allocator would just add the new live range
to the queue? I have not looked at the implications for fast.

We would definitely benefit from support like this in the allocator (who
can make better decisions than if the scavenger ends up spilling

- Arnold

Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum.

More information about the llvm-dev mailing list