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.

2 lines
17 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>IR__Sil (infer.IR__Sil)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../index.html">infer</a> &#x00BB; IR__Sil</nav><h1>Module <code>IR__Sil</code></h1><p>The Smallfoot Intermediate Language</p><nav class="toc"><ul><li><a href="#programs-and-types">Programs and Types</a></li></ul></nav></header><div class="spec module" id="module-F"><a href="#module-F" class="anchor"></a><code><span class="keyword">module</span> F = Stdlib.Format</code></div><section><header><h3 id="programs-and-types"><a href="#programs-and-types" class="anchor"></a>Programs and Types</h3></header><dl><dt class="spec type" id="type-if_kind"><a href="#type-if_kind" class="anchor"></a><code><span class="keyword">type</span> if_kind</code><code> = </code><table class="variant"><tr id="type-if_kind.Ik_bexp" class="anchored"><td class="def constructor"><a href="#type-if_kind.Ik_bexp" class="anchor"></a><code>| </code><code><span class="constructor">Ik_bexp</span></code></td><td class="doc"><p>boolean expressions, and exp ? exp : exp</p></td></tr><tr id="type-if_kind.Ik_dowhile" class="anchored"><td class="def constructor"><a href="#type-if_kind.Ik_dowhile" class="anchor"></a><code>| </code><code><span class="constructor">Ik_dowhile</span></code></td></tr><tr id="type-if_kind.Ik_for" class="anchored"><td class="def constructor"><a href="#type-if_kind.Ik_for" class="anchor"></a><code>| </code><code><span class="constructor">Ik_for</span></code></td></tr><tr id="type-if_kind.Ik_if" class="anchored"><td class="def constructor"><a href="#type-if_kind.Ik_if" class="anchor"></a><code>| </code><code><span class="constructor">Ik_if</span></code></td></tr><tr id="type-if_kind.Ik_land_lor" class="anchored"><td class="def constructor"><a href="#type-if_kind.Ik_land_lor" class="anchor"></a><code>| </code><code><span class="constructor">Ik_land_lor</span></code></td><td class="doc"><p>obtained from translation of &amp;&amp; or ||</p></td></tr><tr id="type-if_kind.Ik_while" class="anchored"><td class="def constructor"><a href="#type-if_kind.Ik_while" class="anchor"></a><code>| </code><code><span class="constructor">Ik_while</span></code></td></tr><tr id="type-if_kind.Ik_switch" class="anchored"><td class="def constructor"><a href="#type-if_kind.Ik_switch" class="anchor"></a><code>| </code><code><span class="constructor">Ik_switch</span></code></td></tr></table></dt><dd><p>Kind of prune instruction</p></dd></dl><div><div class="spec include"><div class="doc"><dl><dt class="spec value" id="val-compare_if_kind"><a href="#val-compare_if_kind" class="anchor"></a><code><span class="keyword">val</span> compare_if_kind : <a href="index.html#type-if_kind">if_kind</a> <span>&#45;&gt;</span> <a href="index.html#type-if_kind">if_kind</a> <span>&#45;&gt;</span> int</code></dt><dt class="spec value" id="val-equal_if_kind"><a href="#val-equal_if_kind" class="anchor"></a><code><span class="keyword">val</span> equal_if_kind : <a href="index.html#type-if_kind">if_kind</a> <span>&#45;&gt;</span> <a href="index.html#type-if_kind">if_kind</a> <span>&#45;&gt;</span> bool</code></dt></dl></div></div></div><dl><dt class="spec type" id="type-instr_metadata"><a href="#type-instr_metadata" class="anchor"></a><code><span class="keyword">type</span> instr_metadata</code><code> = </code><table class="variant"><tr id="type-instr_metadata.Abstract" class="anchored"><td class="def constructor"><a href="#type-instr_metadata.Abstract" class="anchor"></a><code>| </code><code><span class="constructor">Abstract</span> <span class="keyword">of</span> <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a></code></td><td class="doc"><p>a good place to apply abstraction, mostly used in the biabduction analysis</p></td></tr><tr id="type-instr_metadata.CatchEntry" class="anchored"><td class="def constructor"><a href="#type-instr_metadata.CatchEntry" class="anchor"></a><code>| </code><code><span class="constructor">CatchEntry</span> <span class="keyword">of</span> </code><code>{</code><table class="record"><tr id="type-instr_metadata.try_id" class="anchored"><td class="def field"><a href="#type-instr_metadata.try_id" class="anchor"></a><code>try_id : int;</code></td></tr><tr id="type-instr_metadata.loc" class="anchored"><td class="def field"><a href="#type-instr_metadata.loc" class="anchor"></a><code>loc : <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a>;</code></td></tr></table><code>}</code></td><td class="doc"><p>entry of C++ catch blocks</p></td></tr><tr id="type-instr_metadata.ExitScope" class="anchored"><td class="def constructor"><a href="#type-instr_metadata.ExitScope" class="anchor"></a><code>| </code><code><span class="constructor">ExitScope</span> <span class="keyword">of</span> <span><a href="../IR/Var/index.html#type-t">IR.Var.t</a> list</span> * <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a></code></td><td class="doc"><p>remove temporaries and dead program variables</p></td></tr><tr id="type-instr_metadata.Nullify" class="anchored"><td class="def constructor"><a href="#type-instr_metadata.Nullify" class="anchor"></a><code>| </code><code><span class="constructor">Nullify</span> <span class="keyword">of</span> <a href="../IR/Pvar/index.html#type-t">IR.Pvar.t</a> * <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a></code></td><td class="doc"><p>nullify stack variable</p></td></tr><tr id="type-instr_metadata.Skip" class="anchored"><td class="def constructor"><a href="#type-instr_metadata.Skip" class="anchor"></a><code>| </code><code><span class="constructor">Skip</span></code></td><td class="doc"><p>no-op</p></td></tr><tr id="type-instr_metadata.TryEntry" class="anchored"><td class="def constructor"><a href="#type-instr_metadata.TryEntry" class="anchor"></a><code>| </code><code><span class="constructor">TryEntry</span> <span class="keyword">of</span> </code><code>{</code><table class="record"><tr id="type-instr_metadata.try_id" class="anchored"><td class="def field"><a href="#type-instr_metadata.try_id" class="anchor"></a><code>try_id : int;</code></td></tr><tr id="type-instr_metadata.loc" class="anchored"><td class="def field"><a href="#type-instr_metadata.loc" class="anchor"></a><code>loc : <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a>;</code></td></tr></table><code>}</code></td><td class="doc"><p>entry of C++ try block</p></td></tr><tr id="type-instr_metadata.TryExit" class="anchored"><td class="def constructor"><a href="#type-instr_metadata.TryExit" class="anchor"></a><code>| </code><code><span class="constructor">TryExit</span> <span class="keyword">of</span> </code><code>{</code><table class="record"><tr id="type-instr_metadata.try_id" class="anchored"><td class="def field"><a href="#type-instr_metadata.try_id" class="anchor"></a><code>try_id : int;</code></td></tr><tr id="type-instr_metadata.loc" class="anchored"><td class="def field"><a href="#type-instr_metadata.loc" class="anchor"></a><code>loc : <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a>;</code></td></tr></table><code>}</code></td><td class="doc"><p>exit of C++ try block</p></td></tr><tr id="type-instr_metadata.VariableLifetimeBegins" class="anchored"><td class="def constructor"><a href="#type-instr_metadata.VariableLifetimeBegins" class="anchor"></a><code>| </code><code><span class="constructor">VariableLifetimeBegins</span> <span class="keyword">of</span> <a href="../IR/Pvar/index.html#type-t">IR.Pvar.t</a> * <a href="../IR/Typ/index.html#type-t">IR.Typ.t</a> * <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a></code></td><td class="doc"><p>stack variable declared</p></td></tr></table></dt></dl><div><div class="spec include"><div class="doc"><dl><dt class="spec value" id="val-compare_instr_metadata"><a href="#val-compare_instr_metadata" class="anchor"></a><code><span class="keyword">val</span> compare_instr_metadata : <a href="index.html#type-instr_metadata">instr_metadata</a> <span>&#45;&gt;</span> <a href="index.html#type-instr_metadata">instr_metadata</a> <span>&#45;&gt;</span> int</code></dt></dl></div></div></div><dl><dt class="spec type" id="type-instr"><a href="#type-instr" class="anchor"></a><code><span class="keyword">type</span> instr</code><code> = </code><table class="variant"><tr id="type-instr.Load" class="anchored"><td class="def constructor"><a href="#type-instr.Load" class="anchor"></a><code>| </code><code><span class="constructor">Load</span> <span class="keyword">of</span> </code><code>{</code><table class="record"><tr id="type-instr.id" class="anchored"><td class="def field"><a href="#type-instr.id" class="anchor"></a><code>id : <a href="../IR/Ident/index.html#type-t">IR.Ident.t</a>;</code></td></tr><tr id="type-instr.e" class="anchored"><td class="def field"><a href="#type-instr.e" class="anchor"></a><code>e : <a href="../IR/Exp/index.html#type-t">IR.Exp.t</a>;</code></td></tr><tr id="type-instr.root_typ" class="anchored"><td class="def field"><a href="#type-instr.root_typ" class="anchor"></a><code>root_typ : <a href="../IR/Typ/index.html#type-t">IR.Typ.t</a>;</code></td></tr><tr id="type-instr.typ" class="anchored"><td class="def field"><a href="#type-instr.typ" class="anchor"></a><code>typ : <a href="../IR/Typ/index.html#type-t">IR.Typ.t</a>;</code></td></tr><tr id="type-instr.loc" class="anchored"><td class="def field"><a href="#type-instr.loc" class="anchor"></a><code>loc : <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a>;</code></td></tr></table><code>}</code></td><td class="doc"><p>Load a value from the heap into an identifier.</p><p><code>id = *exp:typ(root_typ)</code> where</p><ul><li><code>exp</code> is an expression denoting a heap address</li><li><code>typ</code> is typ of <code>exp</code> and <code>id</code></li><li><code>root_typ</code> is the root type of <code>exp</code></li></ul><p>The <code>root_typ</code> is deprecated: it is broken in C/C++. We are removing <code>root_typ</code> in the future, so please use <code>typ</code> instead.</p></td></tr><tr id="type-instr.Store" class="anchored"><td class="def constructor"><a href="#type-instr.Store" class="anchor"></a><code>| </code><code><span class="constructor">Store</span> <span class="keyword">of</span> </code><code>{</code><table class="record"><tr id="type-instr.e1" class="anchored"><td class="def field"><a href="#type-instr.e1" class="anchor"></a><code>e1 : <a href="../IR/Exp/index.html#type-t">IR.Exp.t</a>;</code></td></tr><tr id="type-instr.root_typ" class="anchored"><td class="def field"><a href="#type-instr.root_typ" class="anchor"></a><code>root_typ : <a href="../IR/Typ/index.html#type-t">IR.Typ.t</a>;</code></td></tr><tr id="type-instr.typ" class="anchored"><td class="def field"><a href="#type-instr.typ" class="anchor"></a><code>typ : <a href="../IR/Typ/index.html#type-t">IR.Typ.t</a>;</code></td></tr><tr id="type-instr.e2" class="anchored"><td class="def field"><a href="#type-instr.e2" class="anchor"></a><code>e2 : <a href="../IR/Exp/index.html#type-t">IR.Exp.t</a>;</code></td></tr><tr id="type-instr.loc" class="anchored"><td class="def field"><a href="#type-instr.loc" class="anchor"></a><code>loc : <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a>;</code></td></tr></table><code>}</code></td><td class="doc"><p>Store the value of an expression into the heap.</p><p><code>*exp1:typ(root_typ) = exp2</code> where</p><ul><li><code>exp1</code> is an expression denoting a heap address</li><li><code>typ</code> is typ of <code>*exp1</code> and <code>exp2</code></li><li><code>root_typ</code> is the root type of <code>exp1</code></li><li><code>exp2</code> is the expression whose value is stored.</li></ul><p>The <code>root_typ</code> is deprecated: it is broken in C/C++. We are removing <code>root_typ</code> in the future, so please use <code>typ</code> instead.</p></td></tr><tr id="type-instr.Prune" class="anchored"><td class="def constructor"><a href="#type-instr.Prune" class="anchor"></a><code>| </code><code><span class="constructor">Prune</span> <span class="keyword">of</span> <a href="../IR/Exp/index.html#type-t">IR.Exp.t</a> * <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a> * bool * <a href="index.html#type-if_kind">if_kind</a></code></td><td class="doc"><p>prune the state based on <code>exp=1</code>, the boolean indicates whether true branch</p></td></tr><tr id="type-instr.Call" class="anchored"><td class="def constructor"><a href="#type-instr.Call" class="anchor"></a><code>| </code><code><span class="constructor">Call</span> <span class="keyword">of</span> <a href="../IR/Ident/index.html#type-t">IR.Ident.t</a> * <a href="../IR/Typ/index.html#type-t">IR.Typ.t</a> * <a href="../IR/Exp/index.html#type-t">IR.Exp.t</a> * <span><span>(<a href="../IR/Exp/index.html#type-t">IR.Exp.t</a> * <a href="../IR/Typ/index.html#type-t">IR.Typ.t</a>)</span> list</span> * <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a> * <a href="../IR/CallFlags/index.html#type-t">IR.CallFlags.t</a></code></td><td class="doc"><p><code>Call ((ret_id, ret_typ), e_fun, arg_ts, loc, call_flags)</code> represents an instruction <code>ret_id = e_fun(arg_ts);</code></p></td></tr><tr id="type-instr.Metadata" class="anchored"><td class="def constructor"><a href="#type-instr.Metadata" class="anchor"></a><code>| </code><code><span class="constructor">Metadata</span> <span class="keyword">of</span> <a href="index.html#type-instr_metadata">instr_metadata</a></code></td><td class="doc"><p>hints about the program that are not strictly needed to understand its semantics, for instance information about its original syntactic structure</p></td></tr></table></dt><dd><p>An instruction.</p></dd></dl><div><div class="spec include"><div class="doc"><dl><dt class="spec value" id="val-compare_instr"><a href="#val-compare_instr" class="anchor"></a><code><span class="keyword">val</span> compare_instr : <a href="index.html#type-instr">instr</a> <span>&#45;&gt;</span> <a href="index.html#type-instr">instr</a> <span>&#45;&gt;</span> int</code></dt></dl></div></div></div><dl><dt class="spec value" id="val-equal_instr"><a href="#val-equal_instr" class="anchor"></a><code><span class="keyword">val</span> equal_instr : <a href="index.html#type-instr">instr</a> <span>&#45;&gt;</span> <a href="index.html#type-instr">instr</a> <span>&#45;&gt;</span> bool</code></dt><dt class="spec value" id="val-skip_instr"><a href="#val-skip_instr" class="anchor"></a><code><span class="keyword">val</span> skip_instr : <a href="index.html#type-instr">instr</a></code></dt><dt class="spec value" id="val-instr_is_auxiliary"><a href="#val-instr_is_auxiliary" class="anchor"></a><code><span class="keyword">val</span> instr_is_auxiliary : <a href="index.html#type-instr">instr</a> <span>&#45;&gt;</span> bool</code></dt><dd><p>Check if an instruction is auxiliary, or if it comes from source instructions.</p></dd></dl><dl><dt class="spec value" id="val-location_of_instr"><a href="#val-location_of_instr" class="anchor"></a><code><span class="keyword">val</span> location_of_instr : <a href="index.html#type-instr">instr</a> <span>&#45;&gt;</span> <a href="../IBase/Location/index.html#type-t">IBase.Location.t</a></code></dt><dd><p>Get the location of the instruction</p></dd></dl><dl><dt class="spec value" id="val-exps_of_instr"><a href="#val-exps_of_instr" class="anchor"></a><code><span class="keyword">val</span> exps_of_instr : <a href="index.html#type-instr">instr</a> <span>&#45;&gt;</span> <span><a href="../IR/Exp/index.html#type-t">IR.Exp.t</a> list</span></code></dt><dd><p>get the expressions occurring in the instruction</p></dd></dl><dl><dt class="spec value" id="val-if_kind_to_string"><a href="#val-if_kind_to_string" class="anchor"></a><code><span class="keyword">val</span> if_kind_to_string : <a href="index.html#type-if_kind">if_kind</a> <span>&#45;&gt;</span> string</code></dt><dd><p>Pretty print an if_kind</p></dd></dl><dl><dt class="spec value" id="val-pp_instr_metadata"><a href="#val-pp_instr_metadata" class="anchor"></a><code><span class="keyword">val</span> pp_instr_metadata : <a href="../IStdlib/Pp/index.html#type-env">IStdlib.Pp.env</a> <span>&#45;&gt;</span> <a href="index.html#module-F">F</a>.formatter <span>&#45;&gt;</span> <a href="index.html#type-instr_metadata">instr_metadata</a> <span>&#45;&gt;</span> unit</code></dt><dt class="spec value" id="val-pp_instr"><a href="#val-pp_instr" class="anchor"></a><code><span class="keyword">val</span> pp_instr : <span>print_types:bool</span> <span>&#45;&gt;</span> <a href="../IStdlib/Pp/index.html#type-env">IStdlib.Pp.env</a> <span>&#45;&gt;</span> <a href="index.html#module-F">F</a>.formatter <span>&#45;&gt;</span> <a href="index.html#type-instr">instr</a> <span>&#45;&gt;</span> unit</code></dt><dd><p>Pretty print an instruction.</p></dd></dl><dl><dt class="spec value" id="val-d_instr"><a href="#val-d_instr" class="anchor"></a><code><span class="keyword">val</span> d_instr : <a href="index.html#type-instr">instr</a> <span>&#45;&gt;</span> unit</code></dt><dd><p>Dump an instruction.</p></dd></dl></section></div></body></html>