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

Bill Wendling isanbard at gmail.com
Tue May 29 02:05:13 PDT 2007



Changes in directory llvm/docs:

LangRef.html updated: 1.246 -> 1.247
---
Log message:

Fix for PR1452: http://llvm.org/PR1452 . Removed "define" keyword from the C code. Added "<div
class="doc_code">" to code examples.


---
Diffs of the changes:  (+85 -45)

 LangRef.html |  130 ++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 85 insertions(+), 45 deletions(-)


Index: llvm/docs/LangRef.html
diff -u llvm/docs/LangRef.html:1.246 llvm/docs/LangRef.html:1.247
--- llvm/docs/LangRef.html:1.246	Thu May 24 14:13:27 2007
+++ llvm/docs/LangRef.html	Tue May 29 04:04:49 2007
@@ -252,9 +252,11 @@
 accepts and what is considered 'well formed'.  For example, the
 following instruction is syntactically okay, but not well formed:</p>
 
+<div class="doc_code">
 <pre>
-  %x = <a href="#i_add">add</a> i32 1, %x
+%x = <a href="#i_add">add</a> i32 1, %x
 </pre>
+</div>
 
 <p>...because the definition of <tt>%x</tt> does not dominate all of
 its uses. The LLVM infrastructure provides a verification pass that may
@@ -263,6 +265,7 @@
 the optimizer before it outputs bytecode.  The violations pointed out
 by the verifier pass indicate bugs in transformation passes or input to
 the parser.</p>
+</div>
 
 <!-- Describe the typesetting conventions here. --> </div>
 
@@ -310,23 +313,29 @@
 
 <p>The easy way:</p>
 
+<div class="doc_code">
 <pre>
-  %result = <a href="#i_mul">mul</a> i32 %X, 8
+%result = <a href="#i_mul">mul</a> i32 %X, 8
 </pre>
+</div>
 
 <p>After strength reduction:</p>
 
+<div class="doc_code">
 <pre>
-  %result = <a href="#i_shl">shl</a> i32 %X, i8 3
+%result = <a href="#i_shl">shl</a> i32 %X, i8 3
 </pre>
+</div>
 
 <p>And the hard way:</p>
 
+<div class="doc_code">
 <pre>
-  <a href="#i_add">add</a> i32 %X, %X           <i>; yields {i32}:%0</i>
-  <a href="#i_add">add</a> i32 %0, %0           <i>; yields {i32}:%1</i>
-  %result = <a href="#i_add">add</a> i32 %1, %1
+<a href="#i_add">add</a> i32 %X, %X           <i>; yields {i32}:%0</i>
+<a href="#i_add">add</a> i32 %0, %0           <i>; yields {i32}:%1</i>
+%result = <a href="#i_add">add</a> i32 %1, %1
 </pre>
+</div>
 
 <p>This last way of multiplying <tt>%X</tt> by 8 illustrates several
 important lexical features of LLVM:</p>
@@ -367,6 +376,7 @@
 global variable) definitions, resolves forward declarations, and merges
 symbol table entries. Here is an example of the "hello world" module:</p>
 
+<div class="doc_code">
 <pre><i>; Declare the string constant as a global constant...</i>
 <a href="#identifiers">%.LC0</a> = <a href="#linkage_internal">internal</a> <a
  href="#globalvars">constant</a> <a href="#t_array">[13 x i8 ]</a> c"hello world\0A\00"          <i>; [13 x i8 ]*</i>
@@ -384,7 +394,9 @@
         <a
  href="#i_call">call</a> i32 %puts(i8 * %cast210)                              <i>; i32</i>
         <a
- href="#i_ret">ret</a> i32 0<br>}<br></pre>
+ href="#i_ret">ret</a> i32 0<br>}<br>
+</pre>
+</div>
 
 <p>This example is made up of a <a href="#globalvars">global variable</a>
 named "<tt>.LC0</tt>", an external declaration of the "<tt>puts</tt>"
@@ -647,9 +659,11 @@
 <p>For example, the following defines a global with an initializer, section,
    and alignment:</p>
 
+<div class="doc_code">
 <pre>
-  %G = constant float 1.0, section "foo", align 4
+%G = constant float 1.0, section "foo", align 4
 </pre>
+</div>
 
 </div>
 
@@ -719,9 +733,11 @@
 
   <h5>Syntax:</h5>
 
+<div class="doc_code">
   <pre>
-    @<Name> = [Linkage] [Visibility] alias <AliaseeTy> @<Aliasee>
+@<Name> = [Linkage] [Visibility] alias <AliaseeTy> @<Aliasee>
   </pre>
+</div>
 
 </div>
 
@@ -739,9 +755,15 @@
 
   <p>Parameter attributes are simple keywords that follow the type specified. If
   multiple parameter attributes are needed, they are space separated. For 
-  example:</p><pre>
-    %someFunc = i16 (i8 sext %someParam) zext
-    %someFunc = i16 (i8 zext %someParam) zext</pre>
+  example:</p>
+
+<div class="doc_code">
+<pre>
+%someFunc = i16 (i8 sext %someParam) zext
+%someFunc = i16 (i8 zext %someParam) zext
+</pre>
+</div>
+
   <p>Note that the two function types above are unique because the parameter has
   a different attribute (sext in the first one, zext in the second). Also note
   that the attribute for the function result (zext) comes immediately after the
@@ -787,10 +809,12 @@
 desired.  The syntax is very simple:
 </p>
 
