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 391 - (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 :    
17 :     val intTy = IVecTy 0
18 :     val realTy = VecTy 0
19 :    
20 :     fun same (ty1 : ty, ty2) = (ty1 = ty2)
21 :    
22 :     fun hash BoolTy = 0w1
23 :     | hash StringTy = 0w2
24 :     | hash (IVecTy d) = 0w7 * Word.fromInt d + 0w3
25 :     | hash (VecTy d) = 0w11 * Word.fromInt d + 0w4
26 :    
27 :     fun toString BoolTy = "bool"
28 :     | toString StringTy = "string"
29 :     | toString (IVecTy 0) = "int"
30 :     | toString (IVecTy d) = "int" ^ Int.toString d
31 :     | toString (VecTy 0) = "real"
32 :     | toString (VecTy d) = "real" ^ Int.toString d
33 :    
34 :    
35 :     end

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