[LLVMdev] Status of first-class aggregate types
clattner at apple.com
Sun Dec 20 17:08:35 PST 2009
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.
> 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,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev