Import Upstream version 20180207
[hcoop/debian/mlton.git] / mlton / ssa / prepasses.sig
1 (* Copyright (C) 2005-2007 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 *
4 * MLton is released under a BSD-style license.
5 * See the file MLton-LICENSE for details.
6 *)
7
8 signature PREPASSES_STRUCTS =
9 sig
10 include TYPE_CHECK
11 end
12
13 signature PREPASSES =
14 sig
15 include PREPASSES_STRUCTS
16
17 (* A critical edge is one that connects a block with two or more
18 * succesors to one with two or more predecessors.
19 * This prepass breaks all critical edges by inserting an eta-block.
20 * For some analyses and transformations, simply ensuring the unique
21 * successor or predecessor property is sufficient. (For example, see
22 * the comments at the end of "Conditional Constant Propagation" in
23 * Section 19.3 of Appel's "Modern Compiler Implementation in ML".)
24 * However, passes that require critical edges to be broken in order
25 * to accomodate code motion (for example, PRE), should also break an
26 * edge that connects a block with non-functional control transfer to
27 * one with two or more predecessors.
28 *)
29 val breakCriticalEdgesFunction:
30 Function.t * {codeMotion: bool} -> Function.t
31 val breakCriticalEdges:
32 Program.t * {codeMotion: bool} -> Program.t
33 val eliminateDeadBlocksFunction: Function.t -> Function.t
34 val eliminateDeadBlocks: Program.t -> Program.t
35 val orderFunctions: Program.t -> Program.t
36 val reverseFunctions: Program.t -> Program.t
37 end