SCM Repository
View of /trunk/src/compiler/codegen/target-sig.sml
Parent Directory
|
Revision Log
Revision 453 -
(download)
(annotate)
Sun Oct 24 00:47:57 2010 UTC (11 years, 8 months ago) by jhr
File size: 2564 byte(s)
Sun Oct 24 00:47:57 2010 UTC (11 years, 8 months ago) by jhr
File size: 2564 byte(s)
Minor edit
(* 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 actor type expr type cond type stmt val defineActor : program * ?? -> actor val globalVar : program * ?? -> global_var val stateVar : actor * ?? -> state_var (* expression construction *) structure Expr : sig (* variable references *) val global : global_var -> expr val getState : state_var -> expr val param : param_var -> expr val var : local_var -> expr (* literals *) val ivecLit : IntegerLit.integer list -> expr val vecLit : FloatLit.float list -> expr val stringLit : string -> expr val boolLit : bool -> expr (* vector construction *) val vector : expr list -> expr (* select from a vector *) val select : int * vector -> expr (* vector (and scalar) arithmetic *) val add : expr * expr -> expr val mul : expr * expr -> expr val sub : expr * expr -> expr val divide : expr * expr -> expr val neg : expr -> expr val abs : expr -> expr val dot : exp * exprr -> expr (* dot product *) val cross : expr * expr -> expr (* cross product *) val length : expr -> expr (* vector length *) val normalize : expr -> expr (* normalize vector *) (* comparisons *) val min : expr * expr -> expr val max : expr * expr -> expr (* math functions *) val pow : expr * expr -> expr val sin : expr -> expr val cos : expr -> expr val sqrt : expr -> expr (* conversions *) val toReal : expr -> expr (* integer to real *) val roundToInt : expr -> expr (* round real to int *) val truncToInt : expr -> expr (* truncate real to inte *) val ceilToInt : expr -> expr (* ceiling of real to int *) val floorToInt : expr -> expr (* floor of real to int *) end (* conditionals *) structure Cond : sig (* comparisons *) val lt : expr * expr -> cond val lte : expr * expr -> cond val equ : expr * expr -> cond val neq : expr * expr -> cond val gte : expr * expr -> cond val gt : expr * expr -> 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 * expr -> stmt val assign : local_var * expr -> stmt val block : stmt list -> stmt val ifthen : cond * stmt -> stmt val ifthenelse : cond * stmt * stmt -> stmt end end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |