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

SCM Repository

[diderot] View of /branches/vis15/src/compiler/common/properties.sml
ViewVC logotype

View of /branches/vis15/src/compiler/common/properties.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4627 - (download) (annotate)
Sat Sep 24 19:34:36 2016 UTC (2 years, 9 months ago) by jhr
File size: 2723 byte(s)
  working on merge: change "StrandGrid" to "StrandArray"
(* properties.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * All rights reserved.
 *
 * Various properties of Diderot programs that we want to track.
 *)

structure Properties =
  struct

  (* program properties *)
    datatype t
      = HasGlobals              (* present if the program has global variables *)
      | HasInputs               (* present if the program has input variables *)
      | StrandArray             (* present if the strands are organized in a array *)
      | DynamicSeq              (* present if strands compute dynamic sequences *)
      | StrandsMayDie           (* present if strands may die *)
      | HasStartMethod          (* present if there is a user-defined start method *)
      | HasStabilizeMethod      (* present if there is a user-defined stabilize method *)
      | NewStrands              (* present if new strands may be created dynamically *)
      | StrandCommunication     (* present if strands read the state of other strands *)
      | GlobalInit              (* present if there is a global initialization block *)
      | GlobalStart             (* present if there is a global start block *)
      | GlobalUpdate            (* present if there is a global update block *)
      | GlobalReduce            (* present if there is a global reduction (implies GlobalUpdate) *)
      | StabilizeAll            (* present if there is a global stabilize statment *)
      | StrandSets              (* present if there are strand sets in the global update *)

    fun toString HasGlobals = "HasGlobals"
      | toString HasInputs = "HasInputs"
      | toString StrandArray = "StrandArray"
      | toString DynamicSeq = "DynamicSeq"
      | toString StrandsMayDie = "StrandsMayDie"
      | toString HasStartMethod = "HasStartMethod"
      | toString HasStabilizeMethod = "HasStabilizeMethod"
      | toString NewStrands = "NewStrands"
      | toString StrandCommunication = "StrandCommunication"
      | toString GlobalInit = "GlobalInit"
      | toString GlobalStart = "GlobalStart"
      | toString GlobalUpdate = "GlobalUpdate"
      | toString GlobalReduce = "GlobalReduce"
      | toString StabilizeAll = "StabilizeAll"
      | toString StrandSets = "StrandSets"

    fun propsToString [] = "none"
      | propsToString [p] = toString p
      | propsToString props = String.concatWithMap "," toString props

    fun hasProp (prop : t) = List.exists (fn p => prop = p)

    fun clearProp (prop : t) = List.filter (fn p => (p <> prop))

  (* NOTE: this function is less precise than the TargetSpec.dualState function *)
    val dualState = hasProp StrandCommunication

  end

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