Ignore:
Timestamp:
Nov 28, 2011, 3:13:14 PM (8 years ago)
Author:
tranquil
Message:
  • corrected previous bug
  • finished propagating immediates
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/ERTL/ERTLPrinter.ml

    r1568 r1572  
    2323    first (MiscPottier.string_of_list sep f rl) last
    2424
     25let print_arg = function
     26  | RTL.Imm i -> string_of_int i
     27  | RTL.Reg r -> Register.print r
     28
    2529let print_ptr rl = print_reg_list "[" "]" " ; " Register.print rl
    2630
    2731let print_args rl = print_reg_list "(" ")" ", " Register.print rl
    2832
    29 let print_return rl = print_reg_list "[" "]" " ; " Register.print rl
     33let print_return rl = print_reg_list "[" "]" " ; " print_arg rl
    3034
    3135let print_params rl = print_reg_list "(" ")" ", " Register.print rl
     
    3640
    3741let print_result rl = print_reg_list "[" "]" " ; " Register.print rl
    38 
    39 let print_arg = function
    40   | RTL.Imm i -> string_of_int i
    41   | RTL.Reg r -> Register.print r
    4242
    4343let print_statement = function
     
    7070    Printf.sprintf "pop %s --> %s" (Register.print r) lbl
    7171  | ERTL.St_push (r, lbl) ->
    72     Printf.sprintf "push %s --> %s" (Register.print r) lbl
     72    Printf.sprintf "push %s --> %s" (print_arg r) lbl
    7373  | ERTL.St_addrH (dstr, id, lbl) ->
    7474    Printf.sprintf "addrH %s, %s --> %s" (Register.print dstr) id lbl
     
    8484      (I8051.print_opaccs opaccs)
    8585      (Register.print dstr)
    86       (Register.print srcr1)
    87       (Register.print srcr2)
     86      (print_arg srcr1)
     87      (print_arg srcr2)
    8888      lbl
    8989  | ERTL.St_opaccsB (opaccs, dstr, srcr1, srcr2, lbl) ->
     
    9191      (I8051.print_opaccs opaccs)
    9292      (Register.print dstr)
    93       (Register.print srcr1)
    94       (Register.print srcr2)
     93      (print_arg srcr1)
     94      (print_arg srcr2)
    9595      lbl
    9696  | ERTL.St_op1 (op1, dstr, srcr, lbl) ->
     
    104104      (I8051.print_op2 op2)
    105105      (Register.print dstr)
    106       (Register.print srcr1)
     106      (print_arg srcr1)
    107107      (print_arg srcr2)
    108108      lbl
     
    114114    Printf.sprintf "load %s, (%s, %s) --> %s"
    115115      (Register.print dstr)
    116       (Register.print addr1)
    117       (Register.print addr2)
     116      (print_arg addr1)
     117      (print_arg addr2)
    118118      lbl
    119119  | ERTL.St_store (addr1, addr2, srcr, lbl) ->
    120120    Printf.sprintf "store (%s, %s), %s --> %s"
    121       (Register.print addr1)
    122       (Register.print addr2)
    123       (Register.print srcr)
     121      (print_arg addr1)
     122      (print_arg addr2)
     123      (print_arg srcr)
    124124      lbl
    125125  | ERTL.St_call_id (f, nb_args, lbl) ->
     
    148148
    149149
    150 let print_graph n c =
     150let print_graph n c entry =
    151151  let f lbl stmt s =
    152152    Printf.sprintf "%s%s: %s\n%s"
     
    155155      (print_statement stmt)
    156156      s in
    157   Label.Map.fold f c ""
     157  ERTLUtilities.dfs_fold f c entry ""
     158  (* Label.Map.fold f c "" *)
    158159
    159160
     
    173174    (n_spaces (n+2))
    174175    def.ERTL.f_exit
    175     (print_graph (n+2) def.ERTL.f_graph)
     176    (print_graph (n+2) def.ERTL.f_graph def.ERTL.f_entry)
    176177
    177178
Note: See TracChangeset for help on using the changeset viewer.