From f4cde4ec8197819bf872e551455c8a2e4c4864ab Mon Sep 17 00:00:00 2001
From: Chris Lattner
Date: Wed, 23 Apr 2008 04:59:35 +0000
Subject: [PATCH] fix description of 'ret' to be more correct with multiple
return values. Clarify that it is impossible to 'multiply return' a struct
with zero elements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50131 91177308-0d34-0410-b5e6-96231b3b80d8
---
docs/LangRef.html | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/docs/LangRef.html b/docs/LangRef.html
index f2fa698e09f..9679291125a 100644
--- a/docs/LangRef.html
+++ b/docs/LangRef.html
@@ -1223,17 +1223,21 @@ type "{ i32, [0 x float]}", for example.
+
Overview:
+
The function type can be thought of as a function signature. It
consists of a return type and a list of formal parameter types. The
-return type of a function type is a scalar type or a void type or a struct type.
+return type of a function type is a scalar type, a void type, or a struct type.
If the return type is a struct type then all struct elements must be of first
-class types. Function types are usually used to build virtual function tables
-(which are structures of pointers to functions), for indirect function
-calls, and when defining a function.
+class types, and the struct must have at least one element.
Syntax:
-
<returntype list> (<parameter list>)
+
+
+ <returntype list> (<parameter list>)
+
+
...where '<parameter list>' is a comma-separated list of type
specifiers. Optionally, the parameter list may include a type ...,
which indicates that the function takes a variable number of arguments.
@@ -1241,6 +1245,7 @@ Variable argument functions can access their arguments with the variable argument handling intrinsic functions.
'<returntype list>' is a comma-separated list of
first class type specifiers.
+
Examples:
@@ -1802,19 +1807,26 @@ Instruction
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.
There are two forms of the 'ret' instruction: one that
-returns a value and then causes control flow, and one that just causes
+returns value(s) and then causes control flow, and one that just causes
control flow to occur.
+
Arguments:
-The 'ret' instruction may return 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 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.
+
Semantics:
+
When the 'ret' instruction is executed, control flow
returns back to the calling function's context. If the caller is a "call" instruction, execution continues at
@@ -1825,8 +1837,11 @@ 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.
+
Example:
- ret i32 5 ; Return an integer value of 5
+
+
+ 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