SCM Repository
View of /branches/pure-cfg/src/compiler/codegen/target-sig.sml
Parent Directory
|
Revision Log
Revision 513 -
(download)
(annotate)
Tue Feb 8 21:23:01 2011 UTC (11 years, 4 months ago) by jhr
File size: 2545 byte(s)
Tue Feb 8 21:23:01 2011 UTC (11 years, 4 months ago) by jhr
File size: 2545 byte(s)
Working on code generation
(* 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 * expr -> 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 comment : string list -> stm val assignState : state_var * exp -> stm val assign : local_var * exp -> stm val block : stm list -> stm val ifthenelse : cond * stm * stm -> stm val die : unit -> stm val stabilize : unit -> stm end end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |