SCM Repository
Annotation of /branches/vis15/src/compiler/gen/ir/high-ir.in
Parent Directory
|
Revision Log
Revision 3474 - (view) (download)
1 : | jhr | 3461 | (* high-il.sml |
2 : | * | ||
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 : | * High-level version of the Diderot IL. | ||
9 : | * | ||
10 : | * Note: this file is generated from gen/high-il.spec and gen/high-il.in. | ||
11 : | *) | ||
12 : | |||
13 : | structure HighOps = | ||
14 : | struct | ||
15 : | |||
16 : | (* required helper functions for types *) | ||
17 : | type ty = HighILTypes.ty | ||
18 : | val samety = HighILTypes.same | ||
19 : | val hashty = HighILTypes.hash | ||
20 : | val tyToString = HighILTypes.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.concatWith "," (List.map 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 mask type *) | ||
39 : | type mask = bool list | ||
40 : | val samemask : (mask * mask -> bool) = (op =) | ||
41 : | fun hashmask m = | ||
42 : | List.foldl (fn (false, w) => w+w | (true, w) => w+w+0w1) | ||
43 : | (Word.fromInt(List.length m)) m | ||
44 : | fun maskToString m = | ||
45 : | String.concat(List.map (fn true => "_" | false => ":") m) | ||
46 : | |||
47 : | (* required helper functions for the input type *) | ||
48 : | type input = ty Inputs.input | ||
49 : | val sameinput = Inputs.same | ||
50 : | val hashinput = Inputs.hash | ||
51 : | val inputToString = Inputs.toString | ||
52 : | |||
53 : | @BODY@ | ||
54 : | |||
55 : | end | ||
56 : | |||
57 : | structure HighIL = SSAFn( | ||
58 : | val ilName = "high-il" | ||
59 : | structure Ty = HighILTypes | ||
60 : | structure Op = HighOps) | ||
61 : | |||
62 : | structure HighILCensus = CensusFn(HighIL) | ||
63 : |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |