[llvm-dev] Help in understanding physreg LiveVariables

Matthias Braun via llvm-dev llvm-dev at lists.llvm.org
Tue Aug 23 14:37:07 PDT 2016


This is probably the first target building PHIs in the selection DAG, but I don't see a reason why it wouldn't work.

- Matthias

> On Aug 23, 2016, at 2:35 PM, Tyler Kenney <tjkenney at us.ibm.com> wrote:
> 
> So if I first create the value in an entry BB and then build a CopyToReg but then I have to read it in a BB that loops back to itself, with it's own CopyToReg at the end, then I have two CopyToReg nodes for the same value. In this case, I need to create 3 virt regs, 1 for each CopyToReg and a third for the CopyFromReg in the beginning of the loop BB, right? And then I need to build a PHI instruction at the beginning of the loop MBB that relates the 3 virt regs, right? Is there anything else I need to do regarding the creation of the new phi instruction, do you know?
> 
> Tyler
> 
> 
> <graycol.gif>Matthias Braun ---08/23/2016 05:17:14 PM---> On Aug 23, 2016, at 2:07 PM, Tyler Kenney <tjkenney at us.ibm.com> wrote: >
> 
> From: Matthias Braun <mbraun at apple.com>
> To: Tyler Kenney/Marlborough/IBM at IBMUS
> Cc: llvm-dev at lists.llvm.org
> Date: 08/23/2016 05:17 PM
> Subject: Re: [llvm-dev] Help in understanding physreg LiveVariables
> Sent by: mbraun at apple.com
> 
> 
> 
> 
> On Aug 23, 2016, at 2:07 PM, Tyler Kenney <tjkenney at us.ibm.com <mailto:tjkenney at us.ibm.com>> wrote:
> So if I create a value with a DAG.getUndef(myVT); call during instruction legalization, how can I access that value as input in another BB/DAG (also during instruction legalization) without worrying about live-ins and/or phi nodes? 
> 
> Can I create a single virtual register and build both a CopyToReg and a CopyFromReg node with it? I assumed that would break SSA.
> 
> Yes in Selection to you need to use CopyToReg/CoptFromReg to write to/from vregs that should cross basic blocks. Yes indeed this currently has to respect SSA form, so there should only be a single CopyToReg for each vreg and that def should dominate all users.
> 
> Perhaps I should have said that what stops me is that I don't know how to pass a newly created virtual register from one MBB/DAG to another.
> You have to remember the number somewhere, so you can use CopyFromReg on the vreg.
> 
> - Matthias
> 
> 

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


More information about the llvm-dev mailing list