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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/high-opt/normalize.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/high-opt/normalize.sml

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

revision 3516, Sat Dec 19 03:54:23 2015 UTC revision 3517, Sat Dec 19 04:39:21 2015 UTC
# Line 15  Line 15 
15      structure IR = HighIR      structure IR = HighIR
16      structure Op = HighOps      structure Op = HighOps
17      structure V = IR.Var      structure V = IR.Var
18        structure ST = Stats
19    
20      (********** Counters for statistics **********)
21        val cntUnused               = ST.newCounter "high-opt:unused"
22    
23      structure UnusedElim = UnusedElimFn (      structure UnusedElim = UnusedElimFn (
24          structure IR = IR          structure IR = IR
# Line 36  Line 40 
40   (* doNormalize : EIN->EIN   (* doNormalize : EIN->EIN
41    * Orders EIN, normalizes it, then cleans the summation    * Orders EIN, normalizes it, then cleans the summation
42    *)    *)
43      fun doNormalize (e, args) = let      fun doNormalize e = let
44            val ordered = Reorder.transform e            val ordered = Reorder.transform e
45            val e = NormalizeEin.transform(ordered, args)            val e = NormalizeEin.transform ordered
46            in            in
47              SummationEin.cleanSummation e              SummationEin.cleanSummation e
48            end            end
# Line 58  Line 62 
62                  val (c, subst) = App.app(orig, place, newE, newArgs, done)                  val (c, subst) = App.app(orig, place, newE, newArgs, done)
63                  in                  in
64                    if (c = 0)                    if (c = 0)
65                      then (1, subst, place + length newArgs, rtnArgs)                      then (true, subst, place + length newArgs, rtnArgs)
66                      else (                      else (
67                        use lhs; List.app use newArgs; decUse newEinApp;                        incUse lhs; List.app incUse newArgs; decUse newEinApp;
68                        (true, subst, place + length newArgs, rtnArgs))                        (true, subst, place + length newArgs, rtnArgs))
69                  end                  end
70            (* end case *))            (* end case *))
# Line 74  Line 78 
78      fun doRHS (lhs, IR.EINAPP(ein, args)) = let      fun doRHS (lhs, IR.EINAPP(ein, args)) = let
79            fun rewrite (false, _, _, [], _) = NONE            fun rewrite (false, _, _, [], _) = NONE
80              | rewrite (true, orig, _, [], args') =              | rewrite (true, orig, _, [], args') =
81                  SOME[(lhs, IR.EINAPP(doNormalize(orig, args'), args'))]                  SOME[(lhs, IR.EINAPP(doNormalize orig, args'))]
82              | rewrite (changed, orig, place, e::es, args') = (case isEin e              | rewrite (changed, orig, place, e::es, args') = (case isEin e
83                   of NONE => rewrite(changed, orig, place+1, es, args'@[e])                   of NONE => rewrite(changed, orig, place+1, es, args'@[e])
84                    | SOME(IR.EINAPP(newE, newA)) => let                    | SOME(IR.EINAPP(newE, newA)) => let

Legend:
Removed from v.3516  
changed lines
  Added in v.3517

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