llvm.org GIT mirror llvm / f642f47
Update function attributes docs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57197 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 12 years ago
1 changed file(s) with 37 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
748748 calling convention, a return type, an optional
749749 parameter attribute for the return type, a function
750750 name, a (possibly empty) argument list (each with optional
751 parameter attributes), an optional section, an
752 optional alignment, an optional garbage collector name,
751 parameter attributes), optional
752 function attributes, an optional section,
753 an optional alignment, an optional garbage collector name,
753754 an opening curly brace, a list of basic blocks, and a closing curly brace.
754755
755756 LLVM function declarations consist of the "declare" keyword, an
860861 value, but is also valid on pointers to scalars. The copy is considered to
861862 belong to the caller not the callee (for example,
862863 readonly functions should not write to
863 byval parameters).
864 byval parameters). This is not a valid attribute for return
865 values.
864866
865867
sret
866868
This indicates that the pointer parameter specifies the address of a
867869 structure that is the return value of the function in the source program.
868870 This pointer must be guaranteed by the caller to be valid: loads and stores
869871 to the structure may be assumed by the callee to not to trap. This may only
870 be applied to the first parameter.
872 be applied to the first parameter. This is not a valid attribute for
873 return values.
871874
872875
noalias
873876
This indicates that the parameter does not alias any global or any other
874877 parameter. The caller is responsible for ensuring that this is the case,
875 usually by placing the value in a stack allocation.
878 usually by placing the value in a stack allocation. This is not a valid
879 attribute for return values.
876880
877881
nest
878882
This indicates that the pointer parameter can be excised using the
879 trampoline intrinsics.
883 trampoline intrinsics. This is not a valid
884 attribute for return values.
880885
881886
882887
20402045
Syntax:
20412046
20422047

                  
                
2043 <result> = invoke [cconv] <ptr to function ty> <function ptr val>(<function args>)
2048 <result> = invoke [cconv] [
2049 ramattrs">RetAttrs] <ptr to function ty> <function ptr val>(<function args>)
20442050 to label <normal label> unwind label <exception label>
20452051
20462052
20652071 convention the call should use. If none is specified, the call defaults
20662072 to using C calling conventions.
20672073
2074
2075
  • The optional Parameter Attributes list for
  • 2076 return values. Only 'zeroext', 'signext',
    2077 and 'inreg' attributes are valid here.
    2078
    20682079
  • 'ptr to function ty': shall be the signature of the pointer to
  • 20692080 function value being invoked. In most cases, this is a direct function
    20702081 invocation, but indirect invokes are just as possible, branching off
    20852096
  • 'exception label': the label reached when a callee returns with
  • 20862097 the unwind instruction.
    20872098
    2099
  • The optional function attributes list. Only
  • 2100 'noreturn', 'nounwind', 'readonly' and
    2101 'readnone' attributes are valid here.
    20882102
    20892103
    20902104
    Semantics:
    42344248
    42354249
    Syntax:
    42364250
    
                      
                    
    4237 <result> = [tail] call [cconv] <ty> [<fnty>*] <fnptrval>(<param list>)
    4251 <result> = [tail] call [cconv] [RetAttrs] <ty> [<fnty>*] <fnptrval>(<param list>)
    42384252
    42394253
    42404254
    Overview:
    42584272 convention the call should use. If none is specified, the call defaults
    42594273 to using C calling conventions.
    42604274
    4275
    4276
  • 4277

    The optional Parameter Attributes list for

    4278 return values. Only 'zeroext', 'signext',
    4279 and 'inreg' attributes are valid here.

    4280
    4281
    42614282
  • 42624283

    'ty': the type of the call instruction itself which is also

    42634284 the type of the return value. Functions that return no value are marked
    42824303 indicates the function accepts a variable number of arguments, the extra
    42834304 arguments can be specified.

    42844305
    4306
  • 4307

    The optional function attributes list. Only

    4308 'noreturn', 'nounwind', 'readonly' and
    4309 'readnone' attributes are valid here.

    4310
    42854311
    42864312
    42874313
    Semantics:
    43034329 call void %foo(i8 97 signext)
    43044330
    43054331 %struct.A = type { i32, i8 }
    4306 %r = call %struct.A @foo() ; yields { 32, i8 }
    4332 %r = call %struct.A @foo() ; yields { 32, i8 }
    43074333 %gr = extractvalue %struct.A %r, 0 ; yields i32
    43084334 %gr1 = extractvalue %struct.A %r, 1 ; yields i8
    4335 %Z = call void @foo() noreturn ; indicates that foo never returns nomrally
    4336 %ZZ = call zeroext i32 @bar() ; Return value is zero extended
    43094337
    43104338
    43114339