4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="AsciiDoc 8.6.9">
7 <link rel="stylesheet" href="./asciidoc.css" type="text/css">
8 <link rel="stylesheet" href="./pygments.css" type="text/css">
11 <script type="text/javascript" src="./asciidoc.js"></script>
12 <script type="text/javascript">
17 <link rel="stylesheet" href="./mlton.css" type="text/css">
19 <body class="article">
21 <div id="banner-home">
22 <a href="./Home">MLton 20180207</a>
30 <div class="sectionbody">
31 <div class="paragraph"><p><a href="SSA2">SSA2</a> is an <a href="IntermediateLanguage">IntermediateLanguage</a>, translated from <a href="SSA">SSA</a> by
32 <a href="ToSSA2">ToSSA2</a>, optimized by <a href="SSA2Simplify">SSA2Simplify</a>, and translated by
33 <a href="ToRSSA">ToRSSA</a> to <a href="RSSA">RSSA</a>.</p></div>
37 <h2 id="_description">Description</h2>
38 <div class="sectionbody">
39 <div class="paragraph"><p><a href="SSA2">SSA2</a> is a <a href="FirstOrder">FirstOrder</a>, <a href="SimplyTyped">SimplyTyped</a>
40 <a href="IntermediateLanguage">IntermediateLanguage</a>, a slight variant of the <a href="SSA">SSA</a>
41 <a href="IntermediateLanguage">IntermediateLanguage</a>,</p></div>
42 <div class="paragraph"><p>Like <a href="SSA">SSA</a>, an <a href="SSA2">SSA2</a> program consists of a collection of datatype
43 declarations, a sequence of global statements, and a collection of
44 functions, along with a distinguished "main" function. Each function
45 consists of a collection of basic blocks, where each basic block is a
46 sequence of statements ending with some control transfer.</p></div>
47 <div class="paragraph"><p>Unlike <a href="SSA">SSA</a>, <a href="SSA2">SSA2</a> includes mutable fields in objects and makes
48 the vector type constructor n-ary instead of unary. This allows
49 optimizations like <a href="RefFlatten">RefFlatten</a> and <a href="DeepFlatten">DeepFlatten</a> to be expressed.</p></div>
53 <h2 id="_implementation">Implementation</h2>
54 <div class="sectionbody">
55 <div class="ulist"><ul>
58 <a href="https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa2.sig"><span class="monospaced">ssa2.sig</span></a>
63 <a href="https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa2.fun"><span class="monospaced">ssa2.fun</span></a>
68 <a href="https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa-tree2.sig"><span class="monospaced">ssa-tree2.sig</span></a>
73 <a href="https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa-tree2.fun"><span class="monospaced">ssa-tree2.fun</span></a>
80 <h2 id="_type_checking">Type Checking</h2>
81 <div class="sectionbody">
82 <div class="paragraph"><p>Type checking (<a href="https://github.com/MLton/mlton/blob/master/mlton/ssa/type-check2.sig"><span class="monospaced">type-check2.sig</span></a>,
83 <a href="https://github.com/MLton/mlton/blob/master/mlton/ssa/type-check2.fun"><span class="monospaced">type-check2.fun</span></a>) of a <a href="SSA2">SSA2</a>
84 program verifies the following:</p></div>
85 <div class="ulist"><ul>
88 no duplicate definitions (tycons, cons, vars, labels, funcs)
93 no out of scope references (tycons, cons, vars, labels, funcs)
98 variable definitions dominate variable uses
103 case transfers are exhaustive and irredundant
108 <span class="monospaced">Enter</span>/<span class="monospaced">Leave</span> profile statements match
113 "traditional" well-typedness
120 <h2 id="_details_and_notes">Details and Notes</h2>
121 <div class="sectionbody">
122 <div class="paragraph"><p>SSA is an abbreviation for Static Single Assignment.</p></div>
126 <div id="footnotes"><hr></div>
128 <div id="footer-text">
130 <div id="footer-badges">