-<div class="doc_code"><pre>
-  module asm "inline asm code goes here"
-  module asm "more can go here"
-</pre></div>
+<div class="doc_code">
+<pre>
+module asm "inline asm code goes here"
+module asm "more can go here"
+</pre>
+</div>
 
 <p>The strings can contain any character by escaping non-printable characters.
    The escape sequence used is simply "\xx" where "xx" is the two digit hex code
@@ -1015,6 +1039,7 @@
     </td>
   </tr>
 </table>
+</div>
 
 <!-- _______________________________________________________________________ -->
 <div class="doc_subsubsection"> <a name="t_array">Array Type</a> </div>
@@ -1398,11 +1423,13 @@
 href="#t_pointer">pointer</a> type. For example, the following is a legal LLVM
 file:</p>
 
+<div class="doc_code">
 <pre>
-  %X = global i32 17
-  %Y = global i32 42
-  %Z = global [2 x i32*] [ i32* %X, i32* %Y ]
+%X = global i32 17
+%Y = global i32 42
+%Z = global [2 x i32*] [ i32* %X, i32* %Y ]
 </pre>
+</div>
 
 </div>
 
@@ -1556,18 +1583,22 @@
 inline assembler expression is:
 </p>
 
+<div class="doc_code">
 <pre>
-  i32 (i32) asm "bswap $0", "=r,r"
+i32 (i32) asm "bswap $0", "=r,r"
 </pre>
+</div>
 
 <p>
 Inline assembler expressions may <b>only</b> be used as the callee operand of
 a <a href="#i_call"><tt>call</tt> instruction</a>.  Thus, typically we have:
 </p>
 
+<div class="doc_code">
 <pre>
-  %X = call i32 asm "<a href="#int_bswap">bswap</a> $0", "=r,r"(i32 %Y)
+%X = call i32 asm "<a href="#int_bswap">bswap</a> $0", "=r,r"(i32 %Y)
 </pre>
+</div>
 
 <p>
 Inline asms with side effects not visible in the constraint list must be marked
@@ -1575,9 +1606,11 @@
 '<tt>sideeffect</tt>' keyword, like so:
 </p>
 
+<div class="doc_code">
 <pre>
-  call void asm sideeffect "eieio", ""()
+call void asm sideeffect "eieio", ""()
 </pre>
+</div>
 
 <p>TODO: The format of the asm and constraints string still need to be
 documented here.  Constraints on what can be done (e.g. duplication, moving, etc
@@ -2663,8 +2696,8 @@
 
 <pre>
   %ptr = alloca i32                              <i>; yields {i32*}:ptr</i>
-  %ptr = alloca i32, i32 4                      <i>; yields {i32*}:ptr</i>
-  %ptr = alloca i32, i32 4, align 1024          <i>; yields {i32*}:ptr</i>
+  %ptr = alloca i32, i32 4                       <i>; yields {i32*}:ptr</i>
+  %ptr = alloca i32, i32 4, align 1024           <i>; yields {i32*}:ptr</i>
   %ptr = alloca i32, align 1024                  <i>; yields {i32*}:ptr</i>
 </pre>
 </div>
@@ -2754,35 +2787,39 @@
 <p>For example, let's consider a C code fragment and how it gets
 compiled to LLVM:</p>
 
+<div class="doc_code">
 <pre>
-  struct RT {
-    char A;
-    i32 B[10][20];
-    char C;
-  };
-  struct ST {
-    i32 X;
-    double Y;
-    struct RT Z;
-  };
+struct RT {
+  char A;
+  i32 B[10][20];
+  char C;
+};
+struct ST {
+  i32 X;
+  double Y;
+  struct RT Z;
+};
 
-  define i32 *foo(struct ST *s) {
-    return &s[1].Z.B[5][13];
-  }
+i32 *foo(struct ST *s) {
+  return &s[1].Z.B[5][13];
+}
 </pre>
+</div>
 
 <p>The LLVM code generated by the GCC frontend is:</p>
 
+<div class="doc_code">
 <pre>
-  %RT = type { i8 , [10 x [20 x i32]], i8  }
-  %ST = type { i32, double, %RT }
+%RT = type { i8 , [10 x [20 x i32]], i8  }
+%ST = type { i32, double, %RT }
 
-  define i32* %foo(%ST* %s) {
-  entry:
-    %reg = getelementptr %ST* %s, i32 1, i32 2, i32 1, i32 5, i32 13
-    ret i32* %reg
-  }
+define i32* %foo(%ST* %s) {
+entry:
+  %reg = getelementptr %ST* %s, i32 1, i32 2, i32 1, i32 5, i32 13
+  ret i32* %reg
+}
 </pre>
+</div>
 
 <h5>Semantics:</h5>
 
@@ -3694,6 +3731,7 @@
 instruction and the variable argument handling intrinsic functions are
 used.</p>
 
+<div class="doc_code">
 <pre>
 define i32 @test(i32 %X, ...) {
   ; Initialize variable argument processing
@@ -3721,6 +3759,8 @@
 </pre>
 </div>
 
+</div>
+
 <!-- _______________________________________________________________________ -->
 <div class="doc_subsubsection">
   <a name="int_va_start">'<tt>llvm.va_start</tt>' Intrinsic</a>
@@ -4786,7 +4826,7 @@
 
   <a href="mailto:sabre at nondot.org">Chris Lattner</a><br>
   <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
-  Last modified: $Date: 2007/05/24 19:13:27 $
+  Last modified: $Date: 2007/05/29 09:04:49 $
 </address>
 </body>
 </html>






More information about the llvm-commits mailing list