Module Ltltree

module Ltltree: sig .. end

Location Transfer Language (LTL)


type ident = string 

uniquement pour les fonctions

type register = Register.t 
type label = Label.t 
type operand = 
| Reg of Register.t
| Spilled of int

une opérande est un registre physique (Reg) ou un emplacement de pile (Spilled)

type instr = 
| Eload of register * int * register * label
| Estore of register * register * int * label
| Egoto of label
| Ereturn (*

les mêmes que dans ERTL, mais avec operand à la place de register

*)
| Econst of int32 * operand * label
| Emunop of Ops.munop * operand * label
| Embinop of Ops.mbinop * operand * operand * label
| Emubranch of Ops.mubranch * operand * label * label
| Embbranch of Ops.mbbranch * operand * operand * label
* label
| Epush of operand * label (*

légèrement modifiée

*)
| Ecall of ident * label (*

nouveau

*)
| Epop of register * label

Les différentes instructions LTL

type cfg = instr Label.map 

Un graphe de flot de contrôle est un dictionnaire associant à des étiquettes des instructions LTL.

type deffun = {
   fun_name : ident;
   fun_entry : label;
   fun_body : cfg;
}

une fonction LTL

type file = {
   funs : deffun list;
}

un programme LTL

Utilitaires

val succ : instr -> label list

Fonctions d'impression, pour debugger

val print_operand : Stdlib.Format.formatter -> operand -> unit
val print_instr : Stdlib.Format.formatter -> instr -> unit
val print_graph : Stdlib.Format.formatter -> cfg -> label -> unit
val print_deffun : Stdlib.Format.formatter -> deffun -> unit
val print_file : Stdlib.Format.formatter -> file -> unit