Fix srcdir <> objdir builds with ocaml 2.10. Downrev versions don't care whether
[oota-llvm.git] / docs / ProgrammersManual.html
index df8f4abf470087c4e00004e70774bd52f1c3990a..a9daba3ba93db94047a96da34c07a75d764dbb06 100644 (file)
@@ -106,6 +106,7 @@ use-def chains</a> </li>
           <li><a href="#schanges_deleting">Deleting             <tt>Instruction</tt>s</a> </li>
           <li><a href="#schanges_replacing">Replacing an                <tt>Instruction</tt>
 with another <tt>Value</tt></a> </li>
+          <li><a href="#schanges_deletingGV">Deleting <tt>GlobalVariable</tt>s</a> </li>  
         </ul>
       </li>
 <!--
@@ -580,9 +581,9 @@ suite, it gives a report that looks like this:</p>
 
 <div class="doc_code">
 <pre>
-   7646 bytecodewriter  - Number of normal instructions
-    725 bytecodewriter  - Number of oversized instructions
- 129996 bytecodewriter  - Number of bytecode bytes written
+   7646 bitcodewriter   - Number of normal instructions
+    725 bitcodewriter   - Number of oversized instructions
+ 129996 bitcodewriter   - Number of bitcode bytes written
    2817 raise           - Number of insts DCEd or constprop'd
    3213 raise           - Number of cast-of-self removed
    5046 raise           - Number of expression trees converted
@@ -803,7 +804,7 @@ vector is also useful when interfacing with code that expects vectors :).
 <div class="doc_code">
 <pre>
 for ( ... ) {
-   std::vector<foo> V;
+   std::vector&lt;foo&gt; V;
    use V;
 }
 </pre>
@@ -813,7 +814,7 @@ for ( ... ) {
 
 <div class="doc_code">
 <pre>
-std::vector<foo> V;
+std::vector&lt;foo&gt; V;
 for ( ... ) {
    use V;
    V.clear();
@@ -1224,7 +1225,7 @@ iterators in a densemap are invalidated whenever an insertion occurs, unlike
 map.  Also, because DenseMap allocates space for a large number of key/value
 pairs (it starts with 64 by default), it will waste a lot of space if your keys
 or values are large.  Finally, you must implement a partial specialization of
-DenseMapKeyInfo for the key that you want, if it isn't already supported.  This
+DenseMapInfo for the key that you want, if it isn't already supported.  This
 is required to tell DenseMap about two special marker values (which can never be
 inserted into the map) that it needs internally.</p>
 
@@ -1878,6 +1879,28 @@ ReplaceInstWithValue, ReplaceInstWithInst -->
 
 </div>
 
+<!--_______________________________________________________________________-->
+<div class="doc_subsubsection">
+  <a name="schanges_deletingGV">Deleting <tt>GlobalVariable</tt>s</a>
+</div>
+
+<div class="doc_text">
+
+<p>Deleting a global variable from a module is just as easy as deleting an 
+Instruction. First, you must have a pointer to the global variable that you wish
+ to delete.  You use this pointer to erase it from its parent, the module.
+ For example:</p>
+
+<div class="doc_code">
+<pre>
+<a href="#GlobalVariable">GlobalVariable</a> *GV = .. ;
+
+GV-&gt;eraseFromParent();
+</pre>
+</div>
+
+</div>
+
 <!-- *********************************************************************** -->
 <div class="doc_section">
   <a name="advanced">Advanced Topics</a>
@@ -1912,7 +1935,7 @@ recursive types and late resolution of opaque types makes the situation very
 difficult to handle.  Fortunately, for the most part, our implementation makes
 most clients able to be completely unaware of the nasty internal details.  The
 primary case where clients are exposed to the inner workings of it are when
-building a recursive type.  In addition to this case, the LLVM bytecode reader,
+building a recursive type.  In addition to this case, the LLVM bitcode reader,
 assembly parser, and linker also have to be aware of the inner workings of this
 system.
 </p>
@@ -2195,7 +2218,7 @@ the <tt>lib/VMCore</tt> directory.</p>
   point type.</dd>
   <dt><tt>StructType</tt></dt>
   <dd>Subclass of DerivedTypes for struct types.</dd>
-  <dt><tt>FunctionType</tt></dt>
+  <dt><tt><a name="FunctionType">FunctionType</a></tt></dt>
   <dd>Subclass of DerivedTypes for function types.
     <ul>
       <li><tt>bool isVarArg() const</tt>: Returns true if its a vararg
@@ -2389,7 +2412,7 @@ method. In addition, all LLVM values can be named.  The "name" of the
 </pre>
 </div>
 
-<p><a name="#nameWarning">The name of this instruction is "foo".</a> <b>NOTE</b>
+<p><a name="nameWarning">The name of this instruction is "foo".</a> <b>NOTE</b>
 that the name of any value may be missing (an empty string), so names should
 <b>ONLY</b> be used for debugging (making the source code easier to read,
 debugging printouts), they should not be used to keep track of values or map
@@ -2621,10 +2644,20 @@ a subclass, which represents the address of a global variable or function.
   <li>ConstantInt : This subclass of Constant represents an integer constant of
   any width.
     <ul>
-      <li><tt>int64_t getSExtValue() const</tt>: Returns the underlying value of
-      this constant as a sign extended signed integer value.</li>
-      <li><tt>uint64_t getZExtValue() const</tt>: Returns the underlying value 
-      of this constant as a zero extended unsigned integer value.</li>
+      <li><tt>const APInt&amp; getValue() const</tt>: Returns the underlying
+      value of this constant, an APInt value.</li>
+      <li><tt>int64_t getSExtValue() const</tt>: Converts the underlying APInt
+      value to an int64_t via sign extension. If the value (not the bit width)
+      of the APInt is too large to fit in an int64_t, an assertion will result.
+      For this reason, use of this method is discouraged.</li>
+      <li><tt>uint64_t getZExtValue() const</tt>: Converts the underlying APInt
+      value to a uint64_t via zero extension. IF the value (not the bit width)
+      of the APInt is too large to fit in a uint64_t, an assertion will result.
+      For this reason, use of this method is discouraged.</li>
+      <li><tt>static ConstantInt* get(const APInt&amp; Val)</tt>: Returns the
+      ConstantInt object that represents the value provided by <tt>Val</tt>.
+      The type is implied as the IntegerType that corresponds to the bit width
+      of <tt>Val</tt>.</li>
       <li><tt>static ConstantInt* get(const Type *Ty, uint64_t Val)</tt>: 
       Returns the ConstantInt object that represents the value provided by 
       <tt>Val</tt> for integer type <tt>Ty</tt>.</li>
@@ -2795,7 +2828,7 @@ is its address (after linking) which is guaranteed to be constant.</p>
     create and what type of linkage the function should have. The <a 
     href="#FunctionType"><tt>FunctionType</tt></a> argument
     specifies the formal arguments and return value for the function. The same
-    <a href="#FunctionTypel"><tt>FunctionType</tt></a> value can be used to
+    <a href="#FunctionType"><tt>FunctionType</tt></a> value can be used to
     create multiple functions. The <tt>Parent</tt> argument specifies the Module
     in which the function is defined. If this argument is provided, the function
     will automatically be inserted into that module's list of