source: Deliverables/D2.2/8051/src/LIN/LIN.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: 2.6 KB
Line 
1
2(** This module defines the abstract syntax tree of [LIN]. *)
3
4(** Compared to LTL where functions were graphs, the functions of a LIN program
5    are sequential instructions. *)
6
7type statement =
8
9  (* Unconditional branch. *)
10  | St_goto of Label.t
11
12  (* Label a statement. *)
13  | St_label of Label.t
14
15  (* Comment. *)
16  | St_comment of string
17
18  (* Emit a cost label. *)
19  | St_cost of CostLabel.t
20
21  (* Reset to 0 a loop index *) 
22  | St_ind_0 of CostLabel.index
23
24  (* Increment a loop index *)
25  | St_ind_inc of CostLabel.index
26
27  (* Assign an integer constant to a register. Parameters are the destination
28     register, and the integer. *)
29  | St_int of I8051.register * int
30
31  (* Pop a value from the IRAM to the accumulator. *)
32  | St_pop
33
34  (* Push a value from the accumulator to the IRAM. *)
35  | St_push
36
37  (* Assign the address of a symbol to DPTR. Parameter is the symbol. *)
38  | St_addr of AST.ident
39
40  (* Move the content of the accumulator to a register. Parameters is the
41     destination register. *)
42  | St_from_acc of I8051.register
43
44  (* Move the content of a register to the accumulator. Parameters is the source
45     register. *)
46  | St_to_acc of I8051.register
47
48  (* Apply an operation on the accumulators. Parameter is the operation. *)
49  | St_opaccs of I8051.opaccs
50
51  (* Apply an unary operation on the A accumulator. Parameter is the
52     operation. *)
53  | St_op1 of I8051.op1
54
55  (* Apply a binary operation on the A accumulator. Parameters are the
56     operation, and the other source register. *)
57  | St_op2 of I8051.op2 * I8051.register
58
59  (* Set the carry flag to zero. *)
60  | St_clear_carry
61
62  (* Set the carry flag to 1. *)
63  | St_set_carry
64
65  (* Load from external memory (address in DPTR) to the accumulator. *)
66  | St_load
67
68  (* Store to external memory (address in DPTR) from the accumulator. *)
69  | St_store
70
71  (* Call to a function given its name. Parameter is the name of the
72     function. *)
73  | St_call_id of AST.ident
74
75  (* Call to a function given its address in DPTR. *)
76  | St_call_ptr
77
78  (* Branch on A accumulator. Parameter is the label to go to when the A
79     accumulator is not 0. *)
80  | St_condacc of Label.t
81
82  (* Transfer control to the address stored in the return address registers. *)
83  | St_return
84
85type internal_function = statement list
86
87type function_def =
88  | F_int of internal_function
89  | F_ext of AST.external_function
90
91(* A program is a list of global variables and their reserved space, a list of
92   function names and their definition, and the name of the main function. *)
93
94type program =
95    { vars   : (AST.ident * int (* size *)) list ;
96      functs : (AST.ident * function_def) list ;
97      main   : AST.ident option }
Note: See TracBrowser for help on using the repository browser.