SCM Repository
View of /branches/vis12/src/compiler/codegen/target-sig.sml
Parent Directory
|
Revision Log
Revision 2076 -
(download)
(annotate)
Sun Nov 4 22:10:56 2012 UTC (8 years, 2 months ago) by jhr
File size: 3863 byte(s)
Sun Nov 4 22:10:56 2012 UTC (8 years, 2 months ago) by jhr
File size: 3863 byte(s)
Pass program properties to target-specific code generator
(* 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 var type exp type stm (* environment for mapping from TreeIL variables to target variables. It is also used to * track the translation context (e.g., global initialization vs. strand initialization, etc. *) type env (* the supprted widths of vectors of reals on the target. This value takes into * account the actual size of reals (i.e., 32 or 64 bits). *) val vectorWidths : unit -> int list (* does the target support printing? Note that if the target is parallel, then printing * will not be supported. *) val supportsPrinting : bool (* tests for whether various expression forms can appear inline *) val inlineCons : int -> bool (* can n'th-order tensor construction appear inline *) val inlineMatrixExp : bool (* can matrix-valued expressions appear inline? *) (* TreeIL to target translations *) structure Tr : sig val fragment : env * TreeIL.block -> env * stm list val block : env * TreeIL.block -> stm val free : env * TreeIL.block -> stm val exp : env * TreeIL.exp -> exp end (* variables *) structure Var : sig val name : var -> string val global : program * string * TreeIL.Ty.ty -> var (* global variables *) val param : TreeIL.var -> var (* strand parameters *) end (* environments *) structure Env : sig (* create a new environment *) val new : program -> env (* define the current translation context *) val scopeGlobal : env -> env (* global initialization *) val scopeInitially : env -> env (* initial strand creation *) val scopeStrand : env -> env (* strand initialization; the vars are *) (* all of the state vars *) val scopeMethod : env * StrandUtil.method_name -> env (* method body; the vars are just the *) (* varying state variables *) (* bind a TreeIL variable to a target variable *) val bind : env * TreeIL.var * var -> env end (* programs *) structure Program : sig val new : TargetUtil.target_desc * StrandUtil.program_prop list -> program (* handle input-variables *) val inputs : program * env * TreeIL.block -> unit (* initialization of program globals *) val init : program * stm -> unit (* destruction of program globals *) val free : program * stm -> unit (* register the initially code for a program *) val initially : { prog : program, isArray : bool, iterPrefix : stm list, iters : (var * exp * exp) list, createPrefix : stm list, strand : Atom.atom, args : exp list } -> unit (* output the code to one or more files *) val generate : program -> unit end (* strands *) structure Strand : sig (* define a strand with the given name *) val define : program * Atom.atom * TreeIL.state_var list -> strand (* return the strand with the given name *) val lookup : program * Atom.atom -> strand (* register the strand-state initialization code. The variables are the strand * parameters. *) val init : strand * var list * stm -> unit (* register a strand method *) val method : strand * StrandUtil.method_name * stm -> unit end end
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |