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

Marc de Kruijf dekruijf at cs.wisc.edu
Wed Jul 2 18:37:25 PDT 2008


> 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.

Is there anyway to do it using the C++ API?  It seems I need an
instance of the aggregate type to pass into InsertValueInst::Create().
 What is the API equivalent of "undef"?

Marc

On Wed, Jul 2, 2008 at 6:54 PM, Dan Gohman <gohman at apple.com> wrote:
> 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
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>



More information about the llvm-dev mailing list