[LLVMdev] Two new 'llvmnotes'

Dan Gohman gohman at apple.com
Mon May 5 15:02:05 PDT 2008


Hi Talin,

On May 5, 2008, at 1:13 AM, Talin wrote:

> Chris Lattner wrote:
>> Aggregates as First Class Values:
>> http://nondot.org/sabre/LLVMNotes/FirstClassAggregates.txt
>>
> Thinking more about this...I kinda wish it was available right *now*,
> because I sure could use it. I've been working on functions returning
> structures today, and in the current IR I basically have two choices:
> Either return the struct using multiple return values (which means
> flattening any nested structs inside the struct to be returned, since
> AFAICT return values have to be first class, and then re-assembling  
> the
> structure at the call site), or passing an extra argument which points
> to the struct to be filled in.

I'm planning to start working on this after the 2.3 release branch is
created. Would you be interested in helping?

> In my opinion, that's a level of detail that the frontend really
> shouldn't have to know or care about. The code generator should be  
> able
> to make that decision based on the platform ABI and other
> target-specific criteria, and the frontend has no business worrying
> about any of these issues.


If you just need a convenient way to deal with relatively small
numbers of values grouped together in an efficient manner, this
new feature will be very useful.

If you need to generate code to be directly linked with C code
that uses arbitrary struct argument or return types, this feature
will be only a small step. Front-ends will still need to know
quite a lot about how structs are handled in the ABI if they want
to be compatible with other C compilers.

Dan




More information about the llvm-dev mailing list