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

SCM Repository

[diderot] Diff of /trunk/src/compiler/high-il/high-opt.sml
ViewVC logotype

Diff of /trunk/src/compiler/high-il/high-opt.sml

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

revision 510, Tue Feb 8 16:12:38 2011 UTC revision 511, Tue Feb 8 17:01:43 2011 UTC
# Line 19  Line 19 
19      structure ST = Stats      structure ST = Stats
20      structure F = FieldDef      structure F = FieldDef
21    
     structure Census = CensusFn (IL)  
   
22    (********** Counters for statistics **********)    (********** Counters for statistics **********)
23      val cntConstConvolve        = ST.newCounter "high-opt:const-convolve"      val cntConstConvolve        = ST.newCounter "high-opt:const-convolve"
24      val cntConstField           = ST.newCounter "high-opt:const-field"      val cntConstField           = ST.newCounter "high-opt:const-field"
# Line 137  Line 135 
135              loop (Stats.sum{from=firstCounter, to=lastCounter}, prog)              loop (Stats.sum{from=firstCounter, to=lastCounter}, prog)
136            end            end
137    
138      fun optimize (prog as IL.Program{globals, globalInit, actors}) = let      fun optimize (prog as IL.Program{globals, globalInit, strands}) = let
           val _ = Census.init prog  
139            fun doStmt stm = let            fun doStmt stm = let
140                  val nodes = IL.sortNodes stm                  val nodes = IL.sortNodes stm
141                  in                  in
# Line 153  Line 150 
150                    loopToFixPt simplify nodes;                    loopToFixPt simplify nodes;
151                    loopToFixPt reduce nodes                    loopToFixPt reduce nodes
152                  end                  end
153            fun doActor (IL.Actor{stateInit, methods, ...}) = let            fun doStrand (IL.Strand{stateInit, methods, ...}) = let
154                  val nodes = IL.sortNodes stateInit                  val nodes = IL.sortNodes stateInit
155                  in                  in
156                    loopToFixPt simplify nodes;                    loopToFixPt simplify nodes;
157                    loopToFixPt reduce nodes;                    loopToFixPt reduce nodes;
158                    List.app doMethod methods                    List.app doMethod methods
159                  end                  end
160            val _ = List.app doActor actors            val _ = List.app doStrand strands
161            in            in
162              IL.Program{              IL.Program{
163                  globals = globals,                  globals = globals,
164                  globalInit = globalInit,                  globalInit = globalInit,
165                  actors = actors                  strands = strands
166                }                }
167            end            end
168    

Legend:
Removed from v.510  
changed lines
  Added in v.511

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