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

SCM Repository

[diderot] Annotation of /branches/vis12-cl/src/compiler/gen/il/mid-il.in
ViewVC logotype

Annotation of /branches/vis12-cl/src/compiler/gen/il/mid-il.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3081 - (view) (download)

1 : jhr 266 (* mid-il.sml
2 :     *
3 : jhr 435 * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 : jhr 266 * All rights reserved.
5 :     *
6 :     * Middle-level version of the Diderot IL.
7 :     *
8 :     * Note: this file is generated from gen/mid-il.spec and gen/mid-il.in.
9 :     *)
10 :    
11 :     structure MidOps =
12 :     struct
13 :    
14 : jhr 1640 (* required helper functions for types *)
15 : jhr 391 type ty = MidILTypes.ty
16 :     val samety = MidILTypes.same
17 :     val hashty = MidILTypes.hash
18 :     val tyToString = MidILTypes.toString
19 : jhr 328
20 : jhr 1640 (* required helper functions for type lists *)
21 :     type tys = ty list
22 :     fun sametys (tys1, tys2) = ListPair.allEq samety (tys1, tys2)
23 :     fun hashtys tys = List.foldl (fn (ty, s) => hashty ty + 0w3 * s) 0w0 tys
24 :     fun tysToString tys = String.concat["[", String.concatWith "," (List.map tyToString tys), "]" ]
25 :    
26 : jhr 1116 (* required helper functions for the int type *)
27 : jhr 332 fun sameint (i1 : int, i2) = (i1 = i2)
28 :     fun hashint i = Word.fromInt i
29 :     fun intToString i = Int.toString i
30 :    
31 : jhr 1116 (* required helper functions for the string type *)
32 : jhr 266 fun samestring (s1 : string, s2) = (s1 = s2)
33 :     val hashstring = HashString.hashString
34 :     fun stringToString s = String.concat["\"", s, "\""]
35 :    
36 : jhr 2825 (* required helper functions for the mask type *)
37 :     type mask = bool list
38 :     val samemask : (mask * mask -> bool) = (op =)
39 :     fun hashmask m =
40 :     List.foldl (fn (false, w) => w+w | (true, w) => w+w+0w1)
41 :     (Word.fromInt(List.length m)) m
42 :     fun maskToString m =
43 :     String.concat(List.map (fn true => "_" | false => ":") m)
44 :    
45 : jhr 2011 (* required helper functions for the input type *)
46 :     type input = ty Inputs.input
47 :     val sameinput = Inputs.same
48 :     val hashinput = Inputs.hash
49 :     val inputToString = Inputs.toString
50 :    
51 : jhr 3081 (* required helper functions for the index control type type *)
52 :     type idxctl = IndexCtl.ctl
53 :     val sameidxctl = IndexCtl.same
54 :     val hashidxctl = IndexCtl.hash
55 :     val idxctlToString = IndexCtl.toString
56 :    
57 : jhr 266 @BODY@
58 :    
59 :     end
60 :    
61 : jhr 392 structure MidIL = SSAFn(
62 : jhr 1232 val ilName = "mid-il"
63 : jhr 392 structure Ty = MidILTypes
64 :     structure Op = MidOps)
65 : jhr 1116
66 :     structure MidILCensus = CensusFn(MidIL)
67 :    

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