structured types as function arguments


When calling a function, does the llvm code generator support passing structured types (arrays, structs, etc.) by _value_? I wrote some small examples, and it seemed
to work, but I was wondering if anything can go wrong if the structured types are very large...


It should work; the generated code for passing a large struct value
(as opposed to using the byval attribute) gets to be rather
inefficient, but I don't know of any correctness bugs.



Did you implement your example directly in llvm assembly?

If so, you may find that the way structures are passed doesn't match
the calling convention of the target system. This is definitely true
on X86-64, where the complicated AMD64 ABI has not been implemented in
the X86 backend.

- pdox

This was asked and answered a few days ago (Re: [LLVMdev] Pass a struct on windows):