Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / mlton / backend / switch.sig
CommitLineData
7f918cf1
CE
1(* Copyright (C) 2009 Matthew Fluet.
2 * Copyright (C) 2002-2006, 2008 Henry Cejtin, Matthew Fluet, Suresh
3 * Jagannathan, and Stephen Weeks.
4 *
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
7 *)
8
9signature SWITCH_STRUCTS =
10 sig
11 structure Label: LABEL
12 structure Type: REP_TYPE
13 structure WordSize: WORD_SIZE
14 structure WordX: WORD_X
15 sharing WordX = Type.WordX
16
17 structure Use: sig
18 type t
19
20 val layout: t -> Layout.t
21 val ty: t -> Type.t
22 end
23 end
24
25signature SWITCH =
26 sig
27 include SWITCH_STRUCTS
28
29 datatype t =
30 T of {(* Cases are in increasing order of word. *)
31 cases: (WordX.t * Label.t) vector,
32 default: Label.t option,
33 size: WordSize.t,
34 test: Use.t}
35
36 val foldLabelUse: t * 'a * {label: Label.t * 'a -> 'a,
37 use: Use.t * 'a -> 'a} -> 'a
38 val foreachLabel: t * (Label.t -> unit) -> unit
39 val isOk: t * {checkUse: Use.t -> unit,
40 labelIsOk: Label.t -> bool} -> bool
41 val layout: t -> Layout.t
42 end