Describe the new garbage collector intrinsics
[oota-llvm.git] / docs / LangRef.html
index 7af49cead6fe41b05981dfdbe07f5526030f778d..07bb686698be4ca46a927f1beb58b343c220570f 100644 (file)
@@ -5,7 +5,9 @@
   <title>LLVM Assembly Language Reference Manual</title>
   <link rel="stylesheet" href="llvm.css" type="text/css">
 </head>
+
 <body>
+
 <div class="doc_title"> LLVM Language Reference Manual </div>
 <ol>
   <li><a href="#abstract">Abstract</a></li>
@@ -80,6 +82,7 @@
         <ol>
           <li><a href="#i_phi">'<tt>phi</tt>'   Instruction</a></li>
           <li><a href="#i_cast">'<tt>cast .. to</tt>' Instruction</a></li>
+          <li><a href="#i_select">'<tt>select</tt>' Instruction</a></li>
           <li><a href="#i_call">'<tt>call</tt>'  Instruction</a></li>
           <li><a href="#i_vanext">'<tt>vanext</tt>' Instruction</a></li>
           <li><a href="#i_vaarg">'<tt>vaarg</tt>'  Instruction</a></li>
           <li><a href="#i_va_copy">'<tt>llvm.va_copy</tt>'  Intrinsic</a></li>
         </ol>
       </li>
+      <li><a href="#int_gc">Accurate Garbage Collection Intrinsics</a>
+        <ol>
+          <li><a href="#i_gcroot">'<tt>llvm.gcroot</tt>' Intrinsic</a></li>
+          <li><a href="#i_gcread">'<tt>llvm.gcread</tt>' Intrinsic</a></li>
+          <li><a href="#i_gcwrite">'<tt>llvm.gcwrite</tt>' Intrinsic</a></li>
+        </ol>
+      </li>
       <li><a href="#int_codegen">Code Generator Intrinsics</a>
         <ol>
           <li><a href="#i_returnaddress">'<tt>llvm.returnaddress</tt>' Intrinsic</a></li>
           <li><a href="#i_frameaddress">'<tt>llvm.frameaddress</tt>'   Intrinsic</a></li>
         </ol>
       </li>
+      <li><a href="#int_os">Operating System Intrinsics</a>
+        <ol>
+          <li><a href="#i_readport">'<tt>llvm.readport</tt>'   Intrinsic</a></li>
+          <li><a href="#i_writeport">'<tt>llvm.writeport</tt>'   Intrinsic</a></li>
+          <li><a href="#i_readio">'<tt>llvm.readio</tt>'   Intrinsic</a></li>
+          <li><a href="#i_writeio">'<tt>llvm.writeio</tt>'   Intrinsic</a></li>
+        </ol>
       <li><a href="#int_libc">Standard C Library Intrinsics</a>
         <ol>
           <li><a href="#i_memcpy">'<tt>llvm.memcpy</tt>' Intrinsic</a></li>
           <li><a href="#i_memset">'<tt>llvm.memset</tt>' Intrinsic</a></li>
         </ol>
       </li>
-      <li><a href="#int_debugger">Debugger intrinsics</a>
+      <li><a href="#int_debugger">Debugger intrinsics</a></li>
     </ol>
   </li>
 </ol>
-<div class="doc_text">
-<p><b>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>
-and <a href="mailto:vadve@cs.uiuc.edu">Vikram Adve</a></b></p>
-<p> </p>
+
+<div class="doc_author">
+  <p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>
+            and <a href="mailto:vadve@cs.uiuc.edu">Vikram Adve</a></p>
 </div>
+
 <!-- *********************************************************************** -->
 <div class="doc_section"> <a name="abstract">Abstract </a></div>
 <!-- *********************************************************************** -->
+
 <div class="doc_text">
 <p>This document is a reference manual for the LLVM assembly language. 
 LLVM is an SSA based representation that provides type safety,
@@ -129,10 +148,13 @@ low-level operations, flexibility, and the capability of representing
 representation used throughout all phases of the LLVM compilation
 strategy.</p>
 </div>
+
 <!-- *********************************************************************** -->
 <div class="doc_section"> <a name="introduction">Introduction</a> </div>
 <!-- *********************************************************************** -->
+
 <div class="doc_text">
+
 <p>The LLVM code representation is designed to be used in three
 different forms: as an in-memory compiler IR, as an on-disk bytecode
 representation (suitable for fast loading by a Just-In-Time compiler),
@@ -142,6 +164,7 @@ compiler transformations and analysis, while providing a natural means
 to debug and visualize the transformations.  The three different forms
 of LLVM are all equivalent.  This document describes the human readable
 representation and notation.</p>
