source: src/ERTL/ERTL.ma @ 2783

Last change on this file since 2783 was 2783, checked in by piccolo, 8 years ago

modified joint_closed_internal_function definition (added condition on pseudo-registers)
added new record for parameters
modified state definition with option for framesT

File size: 4.1 KB
Line 
1include "joint/Joint.ma".
2
3inductive move_dst: Type[0] ≝
4  | PSD: register → move_dst
5  | HDW: Register → move_dst.
6
7definition move_src ≝ argument move_dst.
8
9definition move_src_from_dst : move_dst → move_src ≝ Reg move_dst.
10coercion move_dst_to_src : ∀r : move_dst.move_src ≝ move_src_from_dst on _r : move_dst to move_src.
11
12definition psd_argument_move_src : psd_argument → move_src ≝
13  λarg.match arg with
14  [ Imm b ⇒ Imm ? b
15  | Reg r ⇒ Reg ? (PSD r)
16  ].
17coercion psd_argument_to_move_src : ∀a:psd_argument.move_src ≝
18  psd_argument_move_src on _a : psd_argument to move_src.
19
20inductive ertl_seq : Type[0] ≝
21  | ertl_new_frame: ertl_seq
22  | ertl_del_frame: ertl_seq
23  | ertl_frame_size: register → ertl_seq.
24
25definition ERTL_uns ≝ mk_unserialized_params
26    (* acc_a_reg ≝ *) register
27    (* acc_b_reg ≝ *) register
28    (* acc_a_arg ≝ *) psd_argument
29    (* acc_b_arg ≝ *) psd_argument
30    (* dpl_reg   ≝ *) register
31    (* dph_reg   ≝ *) register
32    (* dpl_arg   ≝ *) psd_argument
33    (* dph_arg   ≝ *) psd_argument
34    (* snd_arg   ≝ *) psd_argument
35    (* pair_move ≝ *) (move_dst × move_src)
36    (* call_args ≝ *) ℕ
37    (* call_dest ≝ *) unit
38    (* ext_seq ≝ *) ertl_seq
39    (* ext_seq_labels ≝ *) (λ_.[])
40    (* has_tailcall ≝ *) false
41    (* paramsT ≝ *) ℕ.
42
43definition regs_from_move_dst : move_dst → list register ≝
44λm. match m with [PSD r ⇒ [r] | HDW _ ⇒ [ ] ].
45
46definition regs_from_move_src : move_src → list register ≝
47λm. match m with [Imm _ ⇒ [ ] | Reg r ⇒ match r with [PSD r1 ⇒ [r1] | HDW _ ⇒ [ ] ] ].
48
49definition ertl_ext_seq_regs : ertl_seq → list register ≝
50λs.match s with [ertl_frame_size r ⇒ [r] | _ ⇒ [ ]].
51
52definition ERTL_functs ≝ mk_get_pseudo_reg_functs ERTL_uns
53(* acc_a_regs *) (λr.[r])
54(* acc_b_regs *) (λr.[r])
55(* acc_a_args *) (λarg.match arg with [ Imm _ ⇒ [ ] | Reg r ⇒ [r]])
56(* acc_b_args *) (λarg.match arg with [ Imm _ ⇒ [ ] | Reg r ⇒ [r]])
57(* dpl_regs *) (λr.[r])
58(* dph_regs *) (λr.[r])
59(* dpl_args *) (λarg.match arg with [ Imm _ ⇒ [ ] | Reg r ⇒ [r]])
60(* dph_args *) (λarg.match arg with [ Imm _ ⇒ [ ] | Reg r ⇒ [r]])
61(* snd_args *) (λarg.match arg with [ Imm _ ⇒ [ ] | Reg r ⇒ [r]])
62(* pair_move_regs *) (λx.(regs_from_move_dst (\fst x)) @ (regs_from_move_src (\snd x)))
63(* f_call_args *) (λ_.[ ])
64(* f_call_dest *) (λ_.[ ])
65(* ext_seq_regs *) ertl_ext_seq_regs
66(* params_regs *) (λ_.[ ]).
67
68definition ERTL ≝ mk_graph_params (mk_uns_params ERTL_uns ERTL_functs).
69definition ertl_program ≝ joint_program ERTL.
70
71interpretation "move" 'mov r a = (MOVE ?? (mk_Prod move_dst move_src r a)).
72
73(* aid unification *)
74unification hint 0 ≔
75(*---------------*) ⊢
76pair_move ERTL ≡ move_dst × move_src.
77unification hint 0 ≔
78(*---------------*) ⊢
79acc_a_reg ERTL ≡ register.
80unification hint 0 ≔
81(*---------------*) ⊢
82acc_b_reg ERTL ≡ register.
83unification hint 0 ≔
84(*---------------*) ⊢
85acc_a_arg ERTL ≡ psd_argument.
86unification hint 0 ≔
87(*---------------*) ⊢
88acc_b_arg ERTL ≡ psd_argument.
89unification hint 0 ≔
90(*---------------*) ⊢
91dpl_reg ERTL ≡ register.
92unification hint 0 ≔
93(*---------------*) ⊢
94dph_reg ERTL ≡ register.
95unification hint 0 ≔
96(*---------------*) ⊢
97dpl_arg ERTL ≡ psd_argument.
98unification hint 0 ≔
99(*---------------*) ⊢
100dph_arg ERTL ≡ psd_argument.
101unification hint 0 ≔
102(*---------------*) ⊢
103snd_arg ERTL ≡ psd_argument.
104unification hint 0 ≔
105(*---------------*) ⊢
106call_args ERTL ≡ ℕ.
107unification hint 0 ≔
108(*---------------*) ⊢
109call_dest ERTL ≡ unit.
110
111unification hint 0 ≔
112(*---------------*) ⊢
113ext_seq ERTL ≡ ertl_seq.
114
115coercion reg_to_ertl_snd_argument : ∀r : register.snd_arg ERTL ≝
116  psd_argument_from_reg
117  on _r : register to snd_arg ERTL.
118coercion byte_to_ertl_snd_argument : ∀b : Byte.snd_arg ERTL ≝
119  psd_argument_from_byte
120  on _b : Byte to snd_arg ERTL.
121 
122definition ertl_seq_joint ≝ extension_seq ERTL.
123coercion ertl_seq_to_joint_seq : ∀globals.∀s : ertl_seq.joint_seq ERTL globals ≝ ertl_seq_joint
124  on _s : ertl_seq to joint_seq ERTL ?.
Note: See TracBrowser for help on using the repository browser.