Import Upstream version 20180207
[hcoop/debian/mlton.git] / mlton / codegen / x86-codegen / x86-liveness.sig
1 (* Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 * Copyright (C) 1997-2000 NEC Research Institute.
4 *
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
7 *)
8
9 signature X86_LIVENESS_STRUCTS =
10 sig
11 structure x86: X86
12 structure x86MLtonBasic: X86_MLTON_BASIC
13 sharing x86 = x86MLtonBasic.x86
14 end
15
16 signature X86_LIVENESS =
17 sig
18 include X86_LIVENESS_STRUCTS
19
20 structure LiveSet: sig
21 include SET
22 val toMemLocSet: t -> x86.MemLocSet.t
23 end
24 sharing type LiveSet.Element.t = x86.MemLoc.t
25
26 val track : x86.MemLoc.t -> bool
27
28 structure LiveInfo:
29 sig
30 type t
31 val newLiveInfo : unit -> t
32
33 val setLiveOperands : t * x86.Label.t * x86.Operand.t list -> unit
34 val setLive : t * x86.Label.t * LiveSet.t -> unit
35 val getLive : t * x86.Label.t -> LiveSet.t
36 val completeLiveInfo : {chunk: x86.Chunk.t,
37 liveInfo: t,
38 pass: string} -> unit
39 val completeLiveInfo_msg : unit -> unit
40 val verifyLiveInfo : {chunk: x86.Chunk.t,
41 liveInfo: t} -> bool
42 val verifyLiveInfo_msg : unit -> unit
43 end
44
45 structure Liveness:
46 sig
47 datatype t = T of {liveIn: LiveSet.t,
48 liveOut: LiveSet.t,
49 dead: LiveSet.t}
50
51 val dead: t -> LiveSet.t
52 val liveIn: t -> LiveSet.t
53 val livenessAssembly : {assembly : x86.Assembly.t, live : LiveSet.t} -> t
54 val livenessEntry : {entry : x86.Entry.t, live : LiveSet.t} -> t
55 val livenessTransfer : {transfer: x86.Transfer.t, liveInfo: LiveInfo.t} -> t
56 end
57
58 structure LivenessBlock:
59 sig
60 datatype t = T of {entry: (x86.Entry.t * Liveness.t),
61 profileLabel: x86.ProfileLabel.t option,
62 statements: (x86.Assembly.t * Liveness.t) list,
63 transfer: (x86.Transfer.t * Liveness.t)}
64
65 val printBlock : t -> unit
66 val toLivenessEntry : {entry: x86.Entry.t,
67 live: LiveSet.t} ->
68 {entry: (x86.Entry.t * Liveness.t),
69 live: LiveSet.t}
70 val reLivenessEntry : {entry: (x86.Entry.t * Liveness.t),
71 live: LiveSet.t} ->
72 {entry: (x86.Entry.t * Liveness.t),
73 live: LiveSet.t}
74 val toLivenessStatements : {statements: x86.Assembly.t list,
75 live: LiveSet.t} ->
76 {statements: (x86.Assembly.t * Liveness.t) list,
77 live: LiveSet.t}
78 val reLivenessStatements : {statements: (x86.Assembly.t * Liveness.t) list,
79 live: LiveSet.t} ->
80 {statements: (x86.Assembly.t * Liveness.t) list,
81 live: LiveSet.t}
82 val toLivenessTransfer : {transfer: x86.Transfer.t,
83 liveInfo: LiveInfo.t} ->
84 {transfer: (x86.Transfer.t * Liveness.t),
85 live: LiveSet.t}
86 val reLivenessTransfer : {transfer: (x86.Transfer.t * Liveness.t)} ->
87 {transfer: (x86.Transfer.t * Liveness.t),
88 live: LiveSet.t}
89 val toLivenessBlock : {block: x86.Block.t, liveInfo: LiveInfo.t} -> t
90 val toLivenessBlock_msg : unit -> unit
91 val verifyLivenessBlock : {block: t,
92 liveInfo: LiveInfo.t} -> bool
93 val verifyLivenessBlock_msg : unit -> unit
94 val toBlock : {block: t} -> x86.Block.t
95 val toBlock_msg : unit -> unit
96 end
97 end