[LLVMdev] Status of first-class aggregate types

Talin viridia at gmail.com
Tue Dec 22 12:56:16 PST 2009

On Sun, Dec 20, 2009 at 5:08 PM, Chris Lattner <clattner at apple.com> wrote:

> On Dec 20, 2009, at 10:27 AM, Talin wrote:
> 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.
>>  OK, thanks for that confirmation, now I can proceed ahead with less
> trepidation. :)
> 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.
> 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.
> In case anyone on this list is interested, I wrote up my solution to the
treatment of small aggregates on my blog here:

> 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 :)
> I don't think so,
> -Chris

-- Talin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091222/5548614e/attachment.html>

More information about the llvm-dev mailing list