+
 <p>The LLVM representation aims to be a light-weight and low-level
 while being expressive, typed, and extensible at the same time.  It
 aims to be a "universal IR" of sorts, by being at a low enough level
@@ -152,15 +175,23 @@ the target of optimizations: for example, through pointer analysis, it
 can be proven that a C automatic variable is never accessed outside of
 the current function... allowing it to be promoted to a simple SSA
 value instead of a memory location.</p>
+
 </div>
+
 <!-- _______________________________________________________________________ -->
 <div class="doc_subsubsection"> <a name="wellformed">Well-Formedness</a> </div>
+
 <div class="doc_text">
+
 <p>It is important to note that this document describes 'well formed'
 LLVM assembly language.  There is a difference between what the parser
 accepts and what is considered 'well formed'.  For example, the
 following instruction is syntactically okay, but not well formed:</p>
-<pre>  %x = <a href="#i_add">add</a> int 1, %x<br></pre>
+
+<pre>
+  %x = <a href="#i_add">add</a> int 1, %x
+</pre>
+
 <p>...because the definition of <tt>%x</tt> does not dominate all of
 its uses. The LLVM infrastructure provides a verification pass that may
 be used to verify that an LLVM module is well formed.  This pass is
@@ -168,16 +199,21 @@ automatically run by the parser after parsing input assembly, and by
 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>
+
 <!-- Describe the typesetting conventions here. --> </div>
+
 <!-- *********************************************************************** -->
 <div class="doc_section"> <a name="identifiers">Identifiers</a> </div>
 <!-- *********************************************************************** -->
+
 <div class="doc_text">
+
 <p>LLVM uses three different forms of identifiers, for different
 purposes:</p>
+
 <ol>
   <li>Numeric constants are represented as you would expect: 12, -3
-123.421,   etc.  Floating point constants have an optional hexidecimal
+123.421,   etc.  Floating point constants have an optional hexadecimal
 notation.</li>
   <li>Named values are represented as a string of characters with a '%'
 prefix.   For example, %foo, %DivisionByZero,
@@ -188,7 +224,7 @@ character can be used   in a name.</li>
   <li>Unnamed values are represented as an unsigned numeric value with
 a '%'   prefix.  For example, %12, %2, %44.</li>
 </ol>
-<p>LLVM requires the values start with a '%' sign for two reasons:
+<p>LLVM requires that values start with a '%' sign for two reasons:
 Compilers don't need to worry about name clashes with reserved words,
 and the set of reserved words may be expanded in the future without
 penalty.  Additionally, unnamed identifiers allow a compiler to quickly
@@ -254,7 +290,7 @@ href="#rw_stroustrup">1</a></sup>.<p> --> </div>
 <!-- ======================================================================= -->
 <div class="doc_subsection"> <a name="t_primitive">Primitive Types</a> </div>
 <div class="doc_text">
-<p>The primitive types are the fundemental building blocks of the LLVM
+<p>The primitive types are the fundamental building blocks of the LLVM
 system. The current set of primitive types are as follows:</p>
 
 <table border="0" style="align: center">
@@ -623,45 +659,61 @@ external (i.e., lacking any linkage declarations), they are accessible
 outside of the current module.  It is illegal for a function <i>declaration</i>
 to have any linkage type other than "externally visible".</a></p>
 </div>
+
 <!-- ======================================================================= -->
-<div class="doc_subsection"> <a name="globalvars">Global Variables</a> </div>
+<div class="doc_subsection">
+  <a name="globalvars">Global Variables</a>
+</div>
+
 <div class="doc_text">
+
 <p>Global variables define regions of memory allocated at compilation
 time instead of run-time.  Global variables may optionally be
 initialized.  A variable may be defined as a global "constant", which
 indicates that the contents of the variable will never be modified
-(opening options for optimization).  Constants must always have an
-initial value.</p>
+(opening options for optimization).</p>
+
 <p>As SSA values, global variables define pointer values that are in
 scope (i.e. they dominate) for all basic blocks in the program.  Global
 variables always define a pointer to their "content" type because they
 describe a region of memory, and all memory objects in LLVM are
 accessed through pointers.</p>
+
 </div>
+
+
 <!-- ======================================================================= -->
