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

SCM Repository

[diderot] Annotation of /branches/charisee/src/compiler/gen/il/high-il.in
ViewVC logotype

Annotation of /branches/charisee/src/compiler/gen/il/high-il.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2377 - (view) (download)

1 : jhr 186 (* high-il.sml
2 :     *
3 : jhr 435 * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 : jhr 186 * All rights reserved.
5 :     *
6 :     * High-level version of the Diderot IL.
7 :     *
8 :     * Note: this file is generated from gen/high-il.spec and gen/high-il.in.
9 :     *)
10 :    
11 :     structure HighOps =
12 :     struct
13 :    
14 : jhr 1640 (* required helper functions for types *)
15 : jhr 392 type ty = HighILTypes.ty
16 :     val samety = HighILTypes.same
17 :     val hashty = HighILTypes.hash
18 :     val tyToString = HighILTypes.toString
19 : jhr 186
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 :     fun sameint (i1 : int, i2) = (i1 = i2)
28 :     fun hashint i = Word.fromInt i
29 :     fun intToString i = Int.toString i
30 :    
31 : jhr 336 (* required helper functions for the string type *)
32 : jhr 226 fun samestring (s1 : string, s2) = (s1 = s2)
33 :     val hashstring = HashString.hashString
34 :     fun stringToString s = String.concat["\"", s, "\""]
35 :    
36 : jhr 401 (* required helper functions for the mask type *)
37 : jhr 400 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 186 @BODY@
46 :    
47 :     end
48 :    
49 : jhr 392 structure HighIL = SSAFn(
50 : jhr 1232 val ilName = "high-il"
51 : jhr 392 structure Ty = HighILTypes
52 :     structure Op = HighOps)
53 : jhr 1116
54 :     structure HighILCensus = CensusFn(HighIL)
55 :    

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