[llvm-dev] scratch register for spill/reload

32 views
Skip to first unread message

David Callahan via llvm-dev

unread,
Oct 9, 2021, 12:00:51 PM10/9/21
to LLVM Dev Mailing list

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? 

Thanks 

david 

 


Peter Bergner via llvm-dev

unread,
Oct 11, 2021, 1:42:58 PM10/11/21
to David Callahan, LLVM Dev Mailing list

I can't answer how the ppc backend solves this, but the condition registers and link
register on ppc/ppc64 have no load and store registers, so to spill them, you first
have to copy them to/from a GPR and spill them that way. If this is similar to your
register class limitation, you could see how the ppc backend does this.

Peter
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Reply all
Reply to author
Forward
0 new messages