[llvm-commits] CVS: llvm/docs/LangRef.html

Chris Lattner lattner at cs.uiuc.edu
Mon Feb 23 22:55:01 PST 2004


Changes in directory llvm/docs:

LangRef.html updated: 1.48 -> 1.49

---
Log message:

Wow, the description of the 'switch' instruction was out of date.


---
Diffs of the changes:  (+43 -22)

Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.48 llvm/docs/LangRef.html:1.49
--- llvm/docs/LangRef.html:1.48	Sat Feb 14 13:27:26 2004
+++ llvm/docs/LangRef.html	Mon Feb 23 22:54:45 2004
@@ -748,40 +748,61 @@
  href="#i_ret">ret</a> int 1<br>IfUnequal:<br>  <a href="#i_ret">ret</a> int 0<br></pre>
 </div>
 <!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_switch">'<tt>switch</tt>'
-Instruction</a> </div>
+<div class="doc_subsubsection">
+   <a name="i_switch">'<tt>switch</tt>' Instruction</a>
+</div>
+
 <div class="doc_text">
 <h5>Syntax:</h5>
-<pre>  switch uint <value>, label <defaultdest> [ int <val>, label <dest>, ... ]<br></pre>
+
+<pre>
+  switch <intty> <value>, label <defaultdest> [ <intty> <val>, label <dest> ... ]
+</pre>
+
 <h5>Overview:</h5>
-<p>The '<tt>switch</tt>' instruction is used to transfer control flow
-to one of several different places.  It is a generalization of the '<tt>br</tt>'
+
+<p>The '<tt>switch</tt>' instruction is used to transfer control flow to one of
+several different places.  It is a generalization of the '<tt>br</tt>'
 instruction, allowing a branch to occur to one of many possible
 destinations.</p>
+
+
 <h5>Arguments:</h5>
-<p>The '<tt>switch</tt>' instruction uses three parameters: a '<tt>uint</tt>'
-comparison value '<tt>value</tt>', a default '<tt>label</tt>'
-destination, and an array of pairs of comparison value constants and '<tt>label</tt>'s.</p>
+
+<p>The '<tt>switch</tt>' instruction uses three parameters: an integer
+comparison value '<tt>value</tt>', a default '<tt>label</tt>' destination, and
+an array of pairs of comparison value constants and '<tt>label</tt>'s.  The
+table is not allowed to contain duplicate constant entries.</p>
+
 <h5>Semantics:</h5>
+
 <p>The <tt>switch</tt> instruction specifies a table of values and
 destinations. When the '<tt>switch</tt>' instruction is executed, this
 table is searched for the given value.  If the value is found, the
 corresponding destination is branched to, otherwise the default value
 it transfered to.</p>
+
 <h5>Implementation:</h5>
-<p>Depending on properties of the target machine and the particular <tt>switch</tt>
-instruction, this instruction may be code generated as a series of
-chained conditional branches, or with a lookup table.</p>
-<h5>Example:</h5>
-<pre>  <i>; Emulate a conditional br instruction</i>
-  %Val = <a
- href="#i_cast">cast</a> bool %value to uint<br>  switch uint %Val, label %truedest [int 0, label %falsedest ]<br><br>  <i>; Emulate an unconditional br instruction</i>
-  switch uint 0, label %dest [ ]
-
-  <i>; Implement a jump table:</i>
-  switch uint %val, label %otherwise [ int 0, label %onzero, 
-                                       int 1, label %onone, 
-                                       int 2, label %ontwo ]
+
+<p>Depending on properties of the target machine and the particular
+<tt>switch</tt> instruction, this instruction may be code generated in different
+ways, for example as a series of chained conditional branches, or with a lookup
+table.</p>
+
+<h5>Example:</h5>
+
+<pre>
+ <i>; Emulate a conditional br instruction</i>
+ %Val = <a href="#i_cast">cast</a> bool %value to int
+ switch int %Val, label %truedest [int 0, label %falsedest ]
+
+ <i>; Emulate an unconditional br instruction</i>
+ switch uint 0, label %dest [ ]
+
+ <i>; Implement a jump table:</i>
+ switch uint %val, label %otherwise [ uint 0, label %onzero 
+                                      uint 1, label %onone 
+                                      uint 2, label %ontwo ]
 </pre>
 </div>
 <!-- _______________________________________________________________________ -->
@@ -2032,6 +2053,6 @@
 <div class="doc_footer">
 <address><a href="mailto:sabre at nondot.org">Chris Lattner</a></address>
 <a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a> <br>
-Last modified: $Date: 2004/02/14 19:27:26 $ </div>
+Last modified: $Date: 2004/02/24 04:54:45 $ </div>
 </body>
 </html>





More information about the llvm-commits mailing list