You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8 lines
23 KiB

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>InferIR__Exp (InferIR.InferIR__Exp)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><meta name="generator" content="doc-ock-html v1.0.0-1-g1fc9bf0"/></head><body><nav id="top"><a href="../index.html">Up</a> &mdash; <span class="package">package <a href="../index.html">InferIR</a></span></nav><header><h1><span class="keyword">Module</span> <span class="module-path">InferIR__Exp</span></h1></header><p>The Smallfoot Intermediate Language: Expressions</p><div class="spec module" id="module-F"><a href="#module-F" class="anchor"></a><div class="def module"><code><span class="keyword">module </span>F = Format</code></div><div class="doc"></div></div><div class="spec type" id="type-closure"><a href="#type-closure" class="anchor"></a><div class="def type"><code><span class="keyword">type </span>closure</code><code></code><code><span class="keyword"> = </span></code><code>{</code><table class="record"><tr id="type-closure.name" class="anchored"><td class="def field"><a href="#type-closure.name" class="anchor"></a><code>name : <a href="../InferIR/Typ/Procname/index.html#type-t">InferIR.Typ.Procname.t</a>;</code></td></tr><tr id="type-closure.captured_vars" class="anchored"><td class="def field"><a href="#type-closure.captured_vars" class="anchor"></a><code>captured_vars : (<a href="index.html#type-t">t</a><span class="keyword"> * </span><a href="../InferIR/Pvar/index.html#type-t">InferIR.Pvar.t</a><span class="keyword"> * </span><a href="../InferIR/Typ/index.html#type-t">InferIR.Typ.t</a>) list;</code></td></tr></table><code>}</code><code></code></div><div class="doc"></div></div><div class="spec type" id="type-sizeof_data"><a href="#type-sizeof_data" class="anchor"></a><div class="def type"><code><span class="keyword">type </span>sizeof_data</code><code></code><code><span class="keyword"> = </span></code><code>{</code><table class="record"><tr id="type-sizeof_data.typ" class="anchored"><td class="def field"><a href="#type-sizeof_data.typ" class="anchor"></a><code>typ : <a href="../InferIR/Typ/index.html#type-t">InferIR.Typ.t</a>;</code></td></tr><tr id="type-sizeof_data.nbytes" class="anchored"><td class="def field"><a href="#type-sizeof_data.nbytes" class="anchor"></a><code>nbytes : int option;</code></td></tr><tr id="type-sizeof_data.dynamic_length" class="anchored"><td class="def field"><a href="#type-sizeof_data.dynamic_length" class="anchor"></a><code>dynamic_length : <a href="index.html#type-t">t</a> option;</code></td></tr><tr id="type-sizeof_data.subtype" class="anchored"><td class="def field"><a href="#type-sizeof_data.subtype" class="anchor"></a><code>subtype : <a href="../InferIR/Subtype/index.html#type-t">InferIR.Subtype.t</a>;</code></td></tr></table><code>}</code><code></code></div><div class="doc"><p>This records information about a <code class="code">sizeof(typ)</code> expression.</p><p><code class="code">nbytes</code> represents the result of the evaluation of <code class="code">sizeof(typ)</code> if it is statically known.</p><p>If <code class="code">typ</code> is of the form <code class="code">Tarray elt (Some static_length)</code>, then <code class="code">dynamic_length</code> is the number
of elements of type <code class="code">elt</code> in the array. The <code class="code">dynamic_length</code>, tracked by symbolic execution, may
differ from the <code class="code">static_length</code> obtained from the type definition, e.g. when an array is
over-allocated.</p><p>If <code class="code">typ</code> is a struct type, the <code class="code">dynamic_length</code> is that of the final extensible array, if any.</p></div></div><div class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><div class="def type"><code><span class="keyword">type </span>t</code><code></code><code><span class="keyword"> = </span></code><table class="variant"><tr id="type-t.Var" class="anchored"><td class="def constructor"><a href="#type-t.Var" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Var</span><span class="keyword"> of </span><a href="../InferIR/Ident/index.html#type-t">InferIR.Ident.t</a></code></td><td class="doc"><p>(** Pure variable: it is not an lvalue *)</p></td></tr><tr id="type-t.UnOp" class="anchored"><td class="def constructor"><a href="#type-t.UnOp" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">UnOp</span><span class="keyword"> of </span><a href="../InferIR/Unop/index.html#type-t">InferIR.Unop.t</a><span class="keyword"> * </span><a href="index.html#type-t">t</a><span class="keyword"> * </span><a href="../InferIR/Typ/index.html#type-t">InferIR.Typ.t</a> option</code></td><td class="doc"><p>(** Unary operator with type of the result if known *)</p></td></tr><tr id="type-t.BinOp" class="anchored"><td class="def constructor"><a href="#type-t.BinOp" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">BinOp</span><span class="keyword"> of </span><a href="../InferIR/Binop/index.html#type-t">InferIR.Binop.t</a><span class="keyword"> * </span><a href="index.html#type-t">t</a><span class="keyword"> * </span><a href="index.html#type-t">t</a></code></td><td class="doc"><p>(** Binary operator *)</p></td></tr><tr id="type-t.Exn" class="anchored"><td class="def constructor"><a href="#type-t.Exn" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Exn</span><span class="keyword"> of </span><a href="index.html#type-t">t</a></code></td><td class="doc"><p>(** Exception *)</p></td></tr><tr id="type-t.Closure" class="anchored"><td class="def constructor"><a href="#type-t.Closure" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Closure</span><span class="keyword"> of </span><a href="index.html#type-closure">closure</a></code></td><td class="doc"><p>(** Anonymous function *)</p></td></tr><tr id="type-t.Const" class="anchored"><td class="def constructor"><a href="#type-t.Const" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Const</span><span class="keyword"> of </span><a href="../InferIR/Const/index.html#type-t">InferIR.Const.t</a></code></td><td class="doc"><p>(** Constants *)</p></td></tr><tr id="type-t.Cast" class="anchored"><td class="def constructor"><a href="#type-t.Cast" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Cast</span><span class="keyword"> of </span><a href="../InferIR/Typ/index.html#type-t">InferIR.Typ.t</a><span class="keyword"> * </span><a href="index.html#type-t">t</a></code></td><td class="doc"><p>(** Type cast *)</p></td></tr><tr id="type-t.Lvar" class="anchored"><td class="def constructor"><a href="#type-t.Lvar" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Lvar</span><span class="keyword"> of </span><a href="../InferIR/Pvar/index.html#type-t">InferIR.Pvar.t</a></code></td><td class="doc"><p>(** The address of a program variable *)</p></td></tr><tr id="type-t.Lfield" class="anchored"><td class="def constructor"><a href="#type-t.Lfield" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Lfield</span><span class="keyword"> of </span><a href="index.html#type-t">t</a><span class="keyword"> * </span><a href="../InferIR/Typ/Fieldname/index.html#type-t">InferIR.Typ.Fieldname.t</a><span class="keyword"> * </span><a href="../InferIR/Typ/index.html#type-t">In
If not a sizeof, return the default type if given, otherwise raise an exception</p></div></div><div class="spec val" id="val-root_of_lexp"><a href="#val-root_of_lexp" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>root_of_lexp : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Return the root of <code class="code">lexp</code>.</p></div></div><div class="spec val" id="val-get_undefined"><a href="#val-get_undefined" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>get_undefined : bool <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Get an expression &quot;undefined&quot;, the boolean indicates
whether the undefined value goest into the footprint</p></div></div><div class="spec val" id="val-pointer_arith"><a href="#val-pointer_arith" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>pointer_arith : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> bool</code></div><div class="doc"><p>Checks whether an expression denotes a location using pointer arithmetic.
Currently, catches array - indexing expressions such as a<code class="code">i</code> only.</p></div></div><div class="spec val" id="val-has_local_addr"><a href="#val-has_local_addr" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>has_local_addr : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> bool</code></div><div class="doc"><p>returns true if the expression operates on address of local variable</p></div></div><div class="spec val" id="val-zero"><a href="#val-zero" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>zero : <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Integer constant 0</p></div></div><div class="spec val" id="val-null"><a href="#val-null" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>null : <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Null constant</p></div></div><div class="spec val" id="val-one"><a href="#val-one" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>one : <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Integer constant 1</p></div></div><div class="spec val" id="val-minus_one"><a href="#val-minus_one" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>minus_one : <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Integer constant -1</p></div></div><div class="spec val" id="val-int"><a href="#val-int" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>int : <a href="../InferIR/IntLit/index.html#type-t">InferIR.IntLit.t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Create integer constant</p></div></div><div class="spec val" id="val-float"><a href="#val-float" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>float : float <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Create float constant</p></div></div><div class="spec val" id="val-bool"><a href="#val-bool" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>bool : bool <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Create integer constant corresponding to the boolean value</p></div></div><div class="spec val" id="val-eq"><a href="#val-eq" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>eq : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Create expression <code class="code">e1 == e2</code></p></div></div><div class="spec val" id="val-ne"><a href="#val-ne" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>ne : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Create expression <code class="code">e1 != e2</code></p></div></div><div class="spec val" id="val-le"><a href="#val-le" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>le : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Create expression <code class="code">e1 &lt;= e2</code></p></div></div><div class="spec val" id="val-lt"><a href="#val-lt" class="anchor"></a><div class="def val"><code><span class="keyword">val </span>lt : <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a> <span class="keyword">&#8209;&gt;</span> <a href="index.html#type-t">t</a></code></div><div class="doc"><p>Create expression <code class="code">e1 &lt; e2</code><