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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/tree-il/var-analysis.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/tree-il/var-analysis.sml

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

revision 2058, Tue Oct 30 10:38:25 2012 UTC revision 2059, Tue Oct 30 17:46:04 2012 UTC
# Line 43  Line 43 
43    (* nesting depths of scopes *)    (* nesting depths of scopes *)
44      val undefinedScope = 0      val undefinedScope = 0
45      val globalScope = 1         (* global initialization *)      val globalScope = 1         (* global initialization *)
46      val initiallyScope = 2      (* initial strand creation *)      val inputScope = 2          (* global inputs *)
47      val paramScope = 2          (* strand parameter *)      val initiallyScope = 3      (* initial strand creation *)
48      val strandScope = 3         (* strand initialization *)      val paramScope = 3          (* strand parameter *)
49      val methodScope = 4         (* defined/used in a strand method *)      val strandScope = 4         (* strand initialization *)
50      val methodStateScope = 5    (* state variable in a strand method *)      val methodScope = 5         (* defined/used in a strand method *)
51        val methodStateScope = 6    (* state variable in a strand method *)
52    
53    (* property that maps variables to the depth where they are bound *)    (* property that maps variables to the depth where they are bound *)
54      val {getFn=getBindDepth : IL.var -> int, setFn=setBindDepth, clrFn=clrBindDepth, ...} =      val {getFn=getBindDepth : IL.var -> int, setFn=setBindDepth, clrFn=clrBindDepth, ...} =
# Line 80  Line 81 
81                        List.app (setMaxUse depth) (IL.Node.uses nd);                        List.app (setMaxUse depth) (IL.Node.uses nd);
82                        List.app (fn x => setBindDepth(x, depth)) (IL.Node.defs nd))                        List.app (fn x => setBindDepth(x, depth)) (IL.Node.defs nd))
83                  (* end case *))                  (* end case *))
84              fun doGlobalInitNode nd = (case IL.Node.kind nd
85                     of IL.ASSIGN{stm=(x, IL.OP(LowOps.Input _, _)), ...} => setMaxUse inputScope x
86                      | _ => doNode globalScope nd
87                    (* end case *))
88            fun doCFG (depth, cfg) = IL.CFG.apply (doNode depth) cfg            fun doCFG (depth, cfg) = IL.CFG.apply (doNode depth) cfg
89            fun assignDepthsForMethod state (IL.Method{body, ...}) = let            fun assignDepthsForMethod state (IL.Method{body, ...}) = let
90                (* check to see which state variables are invariant *)                (* check to see which state variables are invariant *)
# Line 122  Line 127 
127                (* examine the methods *)                (* examine the methods *)
128                  List.app (assignDepthsForMethod state) methods)                  List.app (assignDepthsForMethod state) methods)
129            in            in
130              doCFG (globalScope, globalInit);              IL.CFG.apply doGlobalInitNode globalInit;
131            (* do initially code *)            (* do initially code *)
132              doCFG (initiallyScope, rangeInit);              doCFG (initiallyScope, rangeInit);
133              List.app              List.app

Legend:
Removed from v.2058  
changed lines
  Added in v.2059

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