[llvm-dev] Spills on second bank of registers

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 21 02:02:40 PDT 2019


Hi Joan,

On Tue, 20 Aug 2019 at 08:29, Joan Lluch <joan.lluch at icloud.com> wrote:
> I assumed that, by default, LLVM would figure out that there are free registers (albeit from a different register class) and would use them as temporaries instead of creating stack spills of the regular register set. However this is not the case. The stack spills are created anyway despite being registers unused on the second register bank.

As far as I know LLVM doesn't have this ability. The ARM CPUs that can
only run Thumb1 code (e.g. Cortex-M0) could theoretically benefit from
such a scheme too, but no-one has so far thought it worth
implementing.

I'm afraid I've not really looked into the details of how LLVM
allocates stack slots, but that would be the obvious place to add the
ability generically. It would have to be a new kind of slot that's
(probably) volatile across function calls, unlike normal ones.

Alternatively, you could always try a MachineFunctionPass to peephole it.

Cheers.

Tim.


More information about the llvm-dev mailing list