On Sun, Dec 20, 2009 at 5:08 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div style="word-wrap:break-word"><div><div>On Dec 20, 2009, at 10:27 AM, Talin wrote:</div><blockquote type="cite"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204, 204, 204);border-left-style:solid;padding-left:1ex">

<div style="word-wrap:break-word"><div>I'd pass them by value if they are small but by reference if they are large.  Passing large tuples by value isn't going to provide a win.</div><div><br></div></div></blockquote>

<div>

OK, thanks for that confirmation, now I can proceed ahead with less trepidation. :)</div><div><br></div><div>For large aggregates (well, not huge, but the size of a typical structure or class), do you recommend representing them as SSA values internally within a function, or using allocas? That is, even if they are going to be passed by reference, the question is whether they should also be internally represented that way.</div>

</div></blockquote><div><br></div>Either way should work fine, do whatever works best in your frontend.  Manipulating it as a first class value will probably generate slightly better code because the optimizer will scalarize it completely.  Treating it like an alloca will depend on alias analysis more to get better code.</div>

<div><br></div></div></blockquote><div>In case anyone on this list is interested, I wrote up my solution to the treatment of small aggregates on my blog here: <a href="http://machinewords.blogspot.com/2009/12/more-progress-on-tuples.html">http://machinewords.blogspot.com/2009/12/more-progress-on-tuples.html</a> </div>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div></div><div><blockquote type="cite"><div class="gmail_quote"><div>The other question I'd have is whether there's a good target-independent test (it can be a conservative test) to know whether or not something can be passed / returned as an SSA value. At the moment I am using a really dodgy heuristic. Of course, I realize that this would be a much better decision to make after I've selected a target, but that requires my linker to re-write function signatures which frankly I am not sure how to do :)</div>



</div></blockquote></div><br><div>I don't think so,</div><div><br></div><font color="#888888"><div>-Chris</div></font></div></blockquote></div><br><br clear="all"><br>-- <br>-- Talin<br>