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 3924 - (download) (annotate)
Fri Jun 3 17:30:27 2016 UTC (4 years ago) by jhr
File size: 1449 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 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 toString : t -> string

  end = struct

    datatype t = datatype TreeIR.state_var

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

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

  end

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