diff --git a/docs/LangRef.html b/docs/LangRef.html index f1a8e37a0bb..65cb4ea968d 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -684,76 +684,48 @@ IfUnequal:
- ; Definitions for lookup indirect branch - %switchtype = type [<anysize> x { uint, label }] + switch int <value>, label <defaultdest> [ int <val>, label &dest>, ... ] - ; Lookup indirect branch - switch uint <value>, label <defaultdest>, %switchtype <switchtable> -
- The 'switch' instruction is used to transfer control flow to one of several different places. It is a generalization of the 'br' instruction, allowing a branch to occur to one of many possible destinations.
-The 'switch' statement supports two different styles of indirect -branching: lookup branching and indexed branching. Lookup branching is -generally useful if the values to switch on are spread far appart, where index -branching is useful if the values to switch on are generally dense.
- -The two different forms of the 'switch' statement are simple hints to -the underlying implementation. For example, the compiler may choose to -implement a small indirect branch table as a series of predicated comparisons: -if it is faster for the target architecture.
-
- -The indexed form of the 'switch' instruction uses three parameters: an -'uint' index value, a default 'label' and a sized array of -'label's. The 'dests' array must be a constant array. +The 'switch' instruction uses three parameters: a 'uint' +comparison value 'value', a default 'label' destination, and +an array of pairs of comparison value constants and 'label's.
+branched to, otherwise the default value it transfered to.
-The index branch form simply looks up a label element directly in a table and -branches to it.
+
+Depending on properties of the target machine and the particular switch +instruction, this instruction may be code generated as a series of chained +conditional branches, or with a lookup table.
; Emulate a conditional br instruction %Val = cast bool %value to uint - switch uint %Val, label %truedest, [1 x label] [label %falsedest ] + switch int %Val, label %truedest [int 0, label %falsedest ] ; Emulate an unconditional br instruction - switch uint 0, label %dest, [ 0 x label] [ ] + switch int 0, label %dest [ ] ; Implement a jump table: - switch uint %val, label %otherwise, [3 x label] [ label %onzero, - label %onone, - label %ontwo ] - + switch int %val, label %otherwise [ int 0, label %onzero, + int 1, label %onone, + int 2, label %ontwo ]@@ -1840,7 +1812,7 @@ arbitrarily complex and require memory allocation, for example.
Chris Lattner -Last modified: Wed May 7 23:56:16 CDT 2003 +Last modified: Thu May 8 00:06:36 CDT 2003