-<div class="doc_subsection"> <a name="functionstructure">Functions</a> </div>
-<div class="doc_text">
-<p>LLVM function definitions are composed of a (possibly empty)
-argument list, an opening curly brace, a list of basic blocks, and a
-closing curly brace.  LLVM function declarations are defined with the "<tt>declare</tt>"
-keyword, a function name, and a function signature.</p>
-<p>A function definition contains a list of basic blocks, forming the
-CFG for the function.  Each basic block may optionally start with a
-label (giving the basic block a symbol table entry), contains a list of
-instructions, and ends with a <a href="#terminators">terminator</a>
-instruction (such as a branch or function return).</p>
-<p>The first basic block in program is special in two ways: it is
-immediately executed on entrance to the function, and it is not allowed
-to have predecessor basic blocks (i.e. there can not be any branches to
-the entry block of a function).  Because the block can have no
-predecessors, it also cannot have any <a href="#i_phi">PHI nodes</a>.</p>
-<p>
-LLVM functions are identified by their name and type signature.  Hence, two
-functions with the same name but different parameter lists or return values
-are considered different functions, and LLVM will resolves references to each
-appropriately.
-</p>
+<div class="doc_subsection">
+  <a name="functionstructure">Functions</a>
+</div>
+
+<div class="doc_text">
+
+<p>LLVM function definitions are composed of a (possibly empty) argument list,
+an opening curly brace, a list of basic blocks, and a closing curly brace.  LLVM
+function declarations are defined with the "<tt>declare</tt>" keyword, a
+function name, and a function signature.</p>
+
+<p>A function definition contains a list of basic blocks, forming the CFG for
+the function.  Each basic block may optionally start with a label (giving the
+basic block a symbol table entry), contains a list of instructions, and ends
+with a <a href="#terminators">terminator</a> instruction (such as a branch or
+function return).</p>
+
+<p>The first basic block in program is special in two ways: it is immediately
+executed on entrance to the function, and it is not allowed to have predecessor
+basic blocks (i.e. there can not be any branches to the entry block of a
+function).  Because the block can have no predecessors, it also cannot have any
+<a href="#i_phi">PHI nodes</a>.</p>
+
+<p>LLVM functions are identified by their name and type signature.  Hence, two
+functions with the same name but different parameter lists or return values are
+considered different functions, and LLVM will resolves references to each
+appropriately.</p>
+
 </div>
+
+
 <!-- *********************************************************************** -->
 <div class="doc_section"> <a name="instref">Instruction Reference</a> </div>
 <!-- *********************************************************************** -->
@@ -699,7 +751,7 @@ Instruction</a> </div>
 <h5>Overview:</h5>
 <p>The '<tt>ret</tt>' instruction is used to return control flow (and a
 value) from a function, back to the caller.</p>
-<p>There are two forms of the '<tt>ret</tt>' instructruction: one that
+<p>There are two forms of the '<tt>ret</tt>' instruction: one that
 returns a value and then causes control flow, and one that just causes
 control flow to occur.</p>
 <h5>Arguments:</h5>
@@ -1406,62 +1458,107 @@ at the location specified by the '<tt>&lt;pointer&gt;</tt>' operand.</p>
   %val = load int* %ptr                           <i>; yields {int}:val = int 3</i>
 </pre>
 <!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_getelementptr">'<tt>getelementptr</tt>'
-Instruction</a> </div>
+<div class="doc_subsubsection">
+   <a name="i_getelementptr">'<tt>getelementptr</tt>' Instruction</a>
+</div>
+
 <div class="doc_text">
 <h5>Syntax:</h5>
-<pre>  &lt;result&gt; = getelementptr &lt;ty&gt;* &lt;ptrval&gt;{, long &lt;aidx&gt;|, ubyte &lt;sidx&gt;}*<br></pre>
+<pre>
+  &lt;result&gt; = getelementptr &lt;ty&gt;* &lt;ptrval&gt;{, &lt;ty&gt; &lt;idx&gt;}*
+</pre>
+
 <h5>Overview:</h5>
-<p>The '<tt>getelementptr</tt>' instruction is used to get the address
-of a subelement of an aggregate data structure.</p>
+
+<p>
+The '<tt>getelementptr</tt>' instruction is used to get the address of a
+subelement of an aggregate data structure.</p>
+
 <h5>Arguments:</h5>
-<p>This instruction takes a list of <tt>long</tt> values and <tt>ubyte</tt>
-constants that indicate what form of addressing to perform.  The actual
-types of the arguments provided depend on the type of the first pointer
-argument.  The '<tt>getelementptr</tt>' instruction is used to index
-down through the type levels of a structure.</p>
+
+<p>This instruction takes a list of integer constants that indicate what
+elements of the aggregate object to index to.  The actual types of the arguments
+provided depend on the type of the first pointer argument.  The
+'<tt>getelementptr</tt>' instruction is used to index down through the type
+levels of a structure.  When indexing into a structure, only <tt>uint</tt>
+integer constants are allowed.  When indexing into an array or pointer
+<tt>int</tt> and <tt>long</tt> indexes are allowed of any sign.</p>
+
 <p>For example, let's consider a C code fragment and how it gets
 compiled to LLVM:</p>
