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

SCM Repository

[diderot] View of /branches/vis15/src/compiler/tree-ir/tree-state-var.sml
ViewVC logotype

View of /branches/vis15/src/compiler/tree-ir/tree-state-var.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4469 - (download) (annotate)
Tue Aug 30 13:56:03 2016 UTC (2 years, 6 months ago) by jhr
File size: 1732 byte(s)
  Working on merge: some preliminary changes to support splitting out the shared strand state from
  the local strand state.
(* tree-state-var.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2016 The University of Chicago
 * All rights reserved.
 *)

structure TreeStateVar : sig

    type t = TreeIR.state_var

    val new : {
            name : string,              (* variable name *)
            ty : TreeTypes.t,           (* variable's TreeIR type *)
            varying : bool,             (* does the variable get updated? *)
            shared : bool,              (* is the variable accessed by other strands? *)
            apiTy : APITypes.t option   (* specifies the external type of the variable (for outputs) *)
          } -> t

    val name : t -> string
    val qname : t -> string             (* qualified name "sv_" ^ name *)

    val same : t * t -> bool

    val ty : t -> TreeTypes.t

    val apiTy : t -> APITypes.t

    val isOutput : t -> bool

    val isVarying : t -> bool

    val isShared : t -> bool

    val toString : t -> string

  end = struct

    datatype t = datatype TreeIR.state_var

    fun new {name, ty, varying, shared, apiTy} = SV{
            name = name, ty = ty, xty = apiTy, varying = varying, shared = shared
          }

    fun same (SV{name=a, ...}, SV{name=b, ...}) = (a = b)

    fun name (SV{name, ...}) = name
    fun qname (SV{name, ...}) = "sv_" ^ name

    fun ty (SV{ty, ...}) = ty

    fun apiTy (SV{xty = SOME ty, ...}) = ty
      | apiTy (SV{name, ...}) = raise Fail(concat["apiTy: ", name, " is not an output"])

    fun isOutput (SV{xty = NONE, ...}) = false
      | isOutput _ = true

    fun isVarying (SV{varying, ...}) = varying

    fun isShared (SV{shared, ...}) = shared

    fun toString (SV{name, ...}) = name

  end

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