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

SCM Repository

[diderot] View of /trunk/src/compiler/codegen/target-sig.sml
ViewVC logotype

View of /trunk/src/compiler/codegen/target-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 511 - (download) (annotate)
Tue Feb 8 17:01:43 2011 UTC (8 years, 5 months ago) by jhr
File size: 2492 byte(s)
  Backporting changes from pure-cfg branch.  These include the "actor" ==> "strand"
  changes.
(* target-sig.sml
 *
 * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *
 * Support for generating C-like code (e.g., C, OpenCL, or CUDA)
 *)

signature TARGET =
  sig

    type program
    type strand
    type exp
    type cond
    type stm
    type method

    val defineStrand : program * ?? -> strand
    val globalVar : program * ?? -> global_var
    val stateVar : strand * ?? -> state_var

  (* expression construction *)
    structure Expr : sig
      (* variable references *)
	val global : global_var -> exp
	val getState : state_var -> exp
	val param : param_var -> exp
	val var : local_var -> exp
      (* literals *)
	val intLit : IntegerLit.integer -> exp
	val floatLit : FloatLit.float -> exp
	val stringLit : string -> exp
	val boolLit : bool -> exp
      (* vector construction *)
	val vector : exp list -> exp
      (* select from a vector *)
	val select : int * vector -> exp
      (* vector (and scalar) arithmetic *)
	val add : exp * exp -> exp
	val mul : exp * exp -> exp
	val sub : exp * exp -> exp
	val divide : exp * exp -> exp
	val neg : exp -> exp
	val abs : exp -> exp
	val dot : exp * exprr -> exp		(* dot product *)
	val cross : exp * exp -> exp		(* cross product *)
	val length : exp -> exp			(* vector length *)
	val normalize : exp -> exp		(* normalize vector *)
      (* comparisons *)
	val min : exp * exp -> exp
	val max : exp * exp -> exp
      (* math functions *)
	val pow : exp * exp -> exp
	val sin : exp -> exp
	val cos : exp -> exp
	val sqrt : exp -> exp
      (* conversions *)
	val toReal : exp -> exp			(* integer to real *)
	val roundToInt : exp -> exp		(* round real to int *)
	val truncToInt : exp -> exp		(* truncate real to inte *)
	val ceilToInt : exp -> exp		(* ceiling of real to int *)
	val floorToInt : exp -> exp		(* floor of real to int *)
      end

  (* conditionals *)
    structure Cond : sig
      (* comparisons *)
	val lt : exp * exp -> cond
	val lte : exp * exp -> cond
	val equ : exp * exp -> cond
	val neq : exp * exp -> cond
	val gte : exp * exp -> cond
	val gt : exp * exp -> cond
      (* logical connectives *)
	val not : cond -> cond
	val && : cond * cond -> cond
	val || : cond * cond -> cond
      end

  (* statement construction *)
    structure Stmt : sig
	val assignState : state_var * exp -> stm
	val assign : local_var * exp -> stm
	val block : stm list -> stm
	val ifthen : cond * stm -> stm
	val ifthenelse : cond * stm * stm -> stm
      end

  end

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