From b1e6b969fe72b5b616d3a169955d95cc0fb16a1e Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Sat, 4 Oct 2008 19:00:07 +0000 Subject: [PATCH] Update the documentation for first-class aggregates changes, and remove getresult and references thereto. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57064 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LangRef.html | 90 +++++++++++------------------------------------ 1 file changed, 20 insertions(+), 70 deletions(-) diff --git a/docs/LangRef.html b/docs/LangRef.html index a0412644892..ef232a6374a 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -153,7 +153,6 @@
  • 'select' Instruction
  • 'call' Instruction
  • 'va_arg' Instruction
  • -
  • 'getresult' Instruction
  • @@ -1899,27 +1898,30 @@ the 'invoke' instruction, the '
    Syntax:
    -
      ret <type> <value>       ; Return a value from a non-void function
    +
    +  ret <type> <value>       ; Return a value from a non-void function
       ret void                 ; Return from void function
    -  ret <type> <value>, <type> <value>  ; Return two values from a non-void function 
     
    Overview:
    -

    The 'ret' instruction is used to return control flow (and a -value) from a function back to the caller.

    +

    The 'ret' instruction is used to return control flow (and +optionally a value) from a function back to the caller.

    There are two forms of the 'ret' instruction: one that -returns value(s) and then causes control flow, and one that just causes +returns a value and then causes control flow, and one that just causes control flow to occur.

    Arguments:
    -

    The 'ret' instruction may return zero, one or multiple values. -The type of each return value must be a 'first -class' type. Note that a function is not well -formed if there exists a 'ret' instruction inside of the -function that returns values that do not match the return type of the -function.

    +

    The 'ret' instruction optionally accepts a single argument, +the return value. The type of the return value must be a +'first class' type.

    + +

    A function is not well formed if +it it has a non-void return type and contains a 'ret' +instruction with no return value or a return value with a type that +does not match its type, or if it has a void return type and contains +a 'ret' instruction with a return value.

    Semantics:
    @@ -1930,16 +1932,14 @@ the instruction after the call. If the caller was an "invoke" instruction, execution continues at the beginning of the "normal" destination block. If the instruction returns a value, that value shall set the call or invoke instruction's -return value. If the instruction returns multiple values then these -values can only be accessed through a 'getresult -' instruction.

    +return value.
    Example:
       ret i32 5                       ; Return an integer value of 5
       ret void                        ; Return from a void function
    -  ret i32 4, i8 2                 ; Return two values 4 and 2  
    +  ret { i32, i8 } { i32 4, i8 2 } ; Return an aggregate of values 4 and 2
     
    @@ -2049,9 +2049,7 @@ function, with the possibility of control flow transfer to either the "ret" instruction, control flow will return to the "normal" label. If the callee (or any indirect callees) returns with the "unwind" instruction, control is interrupted and -continued at the dynamically nearest "exception" label. If the callee function -returns multiple values then individual return values are only accessible through -a 'getresult' instruction.

    +continued at the dynamically nearest "exception" label.
    Arguments:
    @@ -4289,9 +4287,7 @@ transfer to a specified function, with its incoming arguments bound to the specified values. Upon a 'ret' instruction in the called function, control flow continues with the instruction after the function call, and the return value of the -function is bound to the result argument. If the callee returns multiple -values then the return values of the function are only accessible through -the 'getresult' instruction.

    +function is bound to the result argument.
    Example:
    @@ -4304,8 +4300,8 @@ the 'getresult' instruction.

    %struct.A = type { i32, i8 } %r = call %struct.A @foo() ; yields { 32, i8 } - %gr = getresult %struct.A %r, 0 ; yields i32 - %gr1 = getresult %struct.A %r, 1 ; yields i8 + %gr = extractvalue %struct.A %r, 0 ; yields i32 + %gr1 = extractvalue %struct.A %r, 1 ; yields i8 @@ -4358,52 +4354,6 @@ argument.

    - -
    - 'getresult' Instruction -
    - -
    - -
    Syntax:
    -
    -  <resultval> = getresult <type> <retval>, <index>
    -
    - -
    Overview:
    - -

    The 'getresult' instruction is used to extract individual values -from a 'call' -or 'invoke' instruction that returns multiple -results.

    - -
    Arguments:
    - -

    The 'getresult' instruction takes a call or invoke value as its -first argument, or an undef value. The value must have structure type. The second argument is a constant -unsigned index value which must be in range for the number of values returned -by the call.

    - -
    Semantics:
    - -

    The 'getresult' instruction extracts the element identified by -'index' from the aggregate value.

    - -
    Example:
    - -
    -  %struct.A = type { i32, i8 }
    -
    -  %r = call %struct.A @foo()
    -  %gr = getresult %struct.A %r, 0    ; yields i32:%gr
    -  %gr1 = getresult %struct.A %r, 1   ; yields i8:%gr1
    -  add i32 %gr, 42
    -  add i8 %gr1, 41
    -
    - -
    -
    Intrinsic Functions