Tyler Kenney via llvm-dev
2016-Aug-23 21:35 UTC
[llvm-dev] Help in understanding physreg LiveVariables
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
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>
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/6ffffac5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20160823/6ffffac5/attachment.gif>
Matthias Braun via llvm-dev
2016-Aug-23 21:37 UTC
[llvm-dev] Help in understanding physreg LiveVariables
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>
Tyler Kenney via llvm-dev
2016-Aug-24 14:08 UTC
[llvm-dev] Help in understanding physreg LiveVariables
Okay, will try it out. Thanks a lot for the help, I think it's becoming
more and more clear that I ought to re-design the frontend and make all the
decisions about which buffers are going to live on the stack and which are
going to live in the register file during a new pre-ISel IR-level pass. It
seems like a design of that nature would be much more consistent with llvm
and allow both ISel and RA to function much more normally, but I'm hoping
to get away with the current design for at least a little while longer
while I finalize some post-ISel stuff.
Cheers,
Tyler
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:37 PM
Subject: Re: [llvm-dev] Help in understanding physreg LiveVariables
Sent by: mbraun at apple.com
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> 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/20160824/c8152cdd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20160824/c8152cdd/attachment.gif>