Changeset 2946 for src/ERTL


Ignore:
Timestamp:
Mar 24, 2013, 11:29:01 AM (8 years ago)
Author:
tranquil
Message:

main novelties:

  • there is an in-built stack_usage nat in joint states, at the base of the new division of RTL's semantics (with separate stacks, with separate stacks but with an artificial overflow error, with a unique stack)
  • a premain is added semantically to the global env, so initial cost label and main call and return are observed
  • proper initialization is now in LINToASM (to be sure, endianess should be checked ;-)

The update breaks proofs of back end atm. compiler.ma should be okay, but I have not had time to complete its compilation.

Location:
src/ERTL
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • src/ERTL/ERTL.ma

    r2783 r2946  
    6868definition ERTL ≝ mk_graph_params (mk_uns_params ERTL_uns ERTL_functs).
    6969definition ertl_program ≝ joint_program ERTL.
     70unification hint 0 ≔ ⊢ ertl_program ≡ joint_program ERTL.
    7071
    7172interpretation "move" 'mov r a = (MOVE ?? (mk_Prod move_dst move_src r a)).
     
    123124coercion ertl_seq_to_joint_seq : ∀globals.∀s : ertl_seq.joint_seq ERTL globals ≝ ertl_seq_joint
    124125  on _s : ertl_seq to joint_seq ERTL ?.
     126
     127definition ERTL_premain : ∀p : ertl_program.joint_closed_internal_function ERTL (prog_var_names ?? p) ≝
     128λp.
     129let l1 : label ≝ an_identifier … one in
     130let l2 : label ≝ an_identifier … (p0 one) in
     131let l3 : label ≝ an_identifier … (p1 one) in
     132let res ≝
     133  mk_joint_internal_function ERTL (prog_var_names … p)
     134  (mk_universe … (p0 (p0 one)))
     135  (mk_universe … one)
     136  it 4 0 0 (empty_map …) l1 in
     137(* todo: args for main? *)
     138let res ≝ add_graph … l1
     139  (sequential … (COST_LABEL … (init_cost_label … p)) l2)
     140  res in
     141let res ≝ add_graph … l2
     142  (sequential … (CALL ERTL ? (inl … (prog_main … p)) 4 it) l3)
     143  res in
     144let res ≝ add_graph … l3
     145  (GOTO ? l3)
     146  res in
     147res.
     148%
     149[ ** [2,3: * [2,3,5,6: #p ]] #s whd in ⊢ (??%?→?); #EQ destruct
     150  %
     151  [1,3,5: %{I} % whd in ⊢ (??%(??%)→?); #EQ destruct
     152  |2: %
     153  |4,6: % whd in ⊢ (??%%→?); #EQ destruct
     154  ]
     155| ** [2,3: * [2,3,5,6: #p ]] #s whd in ⊢ (??%?→?); #EQ destruct % try @I %{I I}
     156| ** [2,3: * [2,3,5,6: #p ]] * whd whd in ⊢ (?%%); //
     157| ** [2,3: * [2,3,5,6: #p ]] #s whd in ⊢ (??%%→?); #EQ destruct @I
     158| %{l2} %{(init_cost_label … p)} %
     159]
     160qed.
  • src/ERTL/ERTL_semantics.ma

    r2823 r2946  
    4040 (* empty_framesT ≝ *) [ ]
    4141 (* regsT ≝ *) ertl_reg_env
    42  (* empty_regsT ≝ *) (λsp.〈empty_map …,init_hw_register_env sp〉)
     42 (* empty_regsT ≝ *) (λsp.〈empty_map …, init_hw_register_env sp〉)
    4343 (*load_sp ≝ *) get_hwsp
    4444 (*save_sp ≝ *) set_hwsp.
     
    160160
    161161definition ERTL_semantics ≝
    162   mk_sem_graph_params ERTL ERTL_sem_uns.
     162  mk_sem_graph_params ERTL ERTL_sem_uns ERTL_premain.
  • src/ERTL/ERTLtoERTLptrUtils.ma

    r2891 r2946  
    162162definition dummy_state : state ERTL_semantics ≝
    163163mk_state ERTL_semantics
    164    (None ?) empty_is BBundef 〈empty_map ? ?,mk_hw_register_env … (Stub …) BBundef〉 empty.
     164   (None ?) empty_is BBundef 〈empty_map ? ?,mk_hw_register_env … (Stub …) BBundef〉 0 empty.
    165165
    166166definition sigma_state : ertl_program →
     
    173173  (carry … st)
    174174  (sigma_regs prog f_lbls restr (regs … st))
     175  (stack_usage … st)
    175176  (sigma_mem prog f_lbls (m … st)).
    176177   
     
    667668sigma_state prog f_lbls f_regs restr (set_sp ? ptr st).
    668669#prog #f_lbls #f_regs #restr #ptr #st whd in match set_sp; whd in match sigma_state;
    669 normalize nodelta @eq_f2 [2: %] whd in match (save_sp ???);
     670normalize nodelta @eq_f3 try % whd in match (save_sp ???);
    670671whd in match (save_sp ???); whd in match sigma_regs; normalize nodelta
    671672cases(regs ? st) #psd_env #hw_regs normalize nodelta @eq_f
     
    11551156    (added_registers ERTL (prog_var_names … prog) fn (f_regs bl))
    11561157      (mk_state ? (Some ? tl) (istack … st) (carry … st) (〈loc_mem,\snd (regs … st)〉)
    1157       (m … st))) in ⊢ (???????(??%)?); @pop_ra_ok |
     1158      (stack_usage … st) (m … st))) in ⊢ (???????(??%)?); @pop_ra_ok |
    11581159  | * #st1 #pc1 @if_elim normalize nodelta [2: #_ @res_preserve_error1]
    11591160   normalize nodelta @eq_block_elim [2: #_ *] #EQbl1 * @if_elim
     
    16781679              #t_frames #EQt_frames #_ @mfr_return_eq1 normalize nodelta @eq_f
    16791680              whd in match set_frms; normalize nodelta >m_return_bind
    1680               cut(∀ a1,a2,b1,b2,c1,c2,d1,d2,e1,e2.
    1681                     a1=a2 → b1 = b2 → c1 = c2 → d1 = d2 → e1 = e2 →
    1682                       mk_state ERTL_semantics a1 b1 c1 d1 e1 =
    1683                       mk_state ERTL_semantics a2 b2 c2 d2 e2)
     1681              cut(∀ a1,a2,b1,b2,c1,c2,d1,d2,e1,e2,f1,f2.
     1682                    a1=a2 → b1 = b2 → c1 = c2 → d1 = d2 → e1 = e2 → f1 = f2 →
     1683                      mk_state ERTL_semantics a1 b1 c1 d1 e1 f1 =
     1684                      mk_state ERTL_semantics a2 b2 c2 d2 e2 f2)
    16841685              [1,3: #H1 #H2 #H3 #H4 #H5 #H6 #H7 #H8 #H9 #H10 #H11 #H12 #H13 #H14
    1685                     #H15 //] #APP @APP try %
     1686                    #H15 #H16 #H17 #H18 //] #APP @APP try %
    16861687              [1,3: whd in match sigma_frames_opt; whd in match m_list_map;
    16871688                    normalize nodelta  whd in match (foldr ?????); normalize nodelta
     
    17101711]
    17111712qed.
    1712 
    1713 
Note: See TracChangeset for help on using the changeset viewer.