[LLVMdev] Inreg firstclass structs

Chris Lattner sabre at nondot.org
Wed Jul 9 21:42:39 PDT 2008


On Jul 8, 2008, at 10:28 AM, Eli Friedman wrote:

> On Tue, Jul 8, 2008 at 2:28 AM, Matthijs Kooijman  
> <matthijs at stdin.nl> wrote:
>> Hi all,
>>
>> I've been discussing parameter attributes and their impact on first- 
>> class
>> struct parameters. Duncan and I came to the conclusion that the  
>> only attribute
>> that could be applied to structs currently, is the inreg attribute.  
>> However,
>> since there is no support anywhere for that currently  
>> (transformation passes
>> and backends?), it might be better to disallow the inreg attribute  
>> for struct
>> parameters and return values for now.
>>
>> AFAICS, this would require modification to  
>> ParamAttr::typeIncompatible and the
>> langref.
>>
>> Any objections?
>
> MO, inreg sounds like a great way to distinguish between byval structs
> that should be passed/returned in memory and those that should be
> passed in registers, especially in situations where the same LLVM
> struct should be passed/returned in different ways depending on the
> type in the source code. (For example, if I recall correctly, x86
> distinguishes between returning a struct with 2 floats and a complex
> float, and the obvious way to encode that distinction into the
> assembly language is with inreg.)

I agree.  Long term, we want to be able to handle certain x86-64 ABI  
situations just like this.

-Chris



More information about the llvm-dev mailing list