--- trunk/src/compiler/IL/census-fn.sml 2013/04/07 11:35:08 2355 +++ trunk/src/compiler/IL/census-fn.sml 2013/04/07 14:45:25 2356 @@ -21,7 +21,6 @@ fun inc (IL.V{useCnt, ...}) = (useCnt := !useCnt + 1) fun dec (IL.V{useCnt, ...}) = (useCnt := !useCnt - 1) - fun setBinding (IL.V{bind, ...}, vb) = bind := vb fun init (IL.Program{globalInit, initially, strands, ...}) = let fun clearVar (IL.V{useCnt, ...}) = useCnt := 0 @@ -54,28 +53,15 @@ * is used to count the live variables at exits, since the context affects the * treatment of these. *) -(* FIXME: setting the binding here is probably redundant, since the mk functions do it too! *) fun incNode exitCount (IL.ND{kind, ...}) = (case kind of IL.JOIN{phis, ...} => let - fun f (y, xs) = ( - setBinding (y, IL.VB_PHI xs); - incList xs) + fun f (y, xs) = incList xs in List.app f (!phis) end | IL.COND{cond, ...} => inc cond - | IL.ASSIGN{stm = (y, rhs), ...} => ( - setBinding (y, IL.VB_RHS rhs); - 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 + | IL.ASSIGN{stm = (y, rhs), ...} => IL.RHS.app inc rhs + | IL.MASSIGN{stm = (ys, rator, xs), ...} => List.app inc xs | IL.NEW{args, ...} => incList args | IL.SAVE{rhs, ...} => inc rhs | IL.EXIT{live, ...} => exitCount live @@ -83,9 +69,7 @@ (* end case *)) (* increment the counts of variables used in the initially code *) fun incInitially (IL.Initially{create, rangeInit, iters, ...}) = let - fun incIter (param, lo, hi) = ( - setBinding (param, IL.VB_PARAM); (* QUESTION: should there be a special kind for this? *) - inc lo; inc hi) + fun incIter (param, lo, hi) = (inc lo; inc hi) in IL.CFG.apply (incNode (fn live => incList live)) rangeInit; List.app incIter iters; @@ -97,7 +81,6 @@ fun incMethod (IL.Method{body, ...}) = IL.CFG.apply (incNode (fn live => incList live)) body in - List.app (fn x => setBinding(x, IL.VB_PARAM)) params; IL.CFG.apply (incNode (fn live => incList live)) stateInit; List.app incMethod methods end