Skip to content

Commit 681cb92

Browse files
committed
update LangRef
1 parent 47dc4f1 commit 681cb92

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
@@ -9585,8 +9585,12 @@ The '``callbr``' instruction causes control to transfer to a specified
95859585
function, with the possibility of control flow transfer to either the
95869586
'``fallthrough``' label or one of the '``indirect``' labels.
95879587

9588-
This instruction should only be used to implement the "goto" feature of gcc
9589-
style inline assembly. Any other usage is an error in the IR verifier.
9588+
This instruction can currently only be used
9589+
9590+
#. to implement the "goto" feature of gcc style inline assembly or
9591+
#. to call selected intrinsics.
9592+
9593+
Any other usage is an error in the IR verifier.
95909594

95919595
Note that in order to support outputs along indirect edges, LLVM may need to
95929596
split critical edges, which may require synthesizing a replacement block for
@@ -9627,7 +9631,8 @@ This instruction requires several arguments:
96279631
indicates the function accepts a variable number of arguments, the
96289632
extra arguments can be specified.
96299633
#. '``fallthrough label``': the label reached when the inline assembly's
9630-
execution exits the bottom.
9634+
execution exits the bottom. In case of an intrinsic call, the semantic
9635+
depends on the semantic of the intrinsic.
96319636
#. '``indirect labels``': the labels reached when a callee transfers control
96329637
to a location other than the '``fallthrough label``'. Label constraints
96339638
refer to these destinations.
@@ -9645,9 +9650,12 @@ flow goes after the call.
96459650
The output values of a '``callbr``' instruction are available both in the
96469651
the '``fallthrough``' block, and any '``indirect``' blocks(s).
96479652

9648-
The only use of this today is to implement the "goto" feature of gcc inline
9649-
assembly where additional labels can be provided as locations for the inline
9650-
assembly to jump to.
9653+
The only uses of this today are:
9654+
9655+
#. implement the "goto" feature of gcc inline assembly where additional
9656+
labels can be provided as locations for the inline assembly to jump to.
9657+
#. support selected intrinsics which manipulate control flow and should
9658+
be chained to specific terminators, such as '``unreachable``'.
96519659

96529660
Example:
96539661
""""""""
@@ -9662,6 +9670,14 @@ Example:
96629670
<result> = callbr i32 asm "", "=r,r,!i"(i32 %x)
96639671
to label %fallthrough [label %indirect]
96649672

9673+
; intrinsic which should be followed by unreachable (the order of the
9674+
; blocks after the callbr instruction doesn't matter)
9675+
callbr void @llvm.amdgcn.kill(i1 %c) to label %cont [label %kill]
9676+
cont:
9677+
...
9678+
kill:
9679+
unreachable
9680+
96659681
.. _i_resume:
96669682

96679683
'``resume``' Instruction

0 commit comments

Comments
 (0)