<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>
<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>
</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>
<h5>Examples:</h5>
<table class="layout">
- <tbody>
- <tr>
- <td><tt>i1</tt></td>
- <td>a single-bit integer.</td>
- </tr><tr>
- <td><tt>i32</tt></td>
- <td>a 32-bit integer.</td>
- </tr><tr>
- <td><tt>i1942652</tt></td>
- <td>a really big integer of over 1 million bits.</td>
+ <tr class="layout">
+ <td class="left"><tt>i1</tt></td>
+ <td class="left">a single-bit integer.</td>
+ </tr>
+ <tr class="layout">
+ <td class="left"><tt>i32</tt></td>
+ <td class="left">a 32-bit integer.</td>
+ </tr>
+ <tr class="layout">
+ <td class="left"><tt>i1942652</tt></td>
+ <td class="left">a really big integer of over 1 million bits.</td>
</tr>
- </tbody>
</table>
<p>Note that the code generator does not yet support large integer types
<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.
+ <dd>A metadata node is a structure-like constant with
+ <a href="#t_metadata">metadata type</a>. 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>
<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
<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>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
computable. Similarly, the code generator may expect a certain metadata format
to the '<tt>iftrue</tt>' <tt>label</tt> argument. If "cond" is <tt>false</tt>,
control flows to the '<tt>iffalse</tt>' <tt>label</tt> argument.</p>
<h5>Example:</h5>
-<pre>Test:<br> %cond = <a href="#i_icmp">icmp</a> eq, i32 %a, %b<br> br i1 %cond, label %IfEqual, label %IfUnequal<br>IfEqual:<br> <a
+<pre>Test:<br> %cond = <a href="#i_icmp">icmp</a> eq i32 %a, %b<br> br i1 %cond, label %IfEqual, label %IfUnequal<br>IfEqual:<br> <a
href="#i_ret">ret</a> i32 1<br>IfUnequal:<br> <a href="#i_ret">ret</a> i32 0<br></pre>
</div>
<!-- _______________________________________________________________________ -->
exception. Additionally, this is important for implementation of
'<tt>catch</tt>' clauses in high-level languages that support them.</p>
+<p>For the purposes of the SSA form, the definition of the value
+returned by the '<tt>invoke</tt>' instruction is deemed to occur on
+the edge from the current block to the "normal" label. If the callee
+unwinds then no return value is available.</p>
+
<h5>Example:</h5>
<pre>
%retval = invoke i32 @Test(i32 15) to label %Continue
<h5>Semantics:</h5>
-<p>Memory is allocated; a pointer is returned. The operation is undefiend if
+<p>Memory is allocated; a pointer is returned. The operation is undefined if
there is insufficient stack space for the allocation. '<tt>alloca</tt>'d
memory is automatically released when the function returns. The '<tt>alloca</tt>'
instruction is commonly used to represent automatic variables that must
block and the PHI instructions: i.e. PHI instructions must be first in
a basic block.</p>
+<p>For the purposes of the SSA form, the use of each incoming value is
+deemed to occur on the edge from the corresponding predecessor block
+to the current block (but after any definition of an '<tt>invoke</tt>'
+instruction's return value on the same edge).</p>
+
<h5>Semantics:</h5>
<p>At runtime, the '<tt>phi</tt>' instruction logically takes on the value