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

SCM Repository

[diderot] Annotation of /branches/pure-cfg/src/compiler/codegen/classify-state.sml
ViewVC logotype

Annotation of /branches/pure-cfg/src/compiler/codegen/classify-state.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (view) (download)

1 : jhr 651 (* classify-state.sml
2 :     *
3 :     * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *
6 :     * Classify strand state variables into three categories:
7 :     *
8 :     * UNIFORM -- these have the same value for all strands
9 :     * INVARIANT -- does not change over the life of the strand
10 :     * VARYING -- varies from step to step
11 :     *
12 :     * UNIFORM variables can be lifted into the global name space, while INVARIANT variables
13 :     * can be lifted into the non-varying state.
14 :     *)
15 :    
16 :     structure ClassifyState : sig
17 :    
18 :     datatype state_var_class = UNIFORM | INVARIANT | VARYING
19 :    
20 :     (* get the classification of a state variable *)
21 :     val varClass : LowIL.var -> state_var_class
22 :    
23 :     end = struct
24 :    
25 :     structure IL = LowIL
26 :     structure V = IL.Var
27 :    
28 :     datatype state_var_class = UNIFORM | INVARIANT | VARYING
29 :    
30 :     (* property for state variable classification *)
31 :     val {getFn = varClass : V.var -> state_var_class, setFn = setClass, ...} =
32 :     V.newProp (fn x => raise Fail(V.toString x ^ " not a state variable"))
33 :    
34 :     (* analyse a strand *)
35 :     fun analyseStrand (IL.Strand{name, params, state, stateInit, methods}) = let
36 :     in
37 :     (* initially, we mark all state variables as UNIFORM *)
38 :     List.app (fn x => setClass(x, UNIFORM)) state;
39 :     end
40 :    
41 :     end

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