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

SCM Repository

[diderot] Annotation of /branches/vis12/src/compiler/codegen/target-sig.sml
ViewVC logotype

Annotation of /branches/vis12/src/compiler/codegen/target-sig.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2634 - (view) (download)

1 : jhr 433 (* target-sig.sml
2 :     *
3 : jhr 435 * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 : jhr 433 * All rights reserved.
5 :     *
6 :     * Support for generating C-like code (e.g., C, OpenCL, or CUDA)
7 :     *)
8 :    
9 :     signature TARGET =
10 :     sig
11 :    
12 : jhr 451 type program
13 : jhr 511 type strand
14 : jhr 1116 type var
15 : jhr 454 type exp
16 :     type stm
17 : jhr 451
18 : jhr 1116 (* environment for mapping from TreeIL variables to target variables. It is also used to
19 :     * track the translation context (e.g., global initialization vs. strand initialization, etc.
20 :     *)
21 :     type env
22 : jhr 451
23 : jhr 1116 (* the supprted widths of vectors of reals on the target. This value takes into
24 :     * account the actual size of reals (i.e., 32 or 64 bits).
25 :     *)
26 :     val vectorWidths : unit -> int list
27 :    
28 : jhr 1640 (* does the target support printing? Note that if the target is parallel, then printing
29 :     * will not be supported.
30 :     *)
31 :     val supportsPrinting : bool
32 :    
33 : jhr 1116 (* tests for whether various expression forms can appear inline *)
34 : jhr 1640 val inlineCons : int -> bool (* can n'th-order tensor construction appear inline *)
35 :     val inlineMatrixExp : bool (* can matrix-valued expressions appear inline? *)
36 : jhr 1116
37 :     (* TreeIL to target translations *)
38 :     structure Tr : sig
39 : jhr 1640 val fragment : env * TreeIL.block -> env * stm list
40 :     val block : env * TreeIL.block -> stm
41 : nseltzer 1870 val free : env * TreeIL.block -> stm
42 : jhr 1640 val exp : env * TreeIL.exp -> exp
43 : jhr 451 end
44 :    
45 : jhr 1116 (* variables *)
46 :     structure Var : sig
47 : jhr 1640 val name : var -> string
48 :     val global : program * string * TreeIL.Ty.ty -> var (* global variables *)
49 : jhr 2634 val param : TreeIL.var -> var (* strand parameters *)
50 : jhr 451 end
51 :    
52 : jhr 1116 (* environments *)
53 :     structure Env : sig
54 :     (* create a new environment *)
55 : jhr 1640 val new : program -> env
56 : jhr 1116 (* define the current translation context *)
57 : jhr 1640 val scopeGlobal : env -> env (* global initialization *)
58 :     val scopeInitially : env -> env (* initial strand creation *)
59 :     val scopeStrand : env -> env (* strand initialization; the vars are *)
60 :     (* all of the state vars *)
61 :     val scopeMethod : env * StrandUtil.method_name -> env (* method body; the vars are just the *)
62 :     (* varying state variables *)
63 : jhr 1116 (* bind a TreeIL variable to a target variable *)
64 : jhr 1640 val bind : env * TreeIL.var * var -> env
65 : jhr 451 end
66 :    
67 : jhr 1116 (* programs *)
68 :     structure Program : sig
69 : jhr 2076 val new : TargetUtil.target_desc * StrandUtil.program_prop list -> program
70 : jhr 1803 (* handle input-variables *)
71 :     val inputs : program * env * TreeIL.block -> unit
72 :     (* initialization of program globals *)
73 :     val init : program * stm -> unit
74 : nseltzer 1870 (* destruction of program globals *)
75 :     val free : program * stm -> unit
76 : jhr 1116 (* register the initially code for a program *)
77 : jhr 1640 val initially : {
78 :     prog : program,
79 :     isArray : bool,
80 :     iterPrefix : stm list,
81 :     iters : (var * exp * exp) list,
82 :     createPrefix : stm list,
83 :     strand : Atom.atom,
84 :     args : exp list
85 :     } -> unit
86 : jhr 1705 (* output the code to one or more files *)
87 :     val generate : program -> unit
88 : jhr 1116 end
89 :    
90 :     (* strands *)
91 :     structure Strand : sig
92 :     (* define a strand with the given name *)
93 : jhr 1640 val define : program * Atom.atom * TreeIL.state_var list -> strand
94 : jhr 1116 (* return the strand with the given name *)
95 : jhr 1640 val lookup : program * Atom.atom -> strand
96 : jhr 1116 (* register the strand-state initialization code. The variables are the strand
97 :     * parameters.
98 :     *)
99 : jhr 1640 val init : strand * var list * stm -> unit
100 : jhr 1116 (* register a strand method *)
101 : jhr 1640 val method : strand * StrandUtil.method_name * stm -> unit
102 : jhr 1116 end
103 :    
104 : jhr 433 end

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