-<pre>struct RT {<br>  char A;<br>  int B[10][20];<br>  char C;<br>};<br>struct ST {<br>  int X;<br>  double Y;<br>  struct RT Z;<br>};<br><br>int *foo(struct ST *s) {<br>  return &amp;s[1].Z.B[5][13];<br>}<br></pre>
+
+<pre>
+  struct RT {
+    char A;
+    int B[10][20];
+    char C;
+  };
+  struct ST {
+    int X;
+    double Y;
+    struct RT Z;
+  };
+
+  int *foo(struct ST *s) {
+    return &amp;s[1].Z.B[5][13];
+  }
+</pre>
+
 <p>The LLVM code generated by the GCC frontend is:</p>
-<pre>%RT = type { sbyte, [10 x [20 x int]], sbyte }<br>%ST = type { int, double, %RT }<br><br>int* "foo"(%ST* %s) {<br>  %reg = getelementptr %ST* %s, long 1, ubyte 2, ubyte 1, long 5, long 13<br>  ret int* %reg<br>}<br></pre>
+
+<pre>
+  %RT = type { sbyte, [10 x [20 x int]], sbyte }
+  %ST = type { int, double, %RT }
+
+  int* "foo"(%ST* %s) {
+    %reg = getelementptr %ST* %s, int 1, uint 2, uint 1, int 5, int 13<br>
+    ret int* %reg
+  }
+</pre>
+
 <h5>Semantics:</h5>
-<p>The index types specified for the '<tt>getelementptr</tt>'
-instruction depend on the pointer type that is being index into. <a
- href="t_pointer">Pointer</a> and <a href="t_array">array</a> types
-require '<tt>long</tt>' values, and <a href="t_struct">structure</a>
-types require '<tt>ubyte</tt>' <b>constants</b>.</p>
+
+<p>The index types specified for the '<tt>getelementptr</tt>' instruction depend
+on the pointer type that is being index into. <a href="t_pointer">Pointer</a>
+and <a href="t_array">array</a> types require <tt>uint</tt>, <tt>int</tt>,
+<tt>ulong</tt>, or <tt>long</tt> values, and <a href="t_struct">structure</a>
+types require <tt>uint</tt> <b>constants</b>.</p>
+
 <p>In the example above, the first index is indexing into the '<tt>%ST*</tt>'
-type, which is a pointer, yielding a '<tt>%ST</tt>' = '<tt>{ int,
-double, %RT }</tt>' type, a structure.  The second index indexes into
-the third element of the structure, yielding a '<tt>%RT</tt>' = '<tt>{
-sbyte, [10 x [20 x int]], sbyte }</tt>' type, another structure.  The
-third index indexes into the second element of the structure, yielding
-a '<tt>[10 x [20 x int]]</tt>' type, an array.  The two dimensions of
-the array are subscripted into, yielding an '<tt>int</tt>' type.  The '<tt>getelementptr</tt>'
-instruction return a pointer to this element, thus yielding a '<tt>int*</tt>'
-type.</p>
+type, which is a pointer, yielding a '<tt>%ST</tt>' = '<tt>{ int, double, %RT
+}</tt>' type, a structure.  The second index indexes into the third element of
+the structure, yielding a '<tt>%RT</tt>' = '<tt>{ sbyte, [10 x [20 x int]],
+sbyte }</tt>' type, another structure.  The third index indexes into the second
+element of the structure, yielding a '<tt>[10 x [20 x int]]</tt>' type, an
+array.  The two dimensions of the array are subscripted into, yielding an
+'<tt>int</tt>' type.  The '<tt>getelementptr</tt>' instruction return a pointer
+to this element, thus computing a value of '<tt>int*</tt>' type.</p>
+
 <p>Note that it is perfectly legal to index partially through a
 structure, returning a pointer to an inner element.  Because of this,
 the LLVM code for the given testcase is equivalent to:</p>
-<pre>int* "foo"(%ST* %s) {<br>  %t1 = getelementptr %ST* %s , long 1                        <i>; yields %ST*:%t1</i>
-  %t2 = getelementptr %ST* %t1, long 0, ubyte 2               <i>; yields %RT*:%t2</i>
-  %t3 = getelementptr %RT* %t2, long 0, ubyte 1               <i>; yields [10 x [20 x int]]*:%t3</i>
-  %t4 = getelementptr [10 x [20 x int]]* %t3, long 0, long 5  <i>; yields [20 x int]*:%t4</i>
-  %t5 = getelementptr [20 x int]* %t4, long 0, long 13        <i>; yields int*:%t5</i>
-  ret int* %t5
-}
+
+<pre>
+  int* "foo"(%ST* %s) {
+    %t1 = getelementptr %ST* %s, int 1                        <i>; yields %ST*:%t1</i>
+    %t2 = getelementptr %ST* %t1, int 0, uint 2               <i>; yields %RT*:%t2</i>
+    %t3 = getelementptr %RT* %t2, int 0, uint 1               <i>; yields [10 x [20 x int]]*:%t3</i>
+    %t4 = getelementptr [10 x [20 x int]]* %t3, int 0, int 5  <i>; yields [20 x int]*:%t4</i>
+    %t5 = getelementptr [20 x int]* %t4, int 0, int 13        <i>; yields int*:%t5</i>
+    ret int* %t5
+  }
 </pre>
 <h5>Example:</h5>
