source: src/RTLabs/syntax.ma @ 888

Last change on this file since 888 was 888, checked in by campbell, 9 years ago

Use simplified conditionals in RTLabs, following the prototype.

File size: 2.2 KB
Line 
1
2include "basics/logic.ma".
3
4include "common/AST.ma".
5include "common/CostLabel.ma".
6include "common/FrontEndOps.ma".
7include "common/Registers.ma".
8
9include "ASM/Vector.ma".
10include "common/Graphs.ma".
11
12(* Statements, including the label of successor(s). *)
13
14inductive statement : Type[0] ≝
15| St_skip : label → statement
16| St_cost : costlabel → label → statement
17| St_const : register → constant → label → statement
18| St_op1 : unary_operation → register → register → label → statement
19| St_op2 : binary_operation → register → register → register → label → statement
20| St_load : memory_chunk → register → register → label → statement
21| St_store : memory_chunk → register → register → label → statement
22| St_call_id : ident → list register → option register → label → statement
23| St_call_ptr : register → list register → option register → label → statement
24| St_tailcall_id : ident → list register → statement
25| St_tailcall_ptr : register → list register → statement
26| St_cond : register → label → label → statement
27| St_jumptable : register → list label → statement
28| St_return : statement
29.
30
31record internal_function : Type[0] ≝
32{ f_labgen    : universe LabelTag
33; f_reggen    : universe RegisterTag
34; f_result    : option (register × typ)
35; f_params    : list (register × typ)
36; f_locals    : list (register × typ)
37; f_stacksize : nat
38; f_graph     : graph statement
39; f_entry     : label
40; f_exit      : label
41}.
42
43(* Note that the global variables will be initialised by the code in main
44   by this stage.  All initialisation data should only reserve space. *)
45
46definition RTLabs_program ≝ program (fundef internal_function) unit.
47
48(* TO CONSIDER:
49
50   - removing most successor labels from the statements (bit icky, what about
51     return and jump tables?)
52   - seems like load and store ought to have types that control the size of the
53     register list based on the addressing mode; similarly, memory_chunk and
54     register are probably related.
55   - label and register generation really tell us something about the sets of
56     labels and register that may appear, perhaps it should be renamed, or the
57     graph made dependent on them to make it obvious, etc.
58 *)
Note: See TracBrowser for help on using the repository browser.