[LLVMdev] struct returns

Kenneth Uildriks kennethuil at gmail.com
Tue Sep 15 08:32:00 PDT 2009

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?

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.

More information about the llvm-dev mailing list