[LLVMdev] parameter attributes and function types

Eli Friedman eli.friedman at gmail.com
Mon Mar 1 20:28:13 PST 2010


On Mon, Mar 1, 2010 at 8:20 PM, james woodyatt <jhw at conjury.org> wrote:
> On Mar 1, 2010, at 09:56, james woodyatt wrote:
>> On Mar 1, 2010, at 04:43, Duncan Sands wrote:
>>>
>>> Where exactly?  I don't see it in the online version.
>>
>> See <http://llvm.org/docs/LangRef.html#t_function> and look at the second example:
>>
>>       float (i16 signext, i32 *) *
>>
>>       Pointer to a function that takes an i16 that should be sign extended
>>       and a pointer to i32, returning float.
>>
>> Hence, my confusion over the issue.  If parameter attributes aren't included in function types, then I'd like to know how to call a function through a pointer of the type in the example above.  I must be failing still to comprehend an important concept in the language.
>
> I'm sorry to pester about this, but I was really hoping somebody could straighten me out about this.  The Language Reference really does seem to be ambiguous about this, and I'm willing to compose a patch to fix it, but I need to know what the document should actually say to match the code.

Attributes, including signext, are not part of the type.

> Should the reference document not be showing parameter attributes in function types?  If that's the case, then how does one call a function through a pointer where, for example, one of the parameters is declared with the 'inreg' parameter attribute?  I suppose the parameter attributes could be applied in the <function args> part of the 'call' instruction, but if that's the case, then *that* isn't clear from the documentation.

Attributes can be attached to function declarations and to calls.  For
attributes like signext, the attribute needs to be attached to both to
work properly.

-Eli




More information about the llvm-dev mailing list