-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtltree.mli
56 lines (43 loc) · 1.57 KB
/
rtltree.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
(** {2 Register Transfer Language} *)
open Ops
type register = Register.t
type label = Label.t
(** Les différents instructions RTL.
Chaque instruction contient la ou les étiquettes
suivantes dans le graphe de flot de contrôle. *)
type instr =
| Econst of int32 * register * label
| Eload of register * int * register * label
| Estore of register * register * int * label
| Emunop of munop * register * label
| Embinop of mbinop * register * register * label
(** attention au sens : [op r1 r2] représente [r2 <- r2 op r1] *)
| Emubranch of mubranch * register * label * label
| Embbranch of mbbranch * register * register * label * label
(** attention au sens : [br r1 r2] représente [r2 br r1] *)
| Ecall of register * string * register list * label
| Egoto of label
type cfg = instr Label.map
(** Un graphe de flot de contrôle est un dictionnaire associant à des
étiquettes des instructions RTL. *)
(** Une fonction RTL. *)
type deffun = {
fun_name : string;
fun_formals: register list;
fun_result : register;
fun_locals : Register.set;
(** toutes les variables locales de la fonction maintenant regroupées ici *)
fun_entry : label;
fun_exit : label;
fun_body : cfg;
}
(** Un programme RTL. *)
type file = {
funs : deffun list;
}
(** {2 Fonctions d'impression, pour debugger} *)
val print_instr: Format.formatter -> instr -> unit
val print_graph: Format.formatter ->
cfg -> (*entry*)Label.t -> (*exit*)Label.t -> unit
val print_deffun: Format.formatter -> deffun -> unit
val print_file: Format.formatter -> file -> unit