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 3912 - (download) (annotate)
Wed May 25 14:53:50 2016 UTC (3 years ago) by jhr
File size: 1260 byte(s)
  Working on merge: code generation
(* 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? *)
	    apiTy : APITypes.t option	(* specifies the external type of the variable (for outputs) *)
	  } -> t

    val name : t -> string

    val ty : t -> TreeTypes.t

    val apiTy : t -> APITypes.t

    val isOutput : t -> bool

    val isVarying : t -> bool

    val toString : t -> string

  end = struct

    datatype t = datatype TreeIR.state_var

    fun new {name, ty, varying, apiTy} = SV{
	    name = "sv_" ^ name, ty = ty, xty = apiTy, varying = varying
	  }

    fun name (SV{name, ...}) = 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 toString (SV{name, ...}) = name

  end

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