[LLVMdev] Structure returns to-do or not-to-do?

Renato Golin renato.golin at arm.com
Thu Oct 21 06:16:20 PDT 2010


On 21 October 2010 00:53, Roger <roger83 at hotmail.co.uk> wrote:
> Thanks, I thought this might be the case. At the moment I don't care about
> ABI compatibility, but eventually I might. I was more concerned that the
> backends might not correctly handle the case of returning large structures,
> which as Kenneth points out, is partially true. I think I'll just follow by
> example for now.

Hi Roger,

Beware that some back-end might not even understand the ByVal
structure return / arg passing, even if that's conforming to the ABI.

For instance, the ARM back-end converts an array as ByVal correctly in
all cases, but not necessarily all structures, so the front-end has to
pass a cast to array, even though for other platforms (and ARM ABI
compliance), a stuct ByVal would do perfectly fine.

As a rule of thumb, do what Clang/llvm-gcc does in terms of IR and you
avoid a lot of trouble.

cheers,
--renato



More information about the llvm-dev mailing list