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

SCM Repository

[diderot] Diff of /trunk/src/compiler/IL/unused-elim-fn.sml
ViewVC logotype

Diff of /trunk/src/compiler/IL/unused-elim-fn.sml

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

revision 2355, Sun Apr 7 11:35:08 2013 UTC revision 2356, Sun Apr 7 14:45:25 2013 UTC
# Line 35  Line 35 
35                  in                  in
36                    phis := List.filter doVar (!phis)                    phis := List.filter doVar (!phis)
37                  end                  end
38              | IL.ASSIGN{stm=(y, rhs), ...} =>              | IL.ASSIGN{stm=(y, rhs), ...} => if (useCount y = 0)
39                  if (useCount y = 0)                  then (case rhs
40                    then (                     of IL.STATE _ => IL.CFG.deleteNode nd
41                      Stats.tick cntUnused;                      | IL.VAR x => (decUse x; IL.CFG.deleteNode nd)
42                      case rhs                      | IL.LIT _ => IL.CFG.deleteNode nd
43                       of IL.STATE _ => ()  (* FIXME: we should distinguish between mutation effects and allocation effects! *)
44                        | IL.VAR x => decUse x                      | IL.OP(rator, xs) => if IL.Op.isPure rator
45                        | IL.LIT _ => ()                          then (List.app decUse xs; IL.CFG.deleteNode nd)
46                        | IL.OP(_, xs) => List.app decUse xs                          else ()
47                        | IL.APPLY(_, xs) => List.app decUse xs                      | IL.APPLY(_, xs) => (List.app decUse xs; IL.CFG.deleteNode nd)
48                        | IL.CONS(_, xs) => List.app decUse xs                      | IL.CONS(_, xs) => (List.app decUse xs; IL.CFG.deleteNode nd)
49                      (* end case *);                    (* end case *))
                     IL.CFG.deleteNode nd)  
50                    else ()                    else ()
51              | IL.MASSIGN{stm=([], _, _), ...} => ()  (* executed for side effects *)              | IL.MASSIGN{stm=([], _, _), ...} => ()  (* executed for side effects *)
52              | IL.MASSIGN{stm=(ys, _, xs), ...} =>              | IL.MASSIGN{stm=(ys, rator, xs), ...} =>
53                  if List.all (fn y => (useCount y = 0)) ys  (* FIXME: we should distinguish between mutation effects and allocation effects! *)
54                    if IL.Op.isPure rator andalso List.all (fn y => (useCount y = 0)) ys
55                    then (                    then (
56                      Stats.tick cntUnused;                      Stats.tick cntUnused;
57                      List.app decUse xs;                      List.app decUse xs;

Legend:
Removed from v.2355  
changed lines
  Added in v.2356

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