Backport from sid to buster
[hcoop/debian/mlton.git] / doc / guide / localhost / Redundant
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>Redundant</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>Redundant</h1>
27 </div>
28 <div id="content">
29 <div id="preamble">
30 <div class="sectionbody">
31 <div class="paragraph"><p><a href="Redundant">Redundant</a> is an optimization pass for the <a href="SSA">SSA</a>
32 <a href="IntermediateLanguage">IntermediateLanguage</a>, invoked from <a href="SSASimplify">SSASimplify</a>.</p></div>
33 </div>
34 </div>
35 <div class="sect1">
36 <h2 id="_description">Description</h2>
37 <div class="sectionbody">
38 <div class="paragraph"><p>The redundant SSA optimization eliminates redundant function and label
39 arguments; an argument of a function or label is redundant if it is
40 always the same as another argument of the same function or label.
41 The analysis finds an equivalence relation on the arguments of a
42 function or label, such that all arguments in an equivalence class are
43 redundant with respect to the other arguments in the equivalence
44 class; the transformation selects one representative of each
45 equivalence class and drops the binding occurrence of
46 non-representative variables and renames use occurrences of the
47 non-representative variables to the representative variable. The
48 analysis finds the equivalence classes via a fixed-point analysis.
49 Each vector of arguments to a function or label is initialized to
50 equivalence classes that equate all arguments of the same type; one
51 could start with an equivalence class that equates all arguments, but
52 arguments of different type cannot be redundant. Variables bound in
53 statements are initialized to singleton equivalence classes. The
54 fixed-point analysis repeatedly refines these equivalence classes on
55 the formals by the equivalence classes of the actuals.</p></div>
56 </div>
57 </div>
58 <div class="sect1">
59 <h2 id="_implementation">Implementation</h2>
60 <div class="sectionbody">
61 <div class="ulist"><ul>
62 <li>
63 <p>
64 <a href="https://github.com/MLton/mlton/blob/master/mlton/ssa/redundant.fun"><span class="monospaced">redundant.fun</span></a>
65 </p>
66 </li>
67 </ul></div>
68 </div>
69 </div>
70 <div class="sect1">
71 <h2 id="_details_and_notes">Details and Notes</h2>
72 <div class="sectionbody">
73 <div class="paragraph"><p>The reason <a href="Redundant">Redundant</a> got put in was due to some output of the
74 <a href="ClosureConvert">ClosureConvert</a> pass converter where the environment record, or
75 components of it, were passed around in several places. That may have
76 been more relevant with polyvariant analyses (which are long gone).
77 But it still seems possibly relevant, especially with more aggressive
78 flattening, which should reveal some fields in nested closure records
79 that are redundant.</p></div>
80 </div>
81 </div>
82 </div>
83 <div id="footnotes"><hr></div>
84 <div id="footer">
85 <div id="footer-text">
86 </div>
87 <div id="footer-badges">
88 </div>
89 </div>
90 </body>
91 </html>