[LLVMdev] struct returns

Dan Gohman gohman at apple.com
Tue Sep 15 09:55:37 PDT 2009


On Sep 15, 2009, at 8:32 AM, Kenneth Uildriks wrote:

> In the latest snapshot from SVN on X86, llc refuses to compile
> functions returning structs larger than two i32 members.
>
> According to the docs, such limitations can be expected to exist on
> other platforms.
>
> This leads to a number of questions and observations:
>
> 1. Is there a good way to retrieve the current target limitations on
> struct return sizes?

No.  The information can be inferred from what's in the *CallingConv.td
files, though there are currently no utilities specifically for this.

> 2. The sretpromotion pass does not take struct size limitations into
> account; it will happily convert an sret parameter with five members
> into a return value that llc chokes on.
>
> 3. There is no sretdemotion pass.
>
> 4. If the answer to #1 is "no", perhaps we need platform-specific
> sretpromotion and sretdemotion passes to allow small struct returns to
> happen efficiently while large struct returns can be successfully
> codegen'd, all without having to build such platform-specific
> knowledge into all front-ends.

Sure. Alternatively, we could fix codegen to do this itself.  I'd be
happy to help anyone interested in working on this.

I recently made a major reorganization of the calling-convention
lowering code which cleared away one of the major obstacles to
doing this within codegen.

Dan




More information about the llvm-dev mailing list