Module Rtltree

module Rtltree: sig .. end

Register Transfer Language


type register = Register.t 
type label = Label.t 
type instr = 
| Econst of int32 * register * label
| Eload of register * int * register * label
| Estore of register * register * int * label
| Emunop of Ops.munop * register * label
| Embinop of Ops.mbinop * register * register * label (*

attention au sens : op r1 r2 représente r2 <- r2 op r1

*)
| Emubranch of Ops.mubranch * register * label * label
| Embbranch of Ops.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

Les différents instructions RTL. Chaque instruction contient la ou les étiquettes suivantes dans le graphe de flot de contrôle.

type cfg = instr Label.map 

Un graphe de flot de contrôle est un dictionnaire associant à des étiquettes des instructions 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;
}

Une fonction RTL.

type file = {
   funs : deffun list;
}

Un programme RTL.

Fonctions d'impression, pour debugger

val print_instr : Stdlib.Format.formatter -> instr -> unit
val print_graph : Stdlib.Format.formatter -> cfg -> Label.t -> Label.t -> unit
val print_deffun : Stdlib.Format.formatter -> deffun -> unit
val print_file : Stdlib.Format.formatter -> file -> unit