-<pre>  <i>; yields [12 x ubyte]*:aptr</i>
-  %aptr = getelementptr {int, [12 x ubyte]}* %sptr, long 0, ubyte 1<br></pre>
-<h5>&nbsp;Note To The Novice:</h5>
-When using indexing into global arrays with the  '<tt>getelementptr</tt>'
-instruction, you must remember that the&nbsp; </div>
+<pre>
+    <i>; yields [12 x ubyte]*:aptr</i>
+    %aptr = getelementptr {int, [12 x ubyte]}* %sptr, long 0, uint 1
+</pre>
+
+</div>
 <!-- ======================================================================= -->
 <div class="doc_subsection"> <a name="otherops">Other Operations</a> </div>
 <div class="doc_text">
-<p>The instructions in this catagory are the "miscellaneous"
+<p>The instructions in this category are the "miscellaneous"
 instructions, which defy better classification.</p>
 </div>
 <!-- _______________________________________________________________________ -->
@@ -1490,38 +1587,111 @@ came from in the last <a href="#terminators">terminator</a> instruction.</p>
 <h5>Example:</h5>
 <pre>Loop:       ; Infinite loop that counts from 0 on up...<br>  %indvar = phi uint [ 0, %LoopHeader ], [ %nextindvar, %Loop ]<br>  %nextindvar = add uint %indvar, 1<br>  br label %Loop<br></pre>
 </div>
+
 <!-- _______________________________________________________________________ -->
-<div class="doc_subsubsection"> <a name="i_cast">'<tt>cast .. to</tt>'
-Instruction</a> </div>
+<div class="doc_subsubsection">
+   <a name="i_cast">'<tt>cast .. to</tt>' Instruction</a>
+</div>
+
 <div class="doc_text">
+
 <h5>Syntax:</h5>
-<pre>  &lt;result&gt; = cast &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
+
+<pre>
+  &lt;result&gt; = cast &lt;ty&gt; &lt;value&gt; to &lt;ty2&gt;             <i>; yields ty2</i>
 </pre>
+
 <h5>Overview:</h5>
-<p>The '<tt>cast</tt>' instruction is used as the primitive means to
-convert integers to floating point, change data type sizes, and break
-type safety (by casting pointers).</p>
+
+<p>
+The '<tt>cast</tt>' instruction is used as the primitive means to convert
+integers to floating point, change data type sizes, and break type safety (by
+casting pointers).
+</p>
+
+
 <h5>Arguments:</h5>
-<p>The '<tt>cast</tt>' instruction takes a value to cast, which must be
-a first class value, and a type to cast it to, which must also be a <a
- href="#t_firstclass">first class</a> type.</p>
+
+<p>
+The '<tt>cast</tt>' instruction takes a value to cast, which must be a first
+class value, and a type to cast it to, which must also be a <a
+href="#t_firstclass">first class</a> type.
+</p>
+
 <h5>Semantics:</h5>
-<p>This instruction follows the C rules for explicit casts when
-determining how the data being cast must change to fit in its new
-container.</p>
-<p>When casting to bool, any value that would be considered true in the
-context of a C '<tt>if</tt>' condition is converted to the boolean '<tt>true</tt>'
-values, all else are '<tt>false</tt>'.</p>
-<p>When extending an integral value from a type of one signness to
-another (for example '<tt>sbyte</tt>' to '<tt>ulong</tt>'), the value
-is sign-extended if the <b>source</b> value is signed, and
-zero-extended if the source value is unsigned. <tt>bool</tt> values
-are always zero extended into either zero or one.</p>
+
+<p>
+This instruction follows the C rules for explicit casts when determining how the
+data being cast must change to fit in its new container.
+</p>
+
+<p>
+When casting to bool, any value that would be considered true in the context of
+a C '<tt>if</tt>' condition is converted to the boolean '<tt>true</tt>' values,
+all else are '<tt>false</tt>'.
+</p>
+
+<p>
+When extending an integral value from a type of one signness to another (for
+example '<tt>sbyte</tt>' to '<tt>ulong</tt>'), the value is sign-extended if the
+<b>source</b> value is signed, and zero-extended if the source value is
+unsigned. <tt>bool</tt> values are always zero extended into either zero or
+one.
+</p>
+
 <h5>Example:</h5>
