[LLVMdev] Inreg firstclass structs

Eli Friedman eli.friedman at gmail.com
Tue Jul 8 10:28:28 PDT 2008


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

That said, since it isn't supported, I don't have any objections to
disabling it for the moment. If I recall correctly, it already
asserts, so this would mostly be a documentation change.

-Eli



More information about the llvm-dev mailing list