[llvm-dev] Register constraints for implicit register usage

Quentin Colombet via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 29 11:59:30 PDT 2021


Hi David,

I am not sure I understand what you’re trying to achieve.

If you want to model implicit references, you should be able to do that directly by adding implicit x0 references on the related instructions.
You can take a look at how X86 treats EFLAGS for instance.

Cheers,
-Quentin

> On Mar 28, 2021, at 12:04 PM, David Callahan via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> I am working on a machine with a special register class which here I will call  Xrc containing registers X0..Xk.  
> 
> Some instructions implicitly reference X0. I am modeling this with a pseudo instruction that makes that reference explicit and created a register class X0rc which just contains X0.  This seems to work fine and SelectionDAG introduces copies between the two register classes where I would expect them. 
> 
> The problem I face is that MachineCSE::PerformTrivialCopyPropagation eliminates these copies and effectively changes the register class for the output register of unconstrained instructions to be X0rc. This is done so aggressively that I end up with multiple overlapping live ranges and so values are constantly being spilled and reloaded. Also, it creates situations where multiple operands of an instruction are bound to this class and so register allocation fails. 
> 
> What is the preferred way to handle this kind of situation?   
> 
> Thanks 
> 
> david 
> 
> 
> _______________________________________________
> 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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210329/a2d4ee72/attachment.html>


More information about the llvm-dev mailing list