-<pre>  %X = cast int 257 to ubyte              <i>; yields ubyte:1</i>
+
+<pre>
+  %X = cast int 257 to ubyte              <i>; yields ubyte:1</i>
   %Y = cast int 123 to bool               <i>; yields bool:true</i>
 </pre>
 </div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+   <a name="i_select">'<tt>select</tt>' Instruction</a>
+</div>
+
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+
+<pre>
+  &lt;result&gt; = select bool &lt;cond&gt;, &lt;ty&gt; &lt;val1&gt;, &lt;ty&gt; &lt;val2&gt;             <i>; yields ty</i>
+</pre>
+
+<h5>Overview:</h5>
+
+<p>
+The '<tt>select</tt>' instruction is used to choose one value based on a
+condition, without branching.
+</p>
+
+
+<h5>Arguments:</h5>
+
+<p>
+The '<tt>select</tt>' instruction requires a boolean value indicating the condition, and two values of the same <a href="#t_firstclass">first class</a> type.
+</p>
+
+<h5>Semantics:</h5>
+
+<p>
+If the boolean condition evaluates to true, the instruction returns the first
+value argument, otherwise it returns the second value argument.
+</p>
+
+<h5>Example:</h5>
+
+<pre>
+  %X = select bool true, ubyte 17, ubyte 42          <i>; yields ubyte:17</i>
+</pre>
+</div>
+
+
+
+
+
 <!-- _______________________________________________________________________ -->
 <div class="doc_subsubsection"> <a name="i_call">'<tt>call</tt>'
 Instruction</a> </div>
@@ -1661,18 +1831,22 @@ understand to raw LLVM instructions that they do.
 </div>
 
 <div class="doc_text">
+
 <p>Variable argument support is defined in LLVM with the <a
  href="#i_vanext"><tt>vanext</tt></a> instruction and these three
 intrinsic functions.  These functions are related to the similarly
 named macros defined in the <tt>&lt;stdarg.h&gt;</tt> header file.</p>
+
 <p>All of these functions operate on arguments that use a
 target-specific value type "<tt>va_list</tt>".  The LLVM assembly
 language reference manual does not define what this type is, so all
 transformations should be prepared to handle intrinsics with any type
 used.</p>
+
 <p>This example shows how the <a href="#i_vanext"><tt>vanext</tt></a>
 instruction and the variable argument handling intrinsic functions are
 used.</p>
