[LLVMdev] Two new 'llvmnotes'

Talin viridia at gmail.com
Mon May 5 20:55:39 PDT 2008


Dan Gohman wrote:
> 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?
>   
Possibly; I know a lot more about frontends than backends though.
>> 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.
>   
Well, one of my goals is to support a robust FFI - programmers in my 
language should be able to declare "native" functions that use the C 
ABI. However, these native declarations can require a certain number of 
additional annotations, and there's no requirement that functions that 
aren't declared as native be compatible with the C ABI.
> Dan
>
> _______________________________________________
> 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