Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | <!DOCTYPE html>\r |
2 | <html lang="en">\r | |
3 | <head>\r | |
4 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\r | |
5 | <meta name="generator" content="AsciiDoc 8.6.9">\r | |
6 | <title>ToMachine</title>\r | |
7 | <link rel="stylesheet" href="./asciidoc.css" type="text/css">\r | |
8 | <link rel="stylesheet" href="./pygments.css" type="text/css">\r | |
9 | \r | |
10 | \r | |
11 | <script type="text/javascript" src="./asciidoc.js"></script>\r | |
12 | <script type="text/javascript">\r | |
13 | /*<![CDATA[*/\r | |
14 | asciidoc.install();\r | |
15 | /*]]>*/\r | |
16 | </script>\r | |
17 | <link rel="stylesheet" href="./mlton.css" type="text/css">\r | |
18 | </head>\r | |
19 | <body class="article">\r | |
20 | <div id="banner">\r | |
21 | <div id="banner-home">\r | |
22 | <a href="./Home">MLton 20180207</a>\r | |
23 | </div>\r | |
24 | </div>\r | |
25 | <div id="header">\r | |
26 | <h1>ToMachine</h1>\r | |
27 | </div>\r | |
28 | <div id="content">\r | |
29 | <div id="preamble">\r | |
30 | <div class="sectionbody">\r | |
31 | <div class="paragraph"><p><a href="ToMachine">ToMachine</a> is a translation pass from the <a href="RSSA">RSSA</a>\r | |
32 | <a href="IntermediateLanguage">IntermediateLanguage</a> to the <a href="Machine">Machine</a> <a href="IntermediateLanguage">IntermediateLanguage</a>.</p></div>\r | |
33 | </div>\r | |
34 | </div>\r | |
35 | <div class="sect1">\r | |
36 | <h2 id="_description">Description</h2>\r | |
37 | <div class="sectionbody">\r | |
38 | <div class="paragraph"><p>This pass converts from a <a href="RSSA">RSSA</a> program into a <a href="Machine">Machine</a> program.</p></div>\r | |
39 | <div class="paragraph"><p>It uses <a href="AllocateRegisters">AllocateRegisters</a>, <a href="Chunkify">Chunkify</a>, and <a href="ParallelMove">ParallelMove</a>.</p></div>\r | |
40 | </div>\r | |
41 | </div>\r | |
42 | <div class="sect1">\r | |
43 | <h2 id="_implementation">Implementation</h2>\r | |
44 | <div class="sectionbody">\r | |
45 | <div class="ulist"><ul>\r | |
46 | <li>\r | |
47 | <p>\r | |
48 | <a href="https://github.com/MLton/mlton/blob/master/mlton/backend/backend.sig"><span class="monospaced">backend.sig</span></a>\r | |
49 | </p>\r | |
50 | </li>\r | |
51 | <li>\r | |
52 | <p>\r | |
53 | <a href="https://github.com/MLton/mlton/blob/master/mlton/backend/backend.fun"><span class="monospaced">backend.fun</span></a>\r | |
54 | </p>\r | |
55 | </li>\r | |
56 | </ul></div>\r | |
57 | </div>\r | |
58 | </div>\r | |
59 | <div class="sect1">\r | |
60 | <h2 id="_details_and_notes">Details and Notes</h2>\r | |
61 | <div class="sectionbody">\r | |
62 | <div class="paragraph"><p>Because the MLton runtime system is shared by all <a href="Codegen">codegens</a>, it is most\r | |
63 | convenient to decide on stack layout <em>before</em> any <a href="Codegen">codegen</a> takes over.\r | |
64 | In particular, we compute all the stack frame info for each <a href="RSSA">RSSA</a>\r | |
65 | function, including stack size, <a href="GarbageCollection">garbage collector</a>\r | |
66 | masks for each frame, etc. To do so, the <a href="Machine">Machine</a>\r | |
67 | <a href="IntermediateLanguage">IntermediateLanguage</a> imagines an abstract machine with an infinite\r | |
68 | number of (pseudo-)registers of every size. A liveness analysis\r | |
69 | determines, for each variable, whether or not it is live across a\r | |
70 | point where the runtime system might take over (for example, any\r | |
71 | garbage collection point) or a non-tail call to another <a href="RSSA">RSSA</a>\r | |
72 | function. Those that are live go on the stack, while those that\r | |
73 | aren’t live go into psuedo-registers. From this information, we know\r | |
74 | all we need to about each stack frame. On the downside, nothing\r | |
75 | further on is allowed to change this stack info; it is set in stone.</p></div>\r | |
76 | </div>\r | |
77 | </div>\r | |
78 | </div>\r | |
79 | <div id="footnotes"><hr></div>\r | |
80 | <div id="footer">\r | |
81 | <div id="footer-text">\r | |
82 | </div>\r | |
83 | <div id="footer-badges">\r | |
84 | </div>\r | |
85 | </div>\r | |
86 | </body>\r | |
87 | </html>\r |