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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/IL/census-fn.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/IL/census-fn.sml

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

revision 1813, Sun Apr 8 15:44:10 2012 UTC revision 1814, Sun Apr 8 15:44:36 2012 UTC
# Line 21  Line 21 
21    
22      fun inc (IL.V{useCnt, ...}) = (useCnt := !useCnt + 1)      fun inc (IL.V{useCnt, ...}) = (useCnt := !useCnt + 1)
23      fun dec (IL.V{useCnt, ...}) = (useCnt := !useCnt - 1)      fun dec (IL.V{useCnt, ...}) = (useCnt := !useCnt - 1)
     fun setBinding (IL.V{bind, ...}, vb) = bind := vb  
24    
25      fun init (IL.Program{globalInit, initially, strands, ...}) = let      fun init (IL.Program{globalInit, initially, strands, ...}) = let
26            fun clearVar (IL.V{useCnt, ...}) = useCnt := 0            fun clearVar (IL.V{useCnt, ...}) = useCnt := 0
# Line 57  Line 56 
56  (* FIXME: setting the binding here is probably redundant, since the mk functions do it too! *)  (* FIXME: setting the binding here is probably redundant, since the mk functions do it too! *)
57            fun incNode exitCount (IL.ND{kind, ...}) = (case kind            fun incNode exitCount (IL.ND{kind, ...}) = (case kind
58                   of IL.JOIN{phis, ...} => let                   of IL.JOIN{phis, ...} => let
59                        fun f (y, xs) = (                        fun f (y, xs) = incList xs
                             setBinding (y, IL.VB_PHI xs);  
                             incList xs)  
60                        in                        in
61                          List.app f (!phis)                          List.app f (!phis)
62                        end                        end
63                    | IL.COND{cond, ...} => inc cond                    | IL.COND{cond, ...} => inc cond
64                    | IL.ASSIGN{stm = (y, rhs), ...} => (                    | IL.ASSIGN{stm = (y, rhs), ...} => IL.RHS.app inc rhs
65                        setBinding (y, IL.VB_RHS rhs);                    | IL.MASSIGN{stm = (ys, rator, xs), ...} => List.app inc xs
                       IL.RHS.app inc rhs)  
                   | IL.MASSIGN{stm = (ys, rator, xs), ...} => let  
                       fun setB (_, []) = ()  
                         | setB (i, x::xs) = (  
                             setBinding (x, IL.VB_MULTIOP(i, rator, xs));  
                             setB (i+1, xs))  
                       in  
                         setB (0, ys);  
                         List.app inc xs  
                       end  
66                    | IL.NEW{args, ...} => incList args                    | IL.NEW{args, ...} => incList args
67                    | IL.SAVE{rhs, ...} => inc rhs                    | IL.SAVE{rhs, ...} => inc rhs
68                    | IL.EXIT{live, ...} => exitCount live                    | IL.EXIT{live, ...} => exitCount live
# Line 83  Line 70 
70                  (* end case *))                  (* end case *))
71          (* increment the counts of variables used in the initially code *)          (* increment the counts of variables used in the initially code *)
72            fun incInitially (IL.Initially{create, rangeInit, iters, ...}) = let            fun incInitially (IL.Initially{create, rangeInit, iters, ...}) = let
73                  fun incIter (param, lo, hi) = (                  fun incIter (param, lo, hi) = (inc lo; inc hi)
                       setBinding (param, IL.VB_PARAM);  (* QUESTION: should there be a special kind for this? *)  
                       inc lo; inc hi)  
74                  in                  in
75                    IL.CFG.apply (incNode (fn live => incList live)) rangeInit;                    IL.CFG.apply (incNode (fn live => incList live)) rangeInit;
76                    List.app incIter iters;                    List.app incIter iters;
# Line 97  Line 82 
82                  fun incMethod (IL.Method{body, ...}) =                  fun incMethod (IL.Method{body, ...}) =
83                        IL.CFG.apply (incNode (fn live => incList live)) body                        IL.CFG.apply (incNode (fn live => incList live)) body
84                  in                  in
                   List.app (fn x => setBinding(x, IL.VB_PARAM)) params;  
85                    IL.CFG.apply (incNode (fn live => incList live)) stateInit;                    IL.CFG.apply (incNode (fn live => incList live)) stateInit;
86                    List.app incMethod methods                    List.app incMethod methods
87                  end                  end

Legend:
Removed from v.1813  
changed lines
  Added in v.1814

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