+
 <pre>
 int %test(int %X, ...) {
   ; Initialize variable argument processing
@@ -1746,21 +1920,152 @@ with calls to <tt>llvm.va_end</tt>.</p>
 </div>
 
 <div class="doc_text">
+
 <h5>Syntax:</h5>
-<pre>  call va_list (va_list)* %llvm.va_copy(va_list &lt;destarglist&gt;)<br></pre>
+
+<pre>
+  call va_list (va_list)* %llvm.va_copy(va_list &lt;destarglist&gt;)
+</pre>
+
 <h5>Overview:</h5>
-<p>The '<tt>llvm.va_copy</tt>' intrinsic copies the current argument
-position from the source argument list to the destination argument list.</p>
+
+<p>The '<tt>llvm.va_copy</tt>' intrinsic copies the current argument position
+from the source argument list to the destination argument list.</p>
+
 <h5>Arguments:</h5>
+
 <p>The argument is the <tt>va_list</tt> to copy.</p>
+
 <h5>Semantics:</h5>
+
 <p>The '<tt>llvm.va_copy</tt>' intrinsic works just like the <tt>va_copy</tt>
-macro available in C.  In a target-dependent way, it copies the source <tt>va_list</tt>
-element into the returned list.  This intrinsic is necessary because the <tt><a
- href="i_va_start">llvm.va_start</a></tt> intrinsic may be arbitrarily
-complex and require memory allocation, for example.</p>
+macro available in C.  In a target-dependent way, it copies the source
+<tt>va_list</tt> element into the returned list.  This intrinsic is necessary
+because the <tt><a href="i_va_start">llvm.va_start</a></tt> intrinsic may be
+arbitrarily complex and require memory allocation, for example.</p>
+
+</div>
+
+<!-- ======================================================================= -->
+<div class="doc_subsection">
+  <a name="int_gc">Accurate Garbage Collection Intrinsics</a>
+</div>
+
+<div class="doc_text">
+
+<p>
+LLVM support for <a href="GarbageCollection.html">Accurate Garbage
+Collection</a> requires the implementation and generation of these intrinsics.
+These intrinsics allow identification of <a href="#i_gcroot">GC roots on the
+stack</a>, as well as garbage collector implementations that require <a
+href="#i_gcread">read</a> and <a href="#i_gcwrite">write</a> barriers.
+Front-ends for type-safe garbage collected languages should generate these
+intrinsics to make use of the LLVM garbage collectors.  For more details, see <a
+href="GarbageCollection.html">Accurate Garbage Collection with LLVM</a>.
+</p>
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+  <a name="i_gcroot">'<tt>llvm.gcroot</tt>' Intrinsic</a>
+</div>
+
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+
+<pre>
+  call void (&lt;ty&gt;**, &lt;ty2&gt;*)* %llvm.gcroot(&lt;ty&gt;** %ptrloc, &lt;ty2&gt;* %metadata)
+</pre>
+
+<h5>Overview:</h5>
+
+<p>The '<tt>llvm.gcroot</tt>' intrinsic declares the existance of a GC root to
+the code generator, and allows some metadata to be associated with it.</p>
+
+<h5>Arguments:</h5>
+
+<p>The first argument specifies the address of a stack object that contains the
+root pointer.  The second pointer (which must be either a constant or a global
+value address) contains the meta-data to be associated with the root.</p>
+
+<h5>Semantics:</h5>
+
+<p>At runtime, a call to this intrinsics stores a null pointer into the "ptrloc"
+location.  At compile-time, the code generator generates information to allow
+the runtime to find the pointer at GC safe points.
+</p>
+
+</div>
+
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+  <a name="i_gcread">'<tt>llvm.gcread</tt>' Intrinsic</a>
+</div>
+
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+
+<pre>
+  call sbyte* (sbyte**)* %llvm.gcread(sbyte** %Ptr)
+</pre>
+
+<h5>Overview:</h5>
+
+<p>The '<tt>llvm.gcread</tt>' intrinsic identifies reads of references from heap
+locations, allowing garbage collector implementations that require read
+barriers.</p>
+
+<h5>Arguments:</h5>
+
+<p>The argument is the address to read from, which should be an address
+allocated from the garbage collector.</p>
+
+<h5>Semantics:</h5>
+
+<p>The '<tt>llvm.gcread</tt>' intrinsic has the same semantics as a load
+instruction, but may be replaced with substantially more complex code by the
+garbage collector runtime, as needed.</p>
+
+</div>
+
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+  <a name="i_gcwrite">'<tt>llvm.gcwrite</tt>' Intrinsic</a>
+</div>
+
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+
+<pre>
+  call void (sbyte*, sbyte**)* %llvm.gcwrite(sbyte* %P1, sbyte** %P2)
+</pre>
+
+<h5>Overview:</h5>
+
+<p>The '<tt>llvm.gcwrite</tt>' intrinsic identifies writes of references to heap
+locations, allowing garbage collector implementations that require write
+barriers (such as generational or reference counting collectors).</p>
+
+<h5>Arguments:</h5>
+
+<p>The first argument is the reference to store, and the second is the heap
+location to store to.</p>
+
+<h5>Semantics:</h5>
+
+<p>The '<tt>llvm.gcwrite</tt>' intrinsic has the same semantics as a store
+instruction, but may be replaced with substantially more complex code by the
+garbage collector runtime, as needed.</p>
+
 </div>
 
+
+
 <!-- ======================================================================= -->
 <div class="doc_subsection">
   <a name="int_codegen">Code Generator Intrinsics</a>
@@ -1861,6 +2166,196 @@ source-language caller.
 </p>
 </div>
 
+<!-- ======================================================================= -->
+<div class="doc_subsection">
+  <a name="int_os">Operating System Intrinsics</a>
+</div>
+
+<div class="doc_text">
+<p>
+These intrinsics are provided by LLVM to support the implementation of
+operating system level code.
+</p>
+
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+  <a name="i_readport">'<tt>llvm.readport</tt>' Intrinsic</a>
+</div>
+
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+<pre>
+  call &lt;integer type&gt; (&lt;integer type&gt;)* %llvm.readport (&lt;integer type&gt; &lt;address&gt;)
+</pre>
+
+<h5>Overview:</h5>
+
+<p>
+The '<tt>llvm.readport</tt>' intrinsic reads data from the specified hardware
+I/O port.
+</p>
+
+<h5>Arguments:</h5>
+
+<p>
+The argument to this intrinsic indicates the hardware I/O address from which
+to read the data.  The address is in the hardware I/O address namespace (as
+opposed to being a memory location for memory mapped I/O).
+</p>
+
+<h5>Semantics:</h5>
+
+<p>
+The '<tt>llvm.readport</tt>' intrinsic reads data from the hardware I/O port
+specified by <i>address</i> and returns the value.  The address and return
+value must be integers, but the size is dependent upon the platform upon which
+the program is code generated.  For example, on x86, the address must be an
+unsigned 16 bit value, and the return value must be 8, 16, or 32 bits.
+</p>
+
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+  <a name="i_writeport">'<tt>llvm.writeport</tt>' Intrinsic</a>
+</div>
+
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+<pre>
+  call void (&lt;integer type&gt;, &lt;integer type&gt;)* %llvm.writeport (&lt;integer type&gt; &lt;value&gt;, &lt;integer type&gt; &lt;address&gt;)
+</pre>
+
+<h5>Overview:</h5>
+
+<p>
+The '<tt>llvm.writeport</tt>' intrinsic writes data to the specified hardware
+I/O port.
+</p>
+
+<h5>Arguments:</h5>
+
+<p>
+The first argument is the value to write to the I/O port.
+</p>
+
+<p>
+The second argument indicates the hardware I/O address to which data should be
+written.  The address is in the hardware I/O address namespace (as opposed to
+being a memory location for memory mapped I/O).
+</p>
+
+<h5>Semantics:</h5>
+
+<p>
+The '<tt>llvm.writeport</tt>' intrinsic writes <i>value</i> to the I/O port
+specified by <i>address</i>.  The address and value must be integers, but the
+size is dependent upon the platform upon which the program is code generated.
+For example, on x86, the address must be an unsigned 16 bit value, and the
+value written must be 8, 16, or 32 bits in length.
+</p>
+
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+  <a name="i_readio">'<tt>llvm.readio</tt>' Intrinsic</a>
+</div>
+
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+<pre>
+  call &lt;result&gt; (&lt;ty&gt;*)* %llvm.readio (&lt;ty&gt; * &lt;pointer&gt;)
+</pre>
+
+<h5>Overview:</h5>
+
+<p>
+The '<tt>llvm.readio</tt>' intrinsic reads data from a memory mapped I/O
+address.
+</p>
+
+<h5>Arguments:</h5>
+
+<p>
+The argument to this intrinsic is a pointer indicating the memory address from
+which to read the data.  The data must be a
+<a href="#t_firstclass">first class</a> type.
+</p>
+
+<h5>Semantics:</h5>
+
+<p>
+The '<tt>llvm.readio</tt>' intrinsic reads data from a memory mapped I/O
+location specified by <i>pointer</i> and returns the value.  The argument must
+be a pointer, and the return value must be a
+<a href="#t_firstclass">first class</a> type.  However, certain architectures
+may not support I/O on all first class types.  For example, 32 bit processors
+may only support I/O on data types that are 32 bits or less.
+</p>
+
+<p>
+This intrinsic enforces an in-order memory model for llvm.readio and
+llvm.writeio calls on machines that use dynamic scheduling.  Dynamically
+scheduled processors may execute loads and stores out of order, re-ordering at
+run time accesses to memory mapped I/O registers.  Using these intrinsics
+ensures that accesses to memory mapped I/O registers occur in program order.
+</p>
+
+</div>
+
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection">
+  <a name="i_writeio">'<tt>llvm.writeio</tt>' Intrinsic</a>
+</div>
+
+<div class="doc_text">
+
+<h5>Syntax:</h5>
+<pre>
+  call void (&lt;ty1&gt;, &lt;ty2&gt;*)* %llvm.writeio (&lt;ty1&gt; &lt;value&gt;, &lt;ty2&gt; * &lt;pointer&gt;)
+</pre>
+
+<h5>Overview:</h5>
+
+<p>
+The '<tt>llvm.writeio</tt>' intrinsic writes data to the specified memory
+mapped I/O address.
+</p>
+
+<h5>Arguments:</h5>
+
+<p>
+The first argument is the value to write to the memory mapped I/O location.
+The second argument is a pointer indicating the memory address to which the
+data should be written.
+</p>
+
+<h5>Semantics:</h5>
+
+<p>
+The '<tt>llvm.writeio</tt>' intrinsic writes <i>value</i> to the memory mapped
+I/O address specified by <i>pointer</i>.  The value must be a
+<a href="#t_firstclass">first class</a> type.  However, certain architectures
+may not support I/O on all first class types.  For example, 32 bit processors
+may only support I/O on data types that are 32 bits or less.
+</p>
+
+<p>
+This intrinsic enforces an in-order memory model for llvm.readio and
+llvm.writeio calls on machines that use dynamic scheduling.  Dynamically
+scheduled processors may execute loads and stores out of order, re-ordering at
+run time accesses to memory mapped I/O registers.  Using these intrinsics
+ensures that accesses to memory mapped I/O registers occur in program order.
+</p>
+
+</div>
+
 
 <!-- ======================================================================= -->
 <div class="doc_subsection">