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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/translate/analyze-simple.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/translate/analyze-simple.sml

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

revision 4166, Thu Jul 7 14:33:11 2016 UTC revision 4168, Thu Jul 7 16:48:41 2016 UTC
# Line 43  Line 43 
43        | InitMeth | UpdateMeth | StabilizeMeth        | InitMeth | UpdateMeth | StabilizeMeth
44        | Create | GlobalUpdate        | Create | GlobalUpdate
45    
46      (* for debugging *)
47        fun cxtToString cxt = (case cxt
48               of ConstInit => "ConstInit"
49                | UserFunc => "UserFunc"
50                | GlobalInit => "GlobalInit"
51                | StateInit => "StateInit"
52                | InitMeth => "InitMeth"
53                | UpdateMeth => "UpdateMeth"
54                | StabilizeMeth => "StabilizeMeth"
55                | Create => "Create"
56                | GlobalUpdate => "GlobalUpdate"
57              (* end case *))
58    
59      local      local
60        val {getFn, setFn, ...} = S.newProp (fn _ => VSet.empty)        val {getFn, setFn, ...} = S.newProp (fn _ => VSet.empty)
61      in      in
# Line 186  Line 199 
199  (* QUESTION: do we want to modify the properties of b? *)  (* QUESTION: do we want to modify the properties of b? *)
200                    (liveOut, assigns)                    (liveOut, assigns)
201                  end                  end
202              | doStm (S.S_IfThenElse(_, b1, b2), (liveIn, assignsIn)) = let              | doStm (S.S_IfThenElse(x, b1, b2), (liveIn, assignsIn)) = let
203                    val liveIn = addVar(x, liveIn)
204                  val (live1, assigns1) = doBlock (b1, liveIn)                  val (live1, assigns1) = doBlock (b1, liveIn)
205                  val (live2, assigns2) = doBlock (b2, liveIn)                  val (live2, assigns2) = doBlock (b2, liveIn)
206                  val assigns = VSet.union(assignsIn, VSet.union(assigns1, assigns2))                  val assigns = VSet.union(assignsIn, VSet.union(assigns1, assigns2))
# Line 201  Line 215 
215              | doStm (_, acc) = acc              | doStm (_, acc) = acc
216            val (bnd, assigns) = doBlock (blk, VSet.empty)            val (bnd, assigns) = doBlock (blk, VSet.empty)
217            in            in
 print(concat[  
 "globals = {", String.concatWithMap "," SV.uniqueNameOf (VSet.listItems (!globals)), "}\n"]);  
218              setGlobalsOfBlock (blk, !globals)              setGlobalsOfBlock (blk, !globals)
219            end            end
220    
# Line 210  Line 222 
222            val S.Strand{stateInit, initM, updateM, stabilizeM, ...} = strand            val S.Strand{stateInit, initM, updateM, stabilizeM, ...} = strand
223            in            in
224              analyzeBlock ConstInit constInit;              analyzeBlock ConstInit constInit;
225  print "## functions\n";              List.app (fn (S.Func{f, body, ...}) => analyzeBlock UserFunc body) funcs;
             List.app (fn (S.Func{body, ...}) => analyzeBlock UserFunc body) funcs;  
 print "## global init\n";  
226              analyzeBlock GlobalInit globInit;              analyzeBlock GlobalInit globInit;
 print "## state init\n";  
227              analyzeBlock StateInit stateInit;              analyzeBlock StateInit stateInit;
228              Option.app (analyzeBlock InitMeth) initM;              Option.app (analyzeBlock InitMeth) initM;
229              analyzeBlock UpdateMeth updateM;              analyzeBlock UpdateMeth updateM;

Legend:
Removed from v.4166  
changed lines
  Added in v.4168

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