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/tree-ops.in
ViewVC logotype

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3832 - (view) (download)

1 : jhr 3755 (* tree-ops.sml
2 :     *
3 :     * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     *
5 :     * COPYRIGHT (c) 2016 The University of Chicago
6 :     * All rights reserved.
7 :     *
8 :     * Operators for Tree IR.
9 :     *
10 :     * Note: this file is generated from gen/ir/tree-ops.spec and gen/ir/tree-ops.in.
11 :     *)
12 :    
13 :     structure TreeOps =
14 :     struct
15 :    
16 :     (* required helper functions for types *)
17 : jhr 3832 type ty = TreeTypes.t
18 : jhr 3755 val samety = TreeTypes.same
19 :     val hashty = TreeTypes.hash
20 :     val tyToString = TreeTypes.toString
21 :    
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 :     fun tysToString tys = String.concat["[", String.concatWithMap "," tyToString tys, "]" ]
27 :    
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 :     (* required helper functions for the shape type *)
39 :     type shape = int list
40 :     val sameshape : (shape * shape -> bool) = (op =)
41 :     fun hashshape shp =
42 :     List.foldl (fn (i, w) => Word.xorb(Word.<<(w, 0w1), Word.fromInt i))
43 :     (Word.fromInt(List.length shp)) shp
44 :     fun shapeToString shp = String.concat["[", String.concatWithMap "," Int.toString shp, "]"]
45 :    
46 :     (* required helper functions for the mask type *)
47 :     type mask = bool list
48 :     val samemask : (mask * mask -> bool) = (op =)
49 :     fun hashmask m =
50 :     List.foldl (fn (false, w) => w+w | (true, w) => w+w+0w1)
51 :     (Word.fromInt(List.length m)) m
52 :     fun maskToString m =
53 :     String.concat(List.map (fn true => "_" | false => ":") m)
54 :    
55 :     (* required helper functions for the index control type type *)
56 :     type idxctl = IndexCtl.ctl
57 :     val sameidxctl = IndexCtl.same
58 :     val hashidxctl = IndexCtl.hash
59 :     val idxctlToString = IndexCtl.toString
60 :    
61 :     @BODY@
62 :    
63 :     end

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