<div dir="ltr"><div class="markdown-here-wrapper" style=""><p style="margin:0px 0px 1.2em!important">Hey Krzysztof,</p>
<p style="margin:0px 0px 1.2em!important">Yeah I mostly had issues with gluing the loads/stores.</p>
<blockquote style="margin:1.2em 0px;border-left-width:4px;border-left-style:solid;border-left-color:rgb(221,221,221);padding:0px 1em;color:rgb(119,119,119);quotes:none">
<p style="margin:0px 0px 1.2em!important">After the machine instructions are generated, the scheduler may place instructions between the interrupt disable/restore and the atomic load itself.  Also, the register allocator may insert some spills there—-there are ways that this sequence may get separated.</p>
</blockquote>
<p style="margin:0px 0px 1.2em!important">I didn’t think about that - it makes sense. It looks like building this in the MI stage is the only way.</p>
<blockquote style="margin:1.2em 0px;border-left-width:4px;border-left-style:solid;border-left-color:rgb(221,221,221);padding:0px 1em;color:rgb(119,119,119);quotes:none">
<p style="margin:0px 0px 1.2em!important">For this, the best approach may be to define a pseudo-instruction, which will be expanded into real instruction in the post-RA expansion pass</p>
</blockquote>
<p style="margin:0px 0px 1.2em!important">Agree</p>
<blockquote style="margin:1.2em 0px;border-left-width:4px;border-left-style:solid;border-left-color:rgb(221,221,221);padding:0px 1em;color:rgb(119,119,119);quotes:none">
<p style="margin:0px 0px 1.2em!important">If you need it only for the DAG nodes, you could try to manufacture your own load via the generic getNode, forcing glue into it, but that may be more effort than it’s worth.  Maybe lowering it into your target-specific node would be the best approach after all?</p>
</blockquote>
<p style="margin:0px 0px 1.2em!important">It seems pretty tricky to construct all these manually, I agree with your point.</p>
<p style="margin:0px 0px 1.2em!important">I will settle on pseudo instructions.</p>
<p style="margin:0px 0px 1.2em!important">Cheers Krzysztof and Anton :)</p>
<div title="MDH:SGV5IEtyenlzenRvZiw8ZGl2Pjxicj48L2Rpdj48ZGl2PlllYWggSSBtb3N0bHkgaGFkIGlzc3Vl
cyB3aXRoIGdsdWluZyB0aGUgbG9hZHMvc3RvcmVzLjwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+
Jmd0OyZuYnNwOzxzcGFu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OHB4OyI+PGJyPjwvc3Bh
bj48L2Rpdj48ZGl2PjxzcGFuIHN0eWxlPSJmb250LXNpemU6IDEyLjhweDsiPkkgd2lsbCBzZXR0
bGUgb24gcHNldWRvIGluc3RydWN0aW9ucy48L3NwYW4+PC9kaXY+PGRpdj48c3BhbiBzdHlsZT0i
Zm9udC1zaXplOiAxMi44cHg7Ij48YnI+PC9zcGFuPjwvZGl2PjxkaXY+PHNwYW4gc3R5bGU9ImZv
bnQtc2l6ZTogMTIuOHB4OyI+Q2hlZXJzJm5ic3A7PC9zcGFuPktyenlzenRvZiBhbmQgQW50b24g
Oik8L2Rpdj4=" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 10, 2016 at 9:40 AM, Krzysztof Parzyszek via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 6/3/2016 11:15 PM, Dylan McKay via llvm-dev wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I can’t figure out how I can glue all these nodes together and return<br>
the nonatomic load.<br>
</blockquote>
<br></span>
Hi Dylan,<br>
<br>
As Anton said, you would need to use glue values.  A node would take a glue as the last operand.  That is the input glue, and will cause the node to be glued to the node that produced it.  The output glue is one of the SDValues returned by the node (you can find out which one by looking at the dump).<br>
<br>
The DAG usually like this:<br>
<br>
Glue0 = MVT::Glue<br>
(..., Glue1, ...) = ISD::SOME_NODE_0 Op0, Op1, ..., Glue0<br>
(..., Glue2, ...) = ISD::SOME_NODE_1 Op0, Op1, ..., Glue1<br>
<br>
SOME_NODE_n would be created giving it MVT::Glue as the type of the last operand.  The problem is that getLoad does not accept glue operands, so there isn't an easy way to use it with loads, which, I think, is the problem you ran into.<br>
<br>
<br>
If you want to have these nodes stick together, using glue may not be sufficient.  After the machine instructions are generated, the scheduler may place instructions between the interrupt disable/restore and the atomic load itself.  Also, the register allocator may insert some spills there---there are ways that this sequence may get separated.<br>
<br>
For this, the best approach may be to define a pseudo-instruction, which will be expanded into real instruction in the post-RA expansion pass.<br>
<br>
<br>
If you need it only for the DAG nodes, you could try to manufacture your own load via the generic getNode, forcing glue into it, but that may be more effort than it's worth.  Maybe lowering it into your target-specific node would be the best approach after all?<span class="HOEnZb"><font color="#888888"><br>
<br>
-Krzysztof<br>
<br>
<br>
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</font></span></blockquote></div><br></div>