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

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/compiler/mid-il/mid-il-types.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/mid-il/mid-il-types.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 547, Thu Feb 17 14:57:07 2011 UTC revision 548, Thu Feb 17 22:41:53 2011 UTC
# Line 13  Line 13 
13        = BoolTy | StringTy        = BoolTy | StringTy
14        | IVecTy of int           (* integers; both scalars and vectors *)        | IVecTy of int           (* integers; both scalars and vectors *)
15        | VecTy of int            (* reals; both scalars and vectors *)        | VecTy of int            (* reals; both scalars and vectors *)
16        | AddrTy                  (* voxel address *)        | AddrTy of ImageInfo.info (* voxel address *)
17        | ImageTy        | ImageTy of ImageInfo.info
18    
19      val intTy = IVecTy 1      val intTy = IVecTy 1
20      val realTy = VecTy 1      val realTy = VecTy 1
21    
22      fun same (ty1 : ty, ty2) = (ty1 = ty2)      fun same (BoolTy, BoolTy) = true
23          | same (StringTy, StringTy) = true
24          | same (IVecTy n1, IVecTy n2) = (n1 = n2)
25          | same (VecTy n1, VecTy n2) = (n1 = n2)
26          | same (AddrTy info1, AddrTy info2) = ImageInfo.same(info1, info2)
27          | same (ImageTy info1, ImageTy info2) = ImageInfo.same(info1, info2)
28          | same _ = false
29    
30      fun hash BoolTy = 0w1      fun hash BoolTy = 0w1
31        | hash StringTy = 0w2        | hash StringTy = 0w2
32        | hash (IVecTy d) = 0w7 * Word.fromInt d + 0w3        | hash (IVecTy d) = 0w7 * Word.fromInt d + 0w3
33        | hash (VecTy d) = 0w11 * Word.fromInt d + 0w4        | hash (VecTy d) = 0w11 * Word.fromInt d + 0w4
34        | hash AddrTy = 0w5        | hash (AddrTy info) = 0w5 + ImageInfo.hash info
35        | hash ImageTy = 0w6        | hash (ImageTy info) = 0w13 * ImageInfo.hash info + 0w6
36    
37      fun toString BoolTy = "bool"      fun toString BoolTy = "bool"
38        | toString StringTy = "string"        | toString StringTy = "string"
# Line 34  Line 40 
40        | toString (IVecTy d) = "int" ^ Int.toString d        | toString (IVecTy d) = "int" ^ Int.toString d
41        | toString (VecTy 1) = "real"        | toString (VecTy 1) = "real"
42        | toString (VecTy d) = "real" ^ Int.toString d        | toString (VecTy d) = "real" ^ Int.toString d
43        | toString AddrTy = "addr"        | toString (AddrTy info) = concat["addr(", ImageInfo.toString info, ")"]
44        | toString ImageTy = "image"        | toString (ImageTy info) = concat["image(", ImageInfo.toString info, ")"]
45    
46    end    end

Legend:
Removed from v.547  
changed lines
  Added in v.548

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