Given an architecture with two classes of registers: A is general purpose and has an "adequate" number of registers, and C which is special purpose and has very few (e.g. one) register. There are cheap instructions that directly copy from C to A and vice versa. If we need another C register and they are all live, we need to spill one. Currently as far as I can tell, the only way to do that is spill to the stack. Is there a knob I can turn to get the spill from C to go to an A register? Thanks, brian
Nemanja Ivanovic via llvm-dev
2020-Sep-09 18:13 UTC
[llvm-dev] spill to register not stack?
On PowerPC, we implemented support for spilling GPR registers to vector registers. Essentially, it requires specifying the correct register class in `getLargestLegalSuperClass()` as well as `storeRegToStackSlot()/loadRegFromStackSlot()`. You can see what is controlled with the `EnableGPRToVecSpills` option. If you also want to use this method for spilling callee-saved registers to other registers, you can do what we do on PPC in `assignCalleeSavedSpillSlots()` to specify the destination register. This should also ensure that the CFI directives are emitted correctly. Keep in mind that this can likely only be done for leaf functions since you'll likely be spilling these to caller-saved registers of the other class. Hope this helps, Nemanja On Wed, Sep 9, 2020 at 1:30 PM Bagel via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Given an architecture with two classes of registers: A is general purpose > and > has an "adequate" number of registers, and C which is special purpose and > has > very few (e.g. one) register. There are cheap instructions that directly > copy > from C to A and vice versa. > > If we need another C register and they are all live, we need to spill one. > Currently as far as I can tell, the only way to do that is spill to the > stack. > Is there a knob I can turn to get the spill from C to go to an A register? > > Thanks, > brian > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200909/02f3143c/attachment.html>
Quentin Colombet via llvm-dev
2020-Sep-09 18:48 UTC
[llvm-dev] spill to register not stack?
Hi Brian, +1 on what Nemanja said: specifying large register classes is the key. More details here: http://lists.llvm.org/pipermail/llvm-dev/2019-December/137700.html <http://lists.llvm.org/pipermail/llvm-dev/2019-December/137700.html> Cheers, -Quentin> On Sep 9, 2020, at 11:13 AM, Nemanja Ivanovic via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > On PowerPC, we implemented support for spilling GPR registers to vector registers. Essentially, it requires specifying the correct register class in `getLargestLegalSuperClass()` as well as `storeRegToStackSlot()/loadRegFromStackSlot()`. You can see what is controlled with the `EnableGPRToVecSpills` option. > > If you also want to use this method for spilling callee-saved registers to other registers, you can do what we do on PPC in `assignCalleeSavedSpillSlots()` to specify the destination register. This should also ensure that the CFI directives are emitted correctly. Keep in mind that this can likely only be done for leaf functions since you'll likely be spilling these to caller-saved registers of the other class. > > Hope this helps, > Nemanja > > > On Wed, Sep 9, 2020 at 1:30 PM Bagel via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote: > Given an architecture with two classes of registers: A is general purpose and > has an "adequate" number of registers, and C which is special purpose and has > very few (e.g. one) register. There are cheap instructions that directly copy > from C to A and vice versa. > > If we need another C register and they are all live, we need to spill one. > Currently as far as I can tell, the only way to do that is spill to the stack. > Is there a knob I can turn to get the spill from C to go to an A register? > > Thanks, > brian > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200909/fa8c11d0/attachment.html>
Reasonably Related Threads
- spill to register not stack?
- How to get Greedy RA to not spill results of trivially rematerializable instructions
- How to get Greedy RA to not spill results of trivially rematerializable instructions
- How to get Greedy RA to not spill results of trivially rematerializable instructions
- Disable spilling sub-registers in LLVM