Ignore:
Timestamp:
May 19, 2011, 4:03:04 PM (9 years ago)
Author:
ayache
Message:

32 and 16 bits operations support in D2.2/8051

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/clight/clightFold.ml

    r624 r818  
    7575  | _ -> assert false (* wrong arguments, do not use on these values *)
    7676
     77let expr_fill_exprs (Clight.Expr (ed, t)) exprs =
     78  let (sub_ctypes, _) = expr_descr_subs ed in
     79  let ed = expr_descr_fill_subs ed sub_ctypes exprs in
     80  Clight.Expr (ed, t)
     81
    7782let rec expr f_ctype f_expr f_expr_descr e =
    7883  let (sub_ctypes, sub_expr_descrs) = expr_subs e in
     
    8893  let sub_ctypes_res = List.map (ctype f_ctype) sub_ctypes in
    8994  f_expr_descr e sub_ctypes_res sub_exprs_res
     95
     96
     97let expr_subs2 e =
     98  let (_, expr_descrs) = expr_subs e in
     99  let l = List.map expr_descr_subs expr_descrs in
     100  List.flatten (List.map snd l)
     101
     102let rec expr2 f e = f e (List.map (expr2 f) (expr_subs2 e))
    90103
    91104
     
    108121  | Clight.Sswitch (e, lbl_stmts) -> ([e], labeled_statements_subs lbl_stmts)
    109122  | Clight.Slabel (_, stmt) | Clight.Scost (_, stmt) -> ([], [stmt])
     123
     124let statement_sub_exprs stmt = fst (statement_subs stmt)
    110125
    111126let rec labeled_statements_fill_subs lbl_stmts sub_statements =
     
    149164    List.map (statement f_ctype f_expr f_expr_descr f_statement) sub_stmts in
    150165  f_statement stmt sub_exprs_res sub_stmts_res
     166
     167let rec statement2 f_expr f_statement stmt =
     168  let (sub_exprs, sub_stmts) = statement_subs stmt in
     169  let sub_exprs_res = List.map (expr2 f_expr) sub_exprs in
     170  let sub_stmts_res = List.map (statement2 f_expr f_statement) sub_stmts in
     171  f_statement stmt sub_exprs_res sub_stmts_res
Note: See TracChangeset for help on using the changeset viewer.