Skip to content

Commit d16bbbd

Browse files
committed
update LangRef
1 parent 8de297c commit d16bbbd

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

llvm/docs/LangRef.rst

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9547,8 +9547,12 @@ The '``callbr``' instruction causes control to transfer to a specified
95479547
function, with the possibility of control flow transfer to either the
95489548
'``fallthrough``' label or one of the '``indirect``' labels.
95499549

9550-
This instruction should only be used to implement the "goto" feature of gcc
9551-
style inline assembly. Any other usage is an error in the IR verifier.
9550+
This instruction can currently only be used
9551+
9552+
#. to implement the "goto" feature of gcc style inline assembly or
9553+
#. to call selected intrinsics.
9554+
9555+
Any other usage is an error in the IR verifier.
95529556

95539557
Note that in order to support outputs along indirect edges, LLVM may need to
95549558
split critical edges, which may require synthesizing a replacement block for
@@ -9589,7 +9593,8 @@ This instruction requires several arguments:
95899593
indicates the function accepts a variable number of arguments, the
95909594
extra arguments can be specified.
95919595
#. '``fallthrough label``': the label reached when the inline assembly's
9592-
execution exits the bottom.
9596+
execution exits the bottom. In case of an intrinsic call, the semantic
9597+
depends on the semantic of the intrinsic.
95939598
#. '``indirect labels``': the labels reached when a callee transfers control
95949599
to a location other than the '``fallthrough label``'. Label constraints
95959600
refer to these destinations.
@@ -9607,9 +9612,12 @@ flow goes after the call.
96079612
The output values of a '``callbr``' instruction are available both in the
96089613
the '``fallthrough``' block, and any '``indirect``' blocks(s).
96099614

9610-
The only use of this today is to implement the "goto" feature of gcc inline
9611-
assembly where additional labels can be provided as locations for the inline
9612-
assembly to jump to.
9615+
The only uses of this today are:
9616+
9617+
#. implement the "goto" feature of gcc inline assembly where additional
9618+
labels can be provided as locations for the inline assembly to jump to.
9619+
#. support selected intrinsics which manipulate control flow and should
9620+
be chained to specific terminators, such as '``unreachable``'.
96139621

96149622
Example:
96159623
""""""""
@@ -9624,6 +9632,14 @@ Example:
96249632
<result> = callbr i32 asm "", "=r,r,!i"(i32 %x)
96259633
to label %fallthrough [label %indirect]
96269634

9635+
; intrinsic which should be followed by unreachable (the order of the
9636+
; blocks after the callbr instruction doesn't matter)
9637+
callbr void @llvm.amdgcn.kill(i1 %c) to label %cont [label %kill]
9638+
cont:
9639+
...
9640+
kill:
9641+
unreachable
9642+
96279643
.. _i_resume:
96289644

96299645
'``resume``' Instruction

0 commit comments

Comments
 (0)