[LLVMdev] Plans considering first class structs and multiple return values

Dan Gohman gohman at apple.com
Wed Jul 2 16:54:54 PDT 2008


Hello,

The basic infrastructure is in place. You can create first-class
structs/arrays using sequences of insertvalue.

For example, this:

   %t0 = insertvalue { i32, i32 } undef, i32 %a, 0
   %t1 = insertvalue { i32, i32 } %t0,   i32 %b, 1

creates the value with %a and %b as member values. Other ways to
produce aggregate values are loads, function arguments, function
return values, and literal constants.

It's all pretty new and hasn't seen much exposure, so one of
the things it needs right now is for people to try it out and
see how it goes.

There is work yet to be done in several of the optimization
components. And codegen can't yet handle aggregate return
values larger than what fits in designated return value
registers. I'm planning to have LLVM auto-upgrade the
multiple-return-value constructs that exist in LLVM 2.3,
which should give it quite a bit of exposure, though that
probably won't happen for a while.

And while I'm here, I want to emphasize that this feature does
not completely solve the problem of C-oriented ABI-compliant
passing/returning of structs. That's a complicated problem, and
unfortunately it is beyond the immediate scope of this feature.

Dan

On Jul 2, 2008, at 3:00 PM, Marc de Kruijf wrote:

> Hi, I'm really interested in this effort.  What is its status?  Is any
> of it in svn yet?  (I only see the insert/extract value instructions
> so far... nothing w.r.t. creating a first-class struct/array).  Can I
> do anything to help?
>
> Marc




More information about the llvm-dev mailing list