[LLVMdev] First-class aggregate semantics
dllaurence at dslextreme.com
Thu Jan 7 19:57:17 PST 2010
On 01/07/2010 06:52 PM, Jon Harrop wrote:
> No. The idea is that you pass the structs around as values and not that you
> alloca them and pass by reference/pointer.
OK, then I need to learn more syntax (which Alistair Lynn got me started
on, it appears :-).
> No. LLVM is trusting you not to return pointers to locals.
How naive. :-)
> I have had great success with my HLVM project by passing around large numbers
> of large structs by hand. LLVM has not only survived but actually generated
> decent code that beats most languages according to my benchmarks.
That's good to know, because I prefer the style of returning structs
rather than passing around pointers or using static data. I'll be happy
to convert my lexer over to returning structs instead of pulling
> ...LLVM cannot make that
> decision because it depends upon the ABI. C99 apparently returns user-defined
> structs of two doubles by reference but complex numbers in registers. So the
> ABI requires knowledge of the front-end and, therefore, LLVM cannot fully
> automate this.
Huh. I'd never have guessed (and would have been quite annoyed if I
had, since numerical code is often at the edge of whatever the computing
budget is (meaning the problem was the largest one the researcher could
afford to solve, not the one he wished he was solving).
> Something LLVM could do is spill safely when it knows you don't care about the
> foreign ABI (e.g. with fastcc) and that work is underway.
More information about the llvm-dev