Give embedded metadata its own type instead of relying on EmptyStructTy.
[oota-llvm.git] / docs / LangRef.html
index 9fc14b4fea560010a12b552ff9286a06c83e5a05..f0ec684265982f0e5b3fb3993b69f1ff1809c1f7 100644 (file)
@@ -41,6 +41,7 @@
           <li><a href="#t_floating">Floating Point Types</a></li>
           <li><a href="#t_void">Void Type</a></li>
           <li><a href="#t_label">Label Type</a></li>
+          <li><a href="#t_metadata">Metadata Type</a></li>
         </ol>
       </li>
       <li><a href="#t_derived">Derived Types</a>
@@ -1254,14 +1255,16 @@ classifications:</p>
           <a href="#t_vector">vector</a>,
           <a href="#t_struct">structure</a>,
           <a href="#t_array">array</a>,
-          <a href="#t_label">label</a>.
+          <a href="#t_label">label</a>,
+          <a href="#t_metadata">metadata</a>.
       </td>
     </tr>
     <tr>
       <td><a href="#t_primitive">primitive</a></td>
       <td><a href="#t_label">label</a>,
           <a href="#t_void">void</a>,
-          <a href="#t_floating">floating point</a>.</td>
+          <a href="#t_floating">floating point</a>,
+          <a href="#t_metadata">metadata</a>.</td>
     </tr>
     <tr>
       <td><a href="#t_derived">derived</a></td>
@@ -1337,6 +1340,22 @@ system.</p>
 </pre>
 </div>
 
+<!-- _______________________________________________________________________ -->
+<div class="doc_subsubsection"> <a name="t_metadata">Metadata Type</a> </div>
+
+<div class="doc_text">
+<h5>Overview:</h5>
+<p>The metadata type represents embedded metadata. The only derived type that
+may contain metadata is <tt>metadata*</tt> or a function type that returns or
+takes metadata typed parameters, but not pointer to metadata types.</p>
+
+<h5>Syntax:</h5>
+
+<pre>
+  metadata
+</pre>
+</div>
+
 
 <!-- ======================================================================= -->
 <div class="doc_subsection"> <a name="t_derived">Derived Types</a> </div>
@@ -1866,9 +1885,10 @@ constants and smaller complex constants.</p>
   <dt><b>Metadata node</b></dt>
 
   <dd>A metadata node is a structure-like constant with the type of an empty
-  struct.  For example: "<tt>{ } !{ i32 0, { } !"test" }</tt>". Unlike other
-  constants that are meant to be interpreted as part of the instruction stream,
-  metadata is a place to attach additional information such as debug info.
+  struct.  For example: "<tt>metadata !{ i32 0, metadata !"test" }</tt>".
+  Unlike other constants that are meant to be interpreted as part of the
+  instruction stream, metadata is a place to attach additional information such
+  as debug info.
   </dd>
 </dl>
 
@@ -2046,9 +2066,9 @@ following is the syntax for constant expressions:</p>
 
 <p>Embedded metadata provides a way to attach arbitrary data to the
 instruction stream without affecting the behaviour of the program.  There are
-two metadata primitives, strings and nodes. All metadata has the type of an
-empty struct and is identified in syntax by a preceding exclamation point
-('<tt>!</tt>').
+two metadata primitives, strings and nodes. All metadata has the
+<tt>metadata</tt> type and is identified in syntax by a preceding exclamation
+point ('<tt>!</tt>').
 </p>
 
 <p>A metadata string is a string surrounded by double quotes.  It can contain
@@ -2058,12 +2078,12 @@ the two digit hex code.  For example: "<tt>!"test\00"</tt>".
 
 <p>Metadata nodes are represented with notation similar to structure constants
 (a comma separated list of elements, surrounded by braces and preceeded by an
-exclamation point).  For example: "<tt>!{ { } !"test\00", i32 10}</tt>".
+exclamation point).  For example: "<tt>!{ metadata !"test\00", i32 10}</tt>".
 </p>
 
 <p>A metadata node will attempt to track changes to the values it holds. In
 the event that a value is deleted, it will be replaced with a typeless
-"<tt>null</tt>", such as "<tt>{ } !{null, i32 0}</tt>".</p> 
+"<tt>null</tt>", such as "<tt>metadata !{null, i32 10}</tt>".</p> 
 
 <p>Optimizations may rely on metadata to provide additional information about
 the program that isn't available in the instructions, or that isn't easily