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

SCM Repository

[diderot] Annotation of /trunk/src/compiler/mid-il/mid-il-types.sml
ViewVC logotype

Annotation of /trunk/src/compiler/mid-il/mid-il-types.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 427 - (view) (download)

1 : jhr 391 (* mid-il-types.sml
2 :     *
3 :     * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *
6 :     * Types for the MidIL.
7 :     *)
8 :    
9 :     structure MidILTypes =
10 :     struct
11 :    
12 :     datatype ty
13 :     = BoolTy | StringTy
14 :     | IVecTy of int (* integers; both scalars and vectors *)
15 :     | VecTy of int (* reals; both scalars and vectors *)
16 : jhr 394 | AddrTy (* voxel address *)
17 : jhr 397 | ImageTy
18 : jhr 391
19 : jhr 427 val intTy = IVecTy 1
20 :     val realTy = VecTy 1
21 : jhr 391
22 :     fun same (ty1 : ty, ty2) = (ty1 = ty2)
23 :    
24 :     fun hash BoolTy = 0w1
25 :     | hash StringTy = 0w2
26 :     | hash (IVecTy d) = 0w7 * Word.fromInt d + 0w3
27 :     | hash (VecTy d) = 0w11 * Word.fromInt d + 0w4
28 : jhr 394 | hash AddrTy = 0w5
29 : jhr 397 | hash ImageTy = 0w6
30 : jhr 391
31 :     fun toString BoolTy = "bool"
32 :     | toString StringTy = "string"
33 : jhr 427 | toString (IVecTy 1) = "int"
34 : jhr 391 | toString (IVecTy d) = "int" ^ Int.toString d
35 : jhr 427 | toString (VecTy 1) = "real"
36 : jhr 391 | toString (VecTy d) = "real" ^ Int.toString d
37 : jhr 394 | toString AddrTy = "addr"
38 : jhr 397 | toString ImageTy = "image"
39 : jhr 391
40 :     end

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