Ignore:
Timestamp:
Nov 23, 2011, 1:55:12 PM (9 years ago)
Author:
tranquil
Message:

branch up to date

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051-indexed-labels-branch/src/RTLabs/RTLabsPrinter.ml

    r1477 r1539  
    9696
    9797let print_arg = function
    98         | RTLabs.Reg r -> print_reg r
    99         | RTLabs.Imm (c, t) ->
    100                 Printf.sprintf "(%s)%s" (Primitive.print_type t) (print_cst c)
     98  | RTLabs.Reg r -> print_reg r
     99  | RTLabs.Imm (c, t) ->
     100    Printf.sprintf "(%s)%s" (Primitive.print_type t) (print_cst c)
    101101
    102102let print_op2 op r s = Printf.sprintf "%s %s %s"
     
    122122  | AST.Op_cmpp cmp -> (print_cmp cmp) ^ "p"
    123123  | AST.Op_cmpu cmp -> (print_cmp cmp) ^ "u")
    124         (print_arg s)
     124  (print_arg s)
    125125
    126126
     
    169169  | RTLabs.St_load (q, addr, destr, lbl) ->
    170170      Printf.sprintf "%s := *(%s) %s --> %s"
    171   (print_reg destr)
     171        (print_reg destr)
    172172        (Memory.string_of_quantity q)
    173173        (print_arg addr)
     
    175175  | RTLabs.St_store (q, addr, srcr, lbl) ->
    176176      Printf.sprintf "*(%s)%s := %s --> %s"
    177   (Memory.string_of_quantity q)
     177        (Memory.string_of_quantity q)
    178178        (print_arg addr)
    179179        (print_arg srcr)
     
    181181  | RTLabs.St_call_id (f, args, Some r, sg, lbl) ->
    182182      Printf.sprintf "%s := \"%s\"(%s) : %s --> %s"
    183   (print_reg r)
    184   f
     183        (print_reg r)
     184        f
    185185        (print_args args)
    186186        (Primitive.print_sig sg)
    187187        lbl
    188188  | RTLabs.St_call_id (f, args, None, sg, lbl) ->
    189     Printf.sprintf "\"%s\"(%s) : %s --> %s"
    190     f
    191     (print_args args)
    192     (Primitive.print_sig sg)
    193     lbl
     189      Printf.sprintf "\"%s\"(%s) : %s --> %s"
     190        f
     191        (print_args args)
     192        (Primitive.print_sig sg)
     193        lbl
    194194  | RTLabs.St_call_ptr (f, args, Some r, sg, lbl) ->
    195195      Printf.sprintf "%s := *%s (%s) : %s --> %s"
    196   (print_reg r)
    197     (print_reg f)
    198     (print_args args)
    199     (Primitive.print_sig sg)
    200     lbl
     196        (print_reg r)
     197        (print_reg f)
     198        (print_args args)
     199        (Primitive.print_sig sg)
     200        lbl
    201201  | RTLabs.St_call_ptr (f, args, None, sg, lbl) ->
    202     Printf.sprintf "*%s (%s) : %s --> %s"
    203     (print_reg f)
    204     (print_args args)
    205     (Primitive.print_sig sg)
    206     lbl
     202      Printf.sprintf "*%s (%s) : %s --> %s"
     203        (print_reg f)
     204        (print_args args)
     205        (Primitive.print_sig sg)
     206        lbl
    207207  | RTLabs.St_tailcall_id (f, args, sg) ->
    208208      Printf.sprintf "tailcall \"%s\" (%s) : %s"
     
    256256      (print_statement stmt)
    257257      s in
    258         let f' lbl stmt (reach, s) =
     258  let f' lbl stmt (reach, s) =
    259259    (Label.Set.add lbl reach, f lbl stmt s) in
    260         let (reachable, str) =
    261                 RTLabsUtilities.dfs_fold f' c entry (Label.Set.empty, "") in
    262         let filter lbl _ = not (Label.Set.mem lbl reachable) in
    263         let c_rest = Label.Map.filter filter c in
    264         if Label.Map.is_empty c_rest then str else
    265         let str' = Label.Map.fold f c_rest "" in
    266         str ^ "DEAD NODES:\n" ^ str'
     260  let (reachable, str) =
     261    RTLabsUtilities.dfs_fold f' c entry (Label.Set.empty, "") in
     262  let filter lbl _ = not (Label.Set.mem lbl reachable) in
     263  let c_rest = Label.Map.filter filter c in
     264  if Label.Map.is_empty c_rest then str else
     265    let str' = Label.Map.fold f c_rest "" in
     266    str ^ "DEAD NODES:\n" ^ str'
    267267       
    268268let print_internal_decl n f def =
Note: See TracChangeset for help on using the changeset viewer.