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

SCM Repository

[diderot] Annotation of /branches/vis15/src/compiler/gen/ir/mid-ir.in
ViewVC logotype

Annotation of /branches/vis15/src/compiler/gen/ir/mid-ir.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3886 - (view) (download)

1 : jhr 3475 (* mid-ir.sml
2 : jhr 3461 *
3 :     * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     *
5 :     * COPYRIGHT (c) 2015 The University of Chicago
6 :     * All rights reserved.
7 :     *
8 : jhr 3475 * Middle-level version of the Diderot CFG IR
9 : jhr 3461 *
10 : jhr 3475 * Note: this file is generated from gen/ir/mid-ir.spec and gen/ir/mid-ir.in.
11 : jhr 3461 *)
12 :    
13 :     structure MidOps =
14 :     struct
15 :    
16 :     (* required helper functions for types *)
17 : jhr 3475 type ty = MidTypes.ty
18 :     val samety = MidTypes.same
19 :     val hashty = MidTypes.hash
20 :     val tyToString = MidTypes.toString
21 : jhr 3461
22 :     (* required helper functions for type lists *)
23 :     type tys = ty list
24 :     fun sametys (tys1, tys2) = ListPair.allEq samety (tys1, tys2)
25 :     fun hashtys tys = List.foldl (fn (ty, s) => hashty ty + 0w3 * s) 0w0 tys
26 : jhr 3652 fun tysToString tys = String.concat["[", String.concatWithMap "," tyToString tys, "]" ]
27 : jhr 3461
28 :     (* required helper functions for the int type *)
29 :     fun sameint (i1 : int, i2) = (i1 = i2)
30 :     fun hashint i = Word.fromInt i
31 :     fun intToString i = Int.toString i
32 :    
33 :     (* required helper functions for the string type *)
34 :     fun samestring (s1 : string, s2) = (s1 = s2)
35 :     val hashstring = HashString.hashString
36 :     fun stringToString s = String.concat["\"", s, "\""]
37 :    
38 : jhr 3797 (* required helper functions for the shape type *)
39 :     type shape = TensorShape.t
40 :     val sameshape = TensorShape.same
41 :     val hashshape = TensorShape.hash
42 :     val shapeToString = TensorShape.toString
43 : jhr 3461
44 :     (* required helper functions for the index control type type *)
45 : jhr 3886 type idxctl = IndexCtl.t
46 : jhr 3461 val sameidxctl = IndexCtl.same
47 :     val hashidxctl = IndexCtl.hash
48 :     val idxctlToString = IndexCtl.toString
49 :    
50 :     @BODY@
51 :    
52 :     end
53 :    
54 : jhr 3475 structure MidIR = SSAFn(
55 : jhr 3508 val irName = "mid-ir"
56 : jhr 3475 structure Ty = MidTypes
57 : jhr 3461 structure Op = MidOps)
58 :    
59 : jhr 3475 structure MidCensus = CensusFn(MidIR)

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