Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/cfg-ir/census-fn.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/cfg-ir/census-fn.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3472, Tue Dec 1 18:45:25 2015 UTC revision 3473, Wed Dec 2 17:57:53 2015 UTC
# Line 29  Line 29 
29          (* clear the counts of the variables defined in a node *)          (* clear the counts of the variables defined in a node *)
30            fun clearNode (IL.ND{kind, ...}) = (case kind            fun clearNode (IL.ND{kind, ...}) = (case kind
31                   of IL.JOIN{phis, ...} => List.app (fn (x, _) => clearVar x) (!phis)                   of IL.JOIN{phis, ...} => List.app (fn (x, _) => clearVar x) (!phis)
32                      | IL.FOREACH{var, phis, ...} => (
33                          clearVar var;
34                          List.app (fn (x, _) => clearVar x) (!phis))
35                    | IL.ASSIGN{stm=(x, _), ...} => clearVar x                    | IL.ASSIGN{stm=(x, _), ...} => clearVar x
36                    | IL.MASSIGN{stm=(xs, _, _), ...} => List.app clearVar xs                    | IL.MASSIGN{stm=(xs, _, _), ...} => List.app clearVar xs
37                    | _ => ()                    | _ => ()
# Line 51  Line 54 
54                  end                  end
55          (* increment the use counts of a list of variables *)          (* increment the use counts of a list of variables *)
56            val incList = List.app inc            val incList = List.app inc
57            (* increment the RHS variables of a phi *)
58              fun incPhi (_, ys) = List.app (Option.app inc) ys
59          (* increment the counts of the variables used in a node.  The exitCount function          (* increment the counts of the variables used in a node.  The exitCount function
60           * is used to count the live variables at exits, since the context affects the           * is used to count the live variables at exits, since the context affects the
61           * treatment of these.           * treatment of these.
62           *)           *)
63            fun incNode exitCount (IL.ND{kind, ...}) = (case kind            fun incNode exitCount (IL.ND{kind, ...}) = (case kind
64                   of IL.JOIN{phis, ...} => let                   of IL.JOIN{phis, ...} => List.app incPhi (!phis)
                       fun f (y, xs) = List.app (fn NONE => () | SOME x => inc x) xs  
                       in  
                         List.app f (!phis)  
                       end  
65                    | IL.COND{cond, ...} => inc cond                    | IL.COND{cond, ...} => inc cond
66                      | IL.FOREACH{src, phis, ...} => (
67                          inc src;
68                          List.app incPhi (!phis))
69                    | IL.ASSIGN{stm = (y, IL.GLOBAL gv), ...} => ()                    | IL.ASSIGN{stm = (y, IL.GLOBAL gv), ...} => ()
70                    | IL.ASSIGN{stm = (y, rhs), ...} => IL.RHS.app inc rhs                    | IL.ASSIGN{stm = (y, rhs), ...} => IL.RHS.app inc rhs
71                    | IL.MASSIGN{stm = (ys, rator, xs), ...} => List.app inc xs                    | IL.MASSIGN{stm = (ys, rator, xs), ...} => List.app inc xs

Legend:
Removed from v.3472  
changed lines
  Added in v.3473

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0