<html><body><p>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? <br><br>Can I create a single virtual register and build both a CopyToReg and a CopyFromReg node with it? I assumed that would break SSA.<br><br>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.<br><br>Tyler<br><br><br><img width="16" height="16" src="cid:1__=0ABB0A8BDFE01A308f9e8a93df938690918c0AB@" border="0" alt="Inactive hide details for Matthias Braun ---08/23/2016 04:43:08 PM---> On Aug 23, 2016, at 1:38 PM, Tyler Kenney <tjkenney@us.i"><font color="#424282">Matthias Braun ---08/23/2016 04:43:08 PM---> On Aug 23, 2016, at 1:38 PM, Tyler Kenney <tjkenney@us.ibm.com> wrote: ></font><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">Matthias Braun <mbraun@apple.com></font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">Tyler Kenney/Marlborough/IBM@IBMUS</font><br><font size="2" color="#5F5F5F">Cc:        </font><font size="2">llvm-dev@lists.llvm.org</font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">08/23/2016 04:43 PM</font><br><font size="2" color="#5F5F5F">Subject:        </font><font size="2">Re: [llvm-dev] Help in understanding physreg LiveVariables</font><br><font size="2" color="#5F5F5F">Sent by:        </font><font size="2">mbraun@apple.com</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br>
<ul><ul><font size="4">On Aug 23, 2016, at 1:38 PM, Tyler Kenney <</font><a href="mailto:tjkenney@us.ibm.com"><u><font size="4" color="#0000FF">tjkenney@us.ibm.com</font></u></a><font size="4">> wrote:</font><br><br><font face="Arial">Matthias,</font><br><font face="Arial"> </font><br><font face="Arial">Thanks for the response.</font><br><font face="Arial"> </font><br><font face="Arial">In short, I'm using physregs because my current design, in some cases, needs to create an entirely new var/reg during instruction legalization. This value can be passed from one basic block to another and, therefore, must be added as a live-in to a number of basic blocks. I was unable to find a way to add a virt reg as a live-in to an MBB, thus the need for physregs. I asked about adding new inputs & outputs to basic blocks during instruction legalization/selection earlier on:</font><br><font face="Arial"> </font><br><a href="http://lists.llvm.org/pipermail/llvm-dev/2016-June/100387.html"><u><font color="#0000FF" face="Arial">http://lists.llvm.org/pipermail/llvm-dev/2016-June/100387.html</font></u></a><br><font face="Arial"> </font><br><font face="Arial">Tim Northover responded with some useful insight but I did not really get a direct answer to my question on how to add MBB inputs (or if it's possible). The solution that I developed myself is to use virtual registers within MBBs and build CopyFrom/ToReg nodes at the BB boundaries with a physreg number, then add this physreg as a live-in where appropriate. This has been working for a few weeks now and, until I discovered this new issue where my live-in is ignored, had no known issues.</font><br><font face="Arial"> </font><br><font face="Arial">So, to answer your question, what stops me from copying the physreg to a virtual register after the last def (and also stops me from avoiding pre-RA physregs entirely) is that I do not know how to add a virt reg live-in (and ensure the proper phi nodes get updated/created).</font><br><font face="Arial"> </font><br><font face="Arial">If it's assumed that allocatable (and unreserved) PhysRegs are only live within a basic block, why is it possible to add such a physreg as an MBB live-in? Should there be an assertion added to MachineBasicBlock::addLiveIn() ?</font></ul></ul><font size="4">You should not need to worry about live-ins, they are only assumed to complete after register allocation. The only exception to this rule is the exception value on the edge to a landing part being marked as live-in and the per-function live-ins for arguments, but you should not need to worry about those two cases.</font><br><br><font size="4">- Matthias</font><br><br><br><BR>
</body></html>