[llvm-dev] scratch register for spill/reload

David Callahan via llvm-dev llvm-dev at lists.llvm.org
Sat Oct 9 09:00:45 PDT 2021

I have a target architecture with a register class that requires a GPR as a scratch register to implement spill and reload operations. I have experimented with just using a pseudo instruction then scavenging a GPR on demand when that pseudo is lowered but that is not robust. Is there a protocol to allow a point GPR to be allocated when a spill or reload is generated?
I tried to add a suitable virtual register as an implicit def, but this failed, at least in the fast register allocator, because the generated instruction is apparently not visited.
My fall back was to add an implicit definition of an ABI defined scratch physical register. That generated incorrect code for some tests with the default allocator.
How have other targets managed this problem?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211009/4e96cb50/attachment.html>

More information about the llvm-dev mailing list