source: Deliverables/D2.2/8051/src/LTL/LTL.mli @ 1542

Last change on this file since 1542 was 1542, checked in by tranquil, 8 years ago

merge of indexed labels branch

File size: 3.9 KB
Line 
1
2(** This module defines the abstract syntax tree of [LTL]. *)
3
4(** The main difference with ERTL is that only physical registers are present in
5    LTL (no more pseudo-registers). Pseudo-registers are associated either a
6    physical register or a location on the stack. This is done by a coloring
7    algorithm. Actually, this coloring algorithm relies on the result of a
8    liveness analysis that will also allow to remove dead code. *)
9
10type statement =
11
12  (* The empty statement. *)
13  | St_skip of Label.t
14
15  (* Comment. *)
16  | St_comment of string * Label.t
17
18  (* Emit a cost label. *)
19  | St_cost of CostLabel.t * Label.t
20
21  (* Reset to 0 a loop index *) 
22  | St_ind_0 of CostLabel.index * Label.t
23
24  (* Increment a loop index *)
25  | St_ind_inc of CostLabel.index * Label.t
26
27  (* Assign an integer constant to a register. Parameters are the destination
28     register, the integer and the label of the next statement. *)
29  | St_int of I8051.register * int * Label.t
30
31  (* Pop a value from the IRAM to the accumulator. Parameter is the label of the
32     next statement. *)
33  | St_pop of Label.t
34
35  (* Push a value from the accumulator to the IRAM. Parameter is the label of
36     the next statement. *)
37  | St_push of Label.t
38
39  (* Assign the address of a symbol to a DPTR. Parameters are the symbol, and
40     the label of the next statement. *)
41  | St_addr of AST.ident * Label.t
42
43  (* Move the content of the accumulator to a register. Parameters are the
44     destination register, and the label of the next statement. *)
45  | St_from_acc of I8051.register * Label.t
46
47  (* Move the content of a register to the accumulator. Parameters are the
48     source register, and the label of the next statement. *)
49  | St_to_acc of I8051.register * Label.t
50
51  (* Apply an operation on the accumulators. Parameters are the operation, and
52     the label of the next statement. *)
53  | St_opaccs of I8051.opaccs * Label.t
54
55  (* Apply an unary operation on the A accumulator. Parameters are the
56     operation, and the label of the next statement. *)
57  | St_op1 of I8051.op1 * Label.t
58
59  (* Apply a binary operation on the A accumulator. Parameters are the
60     operation, the other source register, and the label of the next
61     statement. *)
62  | St_op2 of I8051.op2 * I8051.register * Label.t
63
64  (* Set the carry flag to zero. Parameter is the label of the next
65     statement. *)
66  | St_clear_carry of Label.t
67
68  (* Set the carry flag to 1. Parameter is the label of the next statement. *)
69  | St_set_carry of Label.t
70
71  (* Load from external memory (address in DPTR) to the accumulator. Parameter
72     is the label of the next statement. *)
73  | St_load of Label.t
74
75  (* Store to external memory (address in DPTR) from the accumulator. Parameter
76     is the label of the next statement. *)
77  | St_store of Label.t
78
79  (* Call to a function given its name. Parameters are the name of the function,
80     and the label of the next statement. *)
81  | St_call_id of AST.ident * Label.t
82
83  (* Call to a function given its address in DPTR. Parameter is the label of the
84     next statement. *)
85  | St_call_ptr of Label.t
86
87  (* Branch on A accumulator. Parameters are the label to go to when the A
88     accumulator is not 0, and the label to go to when the A accumulator is
89     0. *)
90  | St_condacc of Label.t * Label.t
91
92  (* Transfer control to the address stored in the return address registers. *)
93  | St_return
94
95type graph = statement Label.Map.t
96
97type internal_function =
98    { f_luniverse : Label.Gen.universe ;
99      f_stacksize : int ;
100      f_graph     : graph ;
101      f_entry     : Label.t ;
102      f_exit      : Label.t }
103
104type function_def =
105  | F_int of internal_function
106  | F_ext of AST.external_function
107
108(* A program is a list of global variables and their reserved space, a list of
109   function names and their definition, and the name of the main function. *)
110
111type program =
112    { vars   : (AST.ident * int (* size *)) list ;
113      functs : (AST.ident * function_def) list ;
114      main   : AST.ident option }
Note: See TracBrowser for help on using the repository browser.