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

SCM Repository

[diderot] Annotation of /branches/pure-cfg/src/compiler/c-target/c-target.sml
ViewVC logotype

Annotation of /branches/pure-cfg/src/compiler/c-target/c-target.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3349 - (view) (download)

1 : jhr 519 (* c-target.sml
2 :     *
3 : jhr 3349 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     *
5 :     * COPYRIGHT (c) 2015 The University of Chicago
6 : jhr 519 * All rights reserved.
7 :     *)
8 :    
9 : jhr 840 structure CTarget : TARGET =
10 : jhr 519 struct
11 :    
12 : jhr 839 structure IL = TreeIL
13 : jhr 840 structure V = IL.Var
14 : jhr 842 structure Ty = IL.Ty
15 : jhr 522 structure CL = CLang
16 : jhr 1283 structure N = CNames
17 : jhr 522
18 : jhr 1285 (* variable translation *)
19 :     structure TrVar =
20 :     struct
21 :     type env = CL.typed_var TreeIL.Var.Map.map
22 :     fun lookup (env, x) = (case V.Map.find (env, x)
23 :     of SOME(CL.V(_, x')) => x'
24 :     | NONE => raise Fail(concat["lookup(_, ", V.name x, ")"])
25 :     (* end case *))
26 :     (* translate a variable that occurs in an l-value context (i.e., as the target of an assignment) *)
27 :     fun lvalueVar (env, x) = (case V.kind x
28 :     of IL.VK_Global => CL.mkVar(lookup(env, x))
29 :     | IL.VK_Local => CL.mkVar(lookup(env, x))
30 :     (* end case *))
31 :     (* translate a variable that occurs in an r-value context *)
32 :     fun rvalueVar (env, x) = (case V.kind x
33 :     of IL.VK_Global => CL.mkVar(lookup(env, x))
34 :     | IL.VK_Local => CL.mkVar(lookup(env, x))
35 :     (* end case *))
36 : jhr 1504 (* translate a strand state variable that occurs in an l-value context *)
37 :     fun lvalueStateVar x = CL.mkIndirect(CL.mkVar "selfOut", IL.StateVar.name x)
38 :     (* translate a strand state variable that occurs in an r-value context *)
39 :     fun rvalueStateVar x = CL.mkIndirect(CL.mkVar "selfIn", IL.StateVar.name x)
40 : jhr 1285 end
41 :    
42 :     structure ToC = TreeToCFn (TrVar)
43 :    
44 :     type var = CL.typed_var
45 : jhr 839 type exp = CL.exp
46 :     type stm = CL.stm
47 : jhr 519
48 : jhr 544 datatype strand = Strand of {
49 : jhr 1374 name : string,
50 :     tyName : string,
51 : jhr 1504 state : var list,
52 :     output : (Ty.ty * CL.var), (* the strand's output variable (only one for now) *)
53 : jhr 1374 code : CL.decl list ref
54 : jhr 544 }
55 : jhr 525
56 : jhr 527 datatype program = Prog of {
57 : jhr 1374 name : string, (* stem of source file *)
58 :     double : bool, (* true for double-precision support *)
59 :     parallel : bool, (* true for multithreaded (or multi-GPU) target *)
60 :     debug : bool, (* true for debug support in executable *)
61 :     globals : CL.decl list ref,
62 :     topDecls : CL.decl list ref,
63 :     strands : strand AtomTable.hash_table,
64 :     initially : CL.decl ref
65 : jhr 527 }
66 :    
67 : jhr 842 datatype env = ENV of {
68 : jhr 1374 info : env_info,
69 :     vMap : var V.Map.map,
70 :     scope : scope
71 : jhr 839 }
72 : jhr 519
73 : jhr 839 and env_info = INFO of {
74 : jhr 1374 prog : program
75 : jhr 839 }
76 : jhr 519
77 : jhr 839 and scope
78 :     = NoScope
79 :     | GlobalScope
80 :     | InitiallyScope
81 : jhr 1504 | StrandScope (* strand initialization *)
82 : jhr 1505 | MethodScope of StrandUtil.method_name (* method body; vars are state variables *)
83 : jhr 534
84 : jhr 839 (* the supprted widths of vectors of reals on the target. For the GNU vector extensions,
85 :     * the supported sizes are powers of two, but float2 is broken.
86 :     * NOTE: we should also consider the AVX vector hardware, which has 256-bit registers.
87 :     *)
88 : jhr 1262 fun vectorWidths () = if !N.doublePrecision
89 : jhr 1374 then [2, 4, 8]
90 :     else [4, 8]
91 : jhr 528
92 : jhr 1628 (* we support printing in the sequential C target *)
93 :     val supportsPrinting = true
94 :    
95 : jhr 839 (* tests for whether various expression forms can appear inline *)
96 : jhr 1374 fun inlineCons n = (n < 2) (* vectors are inline, but not matrices *)
97 :     val inlineMatrixExp = false (* can matrix-valued expressions appear inline? *)
98 : jhr 548
99 : jhr 839 (* TreeIL to target translations *)
100 :     structure Tr =
101 : jhr 525 struct
102 : jhr 1374 fun fragment (ENV{info, vMap, scope}, blk) = let
103 :     val (vMap, stms) = ToC.trFragment (vMap, blk)
104 :     in
105 :     (ENV{info=info, vMap=vMap, scope=scope}, stms)
106 :     end
107 : jhr 1504 (* NOTE: we may be able to simplify the interface to ToC.trBlock! *)
108 : jhr 1505 fun block (ENV{vMap, ...}, blk) = ToC.trBlock (vMap, blk)
109 : jhr 1374 fun exp (ENV{vMap, ...}, e) = ToC.trExp(vMap, e)
110 : jhr 519 end
111 :    
112 : jhr 839 (* variables *)
113 :     structure Var =
114 : jhr 525 struct
115 : jhr 1374 fun name (CL.V(_, name)) = name
116 :     fun global (Prog{globals, ...}, name, ty) = let
117 :     val ty' = ToC.trType ty
118 :     in
119 :     globals := CL.D_Var([], ty', name, NONE) :: !globals;
120 :     CL.V(ty', name)
121 :     end
122 :     fun param x = CL.V(ToC.trType(V.ty x), V.name x)
123 : jhr 839 end
124 : jhr 525
125 : jhr 839 (* environments *)
126 :     structure Env =
127 :     struct
128 :     (* create a new environment *)
129 : jhr 1374 fun new prog = ENV{
130 :     info=INFO{prog = prog},
131 :     vMap = V.Map.empty,
132 :     scope = NoScope
133 :     }
134 : jhr 839 (* define the current translation context *)
135 : jhr 1374 fun setScope scope (ENV{info, vMap, ...}) = ENV{info=info, vMap=vMap, scope=scope}
136 :     val scopeGlobal = setScope GlobalScope
137 :     val scopeInitially = setScope InitiallyScope
138 : jhr 1504 fun scopeStrand env = setScope StrandScope env
139 :     fun scopeMethod (env, name) = setScope (MethodScope name) env
140 : jhr 839 (* bind a TreeIL varaiable to a target variable *)
141 : jhr 1374 fun bind (ENV{info, vMap, scope}, x, x') = ENV{
142 :     info = info,
143 :     vMap = V.Map.insert(vMap, x, x'),
144 :     scope = scope
145 :     }
146 : jhr 839 end
147 : jhr 525
148 : jhr 839 (* programs *)
149 : jhr 840 structure Program =
150 :     struct
151 : jhr 1374 fun new {name, double, parallel, debug} = (
152 : jhr 1593 N.initTargetSpec {double=double, long=false};
153 : jhr 1374 Prog{
154 :     name = name,
155 :     double = double, parallel = parallel, debug = debug,
156 :     globals = ref [ (* NOTE: in reverse order! *)
157 : jhr 1280 CL.D_Var(["static"], CL.charPtr, "ProgramName",
158 :     SOME(CL.I_Exp(CL.mkStr name))),
159 :     CL.D_Verbatim[
160 :     if double
161 : jhr 1630 then "#define DIDEROT_DOUBLE_PRECISION\n"
162 :     else "#define DIDEROT_SINGLE_PRECISION\n",
163 :     "#define DIDEROT_INT\n",
164 : jhr 1374 if parallel
165 : jhr 1630 then "#define DIDEROT_TARGET_PARALLEL\n"
166 :     else "#define DIDEROT_TARGET_C\n",
167 :     "#include \"Diderot/diderot.h\"\n"
168 : jhr 1280 ]
169 : jhr 1374 ],
170 :     topDecls = ref [],
171 :     strands = AtomTable.mkTable (16, Fail "strand table"),
172 :     initially = ref(CL.D_Comment["missing initially"])
173 :     })
174 : jhr 1261 (* register the code that is used to register command-line options for input variables *)
175 : jhr 1374 fun inputs (Prog{topDecls, ...}, stm) = let
176 :     val inputsFn = CL.D_Func(
177 :     [], CL.voidTy, N.registerOpts,
178 :     [CL.PARAM([], CL.T_Ptr(CL.T_Named N.optionsTy), "opts")],
179 :     stm)
180 :     in
181 :     topDecls := inputsFn :: !topDecls
182 :     end
183 : jhr 839 (* register the global initialization part of a program *)
184 : jhr 1374 fun init (Prog{topDecls, ...}, init) = let
185 :     val initFn = CL.D_Func([], CL.voidTy, N.initGlobals, [], init)
186 :     val shutdownFn = CL.D_Func(
187 :     [], CL.voidTy, N.shutdown,
188 :     [CL.PARAM([], CL.T_Ptr(CL.T_Named N.worldTy), "wrld")],
189 :     CL.S_Block[])
190 :     in
191 :     topDecls := shutdownFn :: initFn :: !topDecls
192 :     end
193 : jhr 839 (* create and register the initially function for a program *)
194 : jhr 1374 fun initially {
195 :     prog = Prog{name=progName, strands, initially, ...},
196 :     isArray : bool,
197 :     iterPrefix : stm list,
198 :     iters : (var * exp * exp) list,
199 :     createPrefix : stm list,
200 :     strand : Atom.atom,
201 :     args : exp list
202 :     } = let
203 :     val name = Atom.toString strand
204 :     val nDims = List.length iters
205 :     val worldTy = CL.T_Ptr(CL.T_Named N.worldTy)
206 :     fun mapi f xs = let
207 :     fun mapf (_, []) = []
208 :     | mapf (i, x::xs) = f(i, x) :: mapf(i+1, xs)
209 :     in
210 :     mapf (0, xs)
211 :     end
212 :     val baseInit = mapi (fn (i, (_, e, _)) => (i, CL.I_Exp e)) iters
213 :     val sizeInit = mapi
214 :     (fn (i, (CL.V(ty, _), lo, hi)) =>
215 :     (i, CL.I_Exp(CL.mkBinOp(CL.mkBinOp(hi, CL.#-, lo), CL.#+, CL.E_Int(1, ty))))
216 :     ) iters
217 :     (* code to allocate the world and initial strands *)
218 :     val wrld = "wrld"
219 :     val allocCode = [
220 :     CL.mkComment["allocate initial block of strands"],
221 :     CL.mkDecl(CL.T_Array(CL.int32, SOME nDims), "base", SOME(CL.I_Array baseInit)),
222 :     CL.mkDecl(CL.T_Array(CL.uint32, SOME nDims), "size", SOME(CL.I_Array sizeInit)),
223 :     CL.mkDecl(worldTy, wrld,
224 :     SOME(CL.I_Exp(CL.E_Apply(N.allocInitially, [
225 :     CL.mkVar "ProgramName",
226 :     CL.mkUnOp(CL.%&, CL.E_Var(N.strandDesc name)),
227 :     CL.E_Bool isArray,
228 :     CL.E_Int(IntInf.fromInt nDims, CL.int32),
229 :     CL.E_Var "base",
230 :     CL.E_Var "size"
231 :     ]))))
232 :     ]
233 :     (* create the loop nest for the initially iterations *)
234 :     val indexVar = "ix"
235 :     val strandTy = CL.T_Ptr(CL.T_Named(N.strandTy name))
236 :     fun mkLoopNest [] = CL.mkBlock(createPrefix @ [
237 :     CL.mkDecl(strandTy, "sp",
238 :     SOME(CL.I_Exp(
239 :     CL.E_Cast(strandTy,
240 :     CL.E_Apply(N.inState, [CL.E_Var "wrld", CL.E_Var indexVar]))))),
241 :     CL.mkCall(N.strandInit name, CL.E_Var "sp" :: args),
242 :     CL.mkAssign(CL.E_Var indexVar, CL.mkBinOp(CL.E_Var indexVar, CL.#+, CL.E_Int(1, CL.uint32)))
243 :     ])
244 :     | mkLoopNest ((CL.V(ty, param), lo, hi)::iters) = let
245 :     val body = mkLoopNest iters
246 :     in
247 :     CL.mkFor(
248 :     [(ty, param, lo)],
249 :     CL.mkBinOp(CL.E_Var param, CL.#<=, hi),
250 :     [CL.mkPostOp(CL.E_Var param, CL.^++)],
251 :     body)
252 :     end
253 :     val iterCode = [
254 :     CL.mkComment["initially"],
255 :     CL.mkDecl(CL.uint32, indexVar, SOME(CL.I_Exp(CL.E_Int(0, CL.uint32)))),
256 :     mkLoopNest iters
257 :     ]
258 :     val body = CL.mkBlock(
259 :     iterPrefix @
260 :     allocCode @
261 :     iterCode @
262 :     [CL.mkReturn(SOME(CL.E_Var "wrld"))])
263 :     val initFn = CL.D_Func([], worldTy, N.initially, [], body)
264 :     in
265 :     initially := initFn
266 :     end
267 : jhr 839
268 :     (***** OUTPUT *****)
269 : jhr 1374 fun genStrand (Strand{name, tyName, state, output, code}) = let
270 :     (* the type declaration for the strand's state struct *)
271 :     val selfTyDef = CL.D_StructDef(
272 : jhr 1504 List.rev (List.map (fn CL.V(ty, x) => (ty, x)) state),
273 : jhr 1374 tyName)
274 : jhr 1475 (* the type and access expression for the strand's output variable *)
275 : jhr 1504 val (outTy, outState) = (#1 output, CL.mkIndirect(CL.mkVar "self", #2 output))
276 : jhr 1374 (* the print function *)
277 : jhr 1487 val prFnName = concat[name, "_Print"]
278 : jhr 1374 val prFn = let
279 :     val params = [
280 :     CL.PARAM([], CL.T_Ptr(CL.T_Named "FILE"), "outS"),
281 :     CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "self")
282 :     ]
283 : jhr 1475 val prArgs = (case outTy
284 : jhr 1522 of Ty.IntTy => [CL.E_Str(!N.gIntFormat ^ "\n"), outState]
285 :     | Ty.TensorTy[] => [CL.E_Str "%f\n", outState]
286 :     | Ty.TensorTy[d] => let
287 : jhr 1374 val fmt = CL.E_Str(
288 : jhr 1522 String.concatWith " " (List.tabulate(d, fn _ => "%f"))
289 : jhr 1374 ^ "\n")
290 : jhr 1522 val args = List.tabulate (d, fn i => ToC.vecIndex(outState, d, i))
291 : jhr 1374 in
292 :     fmt :: args
293 :     end
294 : jhr 1522 | Ty.SeqTy(Ty.IntTy, d) => let
295 : jhr 1374 val fmt = CL.E_Str(
296 : jhr 1522 String.concatWith " " (List.tabulate(d, fn _ => !N.gIntFormat))
297 : jhr 1374 ^ "\n")
298 : jhr 1522 val args = List.tabulate (d, fn i => ToC.ivecIndex(outState, d, i))
299 : jhr 1374 in
300 :     fmt :: args
301 :     end
302 : jhr 1475 | _ => raise Fail("genStrand: unsupported output type " ^ Ty.toString outTy)
303 : jhr 1374 (* end case *))
304 :     in
305 :     CL.D_Func(["static"], CL.voidTy, prFnName, params,
306 :     CL.mkCall("fprintf", CL.mkVar "outS" :: prArgs))
307 :     end
308 : nseltzer 1449 (* the output function *)
309 : jhr 1487 val outFnName = concat[name, "_Output"]
310 : nseltzer 1449 val outFn = let
311 :     val params = [
312 : jhr 1475 CL.PARAM([], CL.T_Ptr CL.voidTy, "outS"),
313 : nseltzer 1449 CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "self")
314 :     ]
315 : jhr 1475 (* get address of output variable *)
316 :     val outState = CL.mkUnOp(CL.%&, outState)
317 : nseltzer 1449 in
318 :     CL.D_Func(["static"], CL.voidTy, outFnName, params,
319 :     CL.mkCall("memcpy", [CL.mkVar "outS", outState, CL.mkSizeof(ToC.trType outTy)] ))
320 :     end
321 : jhr 1374 (* the strand's descriptor object *)
322 :     val descI = let
323 :     fun fnPtr (ty, f) = CL.I_Exp(CL.mkCast(CL.T_Named ty, CL.mkVar f))
324 : jhr 1478 val nrrdTy = NrrdTypes.toNrrdType outTy
325 : nseltzer 1479 val nrrdSize = NrrdTypes.toNrrdSize outTy
326 : jhr 1480 in
327 :     CL.I_Struct[
328 :     ("name", CL.I_Exp(CL.mkStr name)),
329 :     ("stateSzb", CL.I_Exp(CL.mkSizeof(CL.T_Named(N.strandTy name)))),
330 :     ("outputSzb", CL.I_Exp(CL.mkInt nrrdSize)),
331 : lamonts 1526 ("nrrdSzb", CL.I_Exp(CL.mkInt nrrdSize)),
332 : jhr 1480 ("nrrdType", CL.I_Exp(CL.mkInt nrrdTy)),
333 : jhr 1505 (* FIXME: should use StrandUtil.nameToString here *)
334 : jhr 1487 ("update", fnPtr("update_method_t", name ^ "_Update")),
335 :     ("stabilize", fnPtr("stabilize_method_t", name ^ "_Stabilize")),
336 : jhr 1480 ("print", fnPtr("print_method_t", prFnName)),
337 :     ("output", fnPtr("output_method_t", outFnName))
338 :     ]
339 :     end
340 : jhr 1374 val desc = CL.D_Var([], CL.T_Named N.strandDescTy, N.strandDesc name, SOME descI)
341 :     in
342 : nseltzer 1449 selfTyDef :: List.rev (desc :: prFn :: outFn :: !code)
343 : jhr 1374 end
344 : jhr 839
345 :     (* generate the table of strand descriptors *)
346 : jhr 1374 fun genStrandTable (ppStrm, strands) = let
347 :     val nStrands = length strands
348 :     fun genInit (Strand{name, ...}) = CL.I_Exp(CL.mkUnOp(CL.%&, CL.E_Var(N.strandDesc name)))
349 :     fun genInits (_, []) = []
350 :     | genInits (i, s::ss) = (i, genInit s) :: genInits(i+1, ss)
351 :     fun ppDecl dcl = PrintAsC.output(ppStrm, dcl)
352 :     in
353 :     ppDecl (CL.D_Var([], CL.int32, N.numStrands,
354 :     SOME(CL.I_Exp(CL.E_Int(IntInf.fromInt nStrands, CL.int32)))));
355 :     ppDecl (CL.D_Var([],
356 :     CL.T_Array(CL.T_Ptr(CL.T_Named N.strandDescTy), SOME nStrands),
357 :     N.strands,
358 :     SOME(CL.I_Array(genInits (0, strands)))))
359 :     end
360 : jhr 519
361 : jhr 1374 fun genSrc (baseName, prog) = let
362 :     val Prog{name, globals, topDecls, strands, initially, ...} = prog
363 :     val fileName = OS.Path.joinBaseExt{base=baseName, ext=SOME "c"}
364 :     val outS = TextIO.openOut fileName
365 :     val ppStrm = PrintAsC.new outS
366 :     fun ppDecl dcl = PrintAsC.output(ppStrm, dcl)
367 :     val strands = AtomTable.listItems strands
368 :     in
369 :     List.app ppDecl (List.rev (!globals));
370 :     List.app ppDecl (List.rev (!topDecls));
371 :     List.app (fn strand => List.app ppDecl (genStrand strand)) strands;
372 :     genStrandTable (ppStrm, strands);
373 :     ppDecl (!initially);
374 :     PrintAsC.close ppStrm;
375 :     TextIO.closeOut outS
376 :     end
377 : jhr 547
378 : jhr 839 (* output the code to a file. The string is the basename of the file, the extension
379 :     * is provided by the target.
380 :     *)
381 : jhr 1374 fun generate (basename, prog as Prog{name, double, parallel, debug, ...}) = let
382 :     fun condCons (true, x, xs) = x::xs
383 :     | condCons (false, _, xs) = xs
384 :     (* generate the C compiler flags *)
385 :     val cflags = ["-I" ^ Paths.diderotInclude, "-I" ^ Paths.teemInclude]
386 :     val cflags = condCons (parallel, #pthread Paths.cflags, cflags)
387 :     val cflags = if debug
388 :     then #debug Paths.cflags :: cflags
389 :     else #ndebug Paths.cflags :: cflags
390 :     val cflags = #base Paths.cflags :: cflags
391 :     (* generate the loader flags *)
392 :     val extraLibs = condCons (parallel, #pthread Paths.extraLibs, [])
393 :     val extraLibs = Paths.teemLinkFlags @ #base Paths.extraLibs :: extraLibs
394 :     val rtLib = TargetUtil.runtimeName {
395 :     target = TargetUtil.TARGET_C,
396 :     parallel = parallel, double = double, debug = debug
397 :     }
398 :     val ldOpts = rtLib :: extraLibs
399 :     in
400 : jhr 1668 genSrc (basename, prog);
401 : jhr 1374 RunCC.compile (basename, cflags);
402 :     RunCC.link (basename, ldOpts)
403 :     end
404 : jhr 839
405 : jhr 519 end
406 :    
407 : jhr 839 (* strands *)
408 : jhr 544 structure Strand =
409 :     struct
410 : jhr 1504 fun define (Prog{strands, ...}, strandId, state) = let
411 : jhr 1374 val name = Atom.toString strandId
412 : jhr 1504 (* the output state variable *)
413 :     val outputVar = (case List.filter IL.StateVar.isOutput state
414 :     of [] => raise Fail("no output specified for strand " ^ name)
415 :     | [x] => (IL.StateVar.ty x, IL.StateVar.name x)
416 :     | _ => raise Fail("multiple outputs in " ^ name)
417 :     (* end case *))
418 :     (* the state variables *)
419 :     val state = let
420 :     fun cvt x = CL.V(ToC.trType(IL.StateVar.ty x), IL.StateVar.name x)
421 :     in
422 :     List.map cvt state
423 :     end
424 : jhr 1374 val strand = Strand{
425 :     name = name,
426 :     tyName = N.strandTy name,
427 : jhr 1504 state = state,
428 :     output = outputVar,
429 : jhr 1374 code = ref []
430 :     }
431 :     in
432 :     AtomTable.insert strands (strandId, strand);
433 :     strand
434 :     end
435 : jhr 544
436 : jhr 624 (* return the strand with the given name *)
437 : jhr 1374 fun lookup (Prog{strands, ...}, strandId) = AtomTable.lookup strands strandId
438 : jhr 624
439 : jhr 544 (* register the strand-state initialization code. The variables are the strand
440 :     * parameters.
441 :     *)
442 : jhr 1374 fun init (Strand{name, tyName, code, ...}, params, init) = let
443 :     val fName = N.strandInit name
444 :     val params =
445 :     CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "selfOut") ::
446 :     List.map (fn (CL.V(ty, x)) => CL.PARAM([], ty, x)) params
447 :     val initFn = CL.D_Func([], CL.voidTy, fName, params, init)
448 :     in
449 :     code := initFn :: !code
450 :     end
451 : jhr 547
452 :     (* register a strand method *)
453 : jhr 1374 fun method (Strand{name, tyName, code, ...}, methName, body) = let
454 : jhr 1505 val fName = concat[name, "_", StrandUtil.nameToString methName]
455 : jhr 1374 val params = [
456 :     CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "selfIn"),
457 :     CL.PARAM([], CL.T_Ptr(CL.T_Named tyName), "selfOut")
458 :     ]
459 : jhr 1443 val resTy = (case methName
460 : jhr 1505 of StrandUtil.Update => CL.T_Named "StrandStatus_t"
461 :     | StrandUtil.Stabilize => CL.voidTy
462 : jhr 1443 (* end case *))
463 :     val methFn = CL.D_Func(["static"], resTy, fName, params, body)
464 : jhr 1374 in
465 :     code := methFn :: !code
466 :     end
467 : jhr 654
468 : jhr 839 end
469 : jhr 624
470 : jhr 519 end
471 :    
472 :     structure CBackEnd = CodeGenFn(CTarget)

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