From f642f4707f427649b0c131c548306bad3f28ddaf Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 6 Oct 2008 18:50:38 +0000 Subject: [PATCH] Update function attributes docs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57197 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 46 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/docs/LangRef.html b/docs/LangRef.html index b8b2add31e6..58147969827 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -749,8 +749,9 @@ an optional linkage type, an optional calling convention, a return type, an optional parameter attribute for the return type, a function name, a (possibly empty) argument list (each with optional -parameter attributes), an optional section, an -optional alignment, an optional garbage collector name, +parameter attributes), optional +function attributes, an optional section, +an optional alignment, an optional garbage collector name, an opening curly brace, a list of basic blocks, and a closing curly brace. LLVM function declarations consist of the "declare" keyword, an @@ -861,23 +862,27 @@ declare signext i8 @returns_signed_char() value, but is also valid on pointers to scalars. The copy is considered to belong to the caller not the callee (for example, readonly functions should not write to - byval parameters). + byval parameters). This is not a valid attribute for return + values.
sret
This indicates that the pointer parameter specifies the address of a structure that is the return value of the function in the source program. This pointer must be guaranteed by the caller to be valid: loads and stores to the structure may be assumed by the callee to not to trap. This may only - be applied to the first parameter.
+ be applied to the first parameter. This is not a valid attribute for + return values.
noalias
This indicates that the parameter does not alias any global or any other parameter. The caller is responsible for ensuring that this is the case, - usually by placing the value in a stack allocation.
+ usually by placing the value in a stack allocation. This is not a valid + attribute for return values.
nest
This indicates that the pointer parameter can be excised using the - trampoline intrinsics.
+ trampoline intrinsics. This is not a valid + attribute for return values. @@ -2041,7 +2046,8 @@ branches or with a lookup table.

Syntax:
-  <result> = invoke [cconv] <ptr to function ty> <function ptr val>(<function args>) 
+  <result> = invoke [cconv] [RetAttrs] <ptr to function ty> <function ptr val>(<function args>) 
                 to label <normal label> unwind label <exception label>
 
@@ -2066,6 +2072,11 @@ continued at the dynamically nearest "exception" label. convention the call should use. If none is specified, the call defaults to using C calling conventions. + +
  • The optional Parameter Attributes list for + return values. Only 'zeroext', 'signext', + and 'inreg' attributes are valid here.
  • +
  • 'ptr to function ty': shall be the signature of the pointer to function value being invoked. In most cases, this is a direct function invocation, but indirect invokes are just as possible, branching off @@ -2086,6 +2097,9 @@ continued at the dynamically nearest "exception" label.
  • 'exception label': the label reached when a callee returns with the unwind instruction.
  • +
  • The optional function attributes list. Only + 'noreturn', 'nounwind', 'readonly' and + 'readnone' attributes are valid here.
  • Semantics:
    @@ -4235,7 +4249,7 @@ by element.
    Syntax:
    -  <result> = [tail] call [cconv] <ty> [<fnty>*] <fnptrval>(<param list>)
    +  <result> = [tail] call [cconv] [RetAttrs] <ty> [<fnty>*] <fnptrval>(<param list>)
     
    Overview:
    @@ -4259,6 +4273,13 @@ by element. convention the call should use. If none is specified, the call defaults to using C calling conventions. + +
  • +

    The optional Parameter Attributes list for + return values. Only 'zeroext', 'signext', + and 'inreg' attributes are valid here.

    +
  • +
  • 'ty': the type of the call instruction itself which is also the type of the return value. Functions that return no value are marked @@ -4283,6 +4304,11 @@ by element. indicates the function accepts a variable number of arguments, the extra arguments can be specified.

  • +
  • +

    The optional function attributes list. Only + 'noreturn', 'nounwind', 'readonly' and + 'readnone' attributes are valid here.

    +
  • Semantics:
    @@ -4304,9 +4330,11 @@ function is bound to the result argument. call void %foo(i8 97 signext) %struct.A = type { i32, i8 } - %r = call %struct.A @foo() ; yields { 32, i8 } + %r = call %struct.A @foo() ; yields { 32, i8 } %gr = extractvalue %struct.A %r, 0 ; yields i32 %gr1 = extractvalue %struct.A %r, 1 ; yields i8 + %Z = call void @foo() noreturn ; indicates that foo never returns nomrally + %ZZ = call zeroext i32 @bar() ; Return value is zero extended