SCM Repository
Annotation of /branches/vis12/src/compiler/codegen/target-sig.sml
Parent Directory
|
Revision Log
Revision 1705 - (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 : | val exp : env * TreeIL.exp -> exp | ||
42 : | jhr | 451 | end |
43 : | |||
44 : | jhr | 1116 | (* variables *) |
45 : | structure Var : sig | ||
46 : | jhr | 1640 | val name : var -> string |
47 : | val global : program * string * TreeIL.Ty.ty -> var (* global variables *) | ||
48 : | val param : TreeIL.var -> var (* strand parameters *) | ||
49 : | jhr | 451 | end |
50 : | |||
51 : | jhr | 1116 | (* environments *) |
52 : | structure Env : sig | ||
53 : | (* create a new environment *) | ||
54 : | jhr | 1640 | val new : program -> env |
55 : | jhr | 1116 | (* define the current translation context *) |
56 : | jhr | 1640 | val scopeGlobal : env -> env (* global initialization *) |
57 : | val scopeInitially : env -> env (* initial strand creation *) | ||
58 : | val scopeStrand : env -> env (* strand initialization; the vars are *) | ||
59 : | (* all of the state vars *) | ||
60 : | val scopeMethod : env * StrandUtil.method_name -> env (* method body; the vars are just the *) | ||
61 : | (* varying state variables *) | ||
62 : | jhr | 1116 | (* bind a TreeIL variable to a target variable *) |
63 : | jhr | 1640 | val bind : env * TreeIL.var * var -> env |
64 : | jhr | 451 | end |
65 : | |||
66 : | jhr | 1116 | (* programs *) |
67 : | structure Program : sig | ||
68 : | jhr | 1705 | val new : TargetUtil.target_desc -> program |
69 : | jhr | 1640 | val inputs : program * stm -> unit (* register options for input-variables *) |
70 : | val init : program * stm -> unit (* initialization of program globals *) | ||
71 : | jhr | 1116 | (* register the initially code for a program *) |
72 : | jhr | 1640 | val initially : { |
73 : | prog : program, | ||
74 : | isArray : bool, | ||
75 : | iterPrefix : stm list, | ||
76 : | iters : (var * exp * exp) list, | ||
77 : | createPrefix : stm list, | ||
78 : | strand : Atom.atom, | ||
79 : | args : exp list | ||
80 : | } -> unit | ||
81 : | jhr | 1705 | (* output the code to one or more files *) |
82 : | val generate : program -> unit | ||
83 : | jhr | 1116 | end |
84 : | |||
85 : | (* strands *) | ||
86 : | structure Strand : sig | ||
87 : | (* define a strand with the given name *) | ||
88 : | jhr | 1640 | val define : program * Atom.atom * TreeIL.state_var list -> strand |
89 : | jhr | 1116 | (* return the strand with the given name *) |
90 : | jhr | 1640 | val lookup : program * Atom.atom -> strand |
91 : | jhr | 1116 | (* register the strand-state initialization code. The variables are the strand |
92 : | * parameters. | ||
93 : | *) | ||
94 : | jhr | 1640 | val init : strand * var list * stm -> unit |
95 : | jhr | 1116 | (* register a strand method *) |
96 : | jhr | 1640 | val method : strand * StrandUtil.method_name * stm -> unit |
97 : | jhr | 1116 | end |
98 : | |||
99 : | jhr | 433 | end |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |