Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / localhost / SSA2
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta name="generator" content="AsciiDoc 8.6.9">
6 <title>SSA2</title>
7 <link rel="stylesheet" href="./asciidoc.css" type="text/css">
8 <link rel="stylesheet" href="./pygments.css" type="text/css">
9
10
11 <script type="text/javascript" src="./asciidoc.js"></script>
12 <script type="text/javascript">
13 /*<![CDATA[*/
14 asciidoc.install();
15 /*]]>*/
16 </script>
17 <link rel="stylesheet" href="./mlton.css" type="text/css">
18 </head>
19 <body class="article">
20 <div id="banner">
21 <div id="banner-home">
22 <a href="./Home">MLton 20180207</a>
23 </div>
24 </div>
25 <div id="header">
26 <h1>SSA2</h1>
27 </div>
28 <div id="content">
29 <div id="preamble">
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>
34 </div>
35 </div>
36 <div class="sect1">
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>
50 </div>
51 </div>
52 <div class="sect1">
53 <h2 id="_implementation">Implementation</h2>
54 <div class="sectionbody">
55 <div class="ulist"><ul>
56 <li>
57 <p>
58 <a href="https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa2.sig"><span class="monospaced">ssa2.sig</span></a>
59 </p>
60 </li>
61 <li>
62 <p>
63 <a href="https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa2.fun"><span class="monospaced">ssa2.fun</span></a>
64 </p>
65 </li>
66 <li>
67 <p>
68 <a href="https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa-tree2.sig"><span class="monospaced">ssa-tree2.sig</span></a>
69 </p>
70 </li>
71 <li>
72 <p>
73 <a href="https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa-tree2.fun"><span class="monospaced">ssa-tree2.fun</span></a>
74 </p>
75 </li>
76 </ul></div>
77 </div>
78 </div>
79 <div class="sect1">
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>
86 <li>
87 <p>
88 no duplicate definitions (tycons, cons, vars, labels, funcs)
89 </p>
90 </li>
91 <li>
92 <p>
93 no out of scope references (tycons, cons, vars, labels, funcs)
94 </p>
95 </li>
96 <li>
97 <p>
98 variable definitions dominate variable uses
99 </p>
100 </li>
101 <li>
102 <p>
103 case transfers are exhaustive and irredundant
104 </p>
105 </li>
106 <li>
107 <p>
108 <span class="monospaced">Enter</span>/<span class="monospaced">Leave</span> profile statements match
109 </p>
110 </li>
111 <li>
112 <p>
113 "traditional" well-typedness
114 </p>
115 </li>
116 </ul></div>
117 </div>
118 </div>
119 <div class="sect1">
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>
123 </div>
124 </div>
125 </div>
126 <div id="footnotes"><hr></div>
127 <div id="footer">
128 <div id="footer-text">
129 </div>
130 <div id="footer-badges">
131 </div>
132 </div>
133 </body>
134 </html>