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

Last change on this file since 486 was 486, checked in by ayache, 8 years ago

Deliverable D2.2

File size: 3.5 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  (* Assign an integer constant to a register. Parameters are the destination
22     register, the integer and the label of the next statement. *)
23  | St_int of I8051.register * int * Label.t
24
25  (* Pop a value from the IRAM to the accumulator. Parameter is the label of the
26     next statement. *)
27  | St_pop of Label.t
28
29  (* Push a value from the accumulator to the IRAM. Parameter is the label of
30     the next statement. *)
31  | St_push of Label.t
32
33  (* Assign the address of a symbol to a DPTR. Parameters are the symbol, and
34     the label of the next statement. *)
35  | St_addr of AST.ident * Label.t
36
37  (* Move the content of the accumulator to a register. Parameters are the
38     destination register, and the label of the next statement. *)
39  | St_from_acc of I8051.register * Label.t
40
41  (* Move the content of a register to the accumulator. Parameters are the
42     source register, and the label of the next statement. *)
43  | St_to_acc of I8051.register * Label.t
44
45  (* Apply an operation on the accumulators. Parameters are the operation, and
46     the label of the next statement. *)
47  | St_opaccs of I8051.opaccs * Label.t
48
49  (* Apply an unary operation on the A accumulator. Parameters are the
50     operation, and the label of the next statement. *)
51  | St_op1 of I8051.op1 * Label.t
52
53  (* Apply a binary operation on the A accumulator. Parameters are the
54     operation, the other source register, and the label of the next
55     statement. *)
56  | St_op2 of I8051.op2 * I8051.register * Label.t
57
58  (* Set the carry flag to zero. Parameter is the label of the next
59     statement. *)
60  | St_clear_carry of Label.t
61
62  (* Load from external memory (address in DPTR) to the accumulator. Parameter
63     is the label of the next statement. *)
64  | St_load of Label.t
65
66  (* Store to external memory (address in DPTR) from the accumulator. Parameter
67     is the label of the next statement. *)
68  | St_store of Label.t
69
70  (* Call to a function given its name. Parameters are the name of the function,
71     and the label of the next statement. *)
72  | St_call_id of AST.ident * Label.t
73
74  (* Branch on A accumulator. Parameters are the label to go to when the A
75     accumulator is not 0, and the label to go to when the A accumulator is
76     0. *)
77  | St_condacc of Label.t * Label.t
78
79  (* Transfer control to the address stored in the return address registers. *)
80  | St_return
81
82type graph = statement Label.Map.t
83
84type internal_function =
85    { f_luniverse : Label.Gen.universe ;
86      f_stacksize : int ;
87      f_graph     : graph ;
88      f_entry     : Label.t ;
89      f_exit      : Label.t }
90
91type function_def =
92  | F_int of internal_function
93  | F_ext of AST.external_function
94
95(* A program is a list of global variables and their reserved space, a list of
96   function names and their definition, and the name of the main function. *)
97
98type program =
99    { vars   : (AST.ident * int (* size *)) list ;
100      functs : (AST.ident * function_def) list ;
101      main   : AST.ident option }
Note: See TracBrowser for help on using the repository browser.