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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 651 - (download) (annotate)
Sun Mar 20 16:53:55 2011 UTC (9 years, 7 months ago) by jhr
File size: 1260 byte(s)
  Starting to work on partitioning strand states
(* classify-state.sml
 *
 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *
 * Classify strand state variables into three categories:
 *
 *	UNIFORM		-- these have the same value for all strands
 *	INVARIANT	-- does not change over the life of the strand
 *	VARYING		-- varies from step to step
 *
 * UNIFORM variables can be lifted into the global name space, while INVARIANT variables
 * can be lifted into the non-varying state.
 *)

structure ClassifyState : sig

    datatype state_var_class = UNIFORM | INVARIANT | VARYING

  (* get the classification of a state variable *)
    val varClass : LowIL.var -> state_var_class

  end = struct

    structure IL = LowIL
    structure V = IL.Var

    datatype state_var_class = UNIFORM | INVARIANT | VARYING

  (* property for state variable classification *)
    val {getFn = varClass : V.var -> state_var_class, setFn = setClass, ...} =
	  V.newProp (fn x => raise Fail(V.toString x ^ " not a state variable"))

  (* analyse a strand *)
    fun analyseStrand (IL.Strand{name, params, state, stateInit, methods}) = let
	  in
	  (* initially, we mark all state variables as UNIFORM *)
	    List.app (fn x => setClass(x, UNIFORM)) state;
	  end

  end

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