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

SCM Repository

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

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

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

revision 1685, Sun Jan 22 15:23:36 2012 UTC revision 1689, Wed Jan 25 14:55:43 2012 UTC
# Line 15  Line 15 
15        | TensorTy of int list            (* tensor types, which include reals, sequences of reals, etc. *)        | TensorTy of int list            (* tensor types, which include reals, sequences of reals, etc. *)
16        | TupleTy of ty list              (* tuples; used for multiple return values *)        | TupleTy of ty list              (* tuples; used for multiple return values *)
17        | SeqTy of ty * int        | SeqTy of ty * int
18          | DynSeqTy of ty
19        | AddrTy of ImageInfo.info        (* voxel address *)        | AddrTy of ImageInfo.info        (* voxel address *)
20        | ImageTy of ImageInfo.info        | ImageTy of ImageInfo.info
21    
# Line 36  Line 37 
37        | same (TensorTy dd1, TensorTy dd2) = (dd1 = dd2)        | same (TensorTy dd1, TensorTy dd2) = (dd1 = dd2)
38        | same (TupleTy tys1, TupleTy tys2) = ListPair.allEq same (tys1, tys2)        | same (TupleTy tys1, TupleTy tys2) = ListPair.allEq same (tys1, tys2)
39        | same (SeqTy(ty1, n1), SeqTy(ty2, n2)) = (n1 = n2) andalso same(ty1, ty2)        | same (SeqTy(ty1, n1), SeqTy(ty2, n2)) = (n1 = n2) andalso same(ty1, ty2)
40          | same (DynSeqTy ty1, DynSeqTy ty2) = same(ty1, ty2)
41        | same (AddrTy info1, AddrTy info2) = ImageInfo.same(info1, info2)        | same (AddrTy info1, AddrTy info2) = ImageInfo.same(info1, info2)
42        | same (ImageTy info1, ImageTy info2) = ImageInfo.same(info1, info2)        | same (ImageTy info1, ImageTy info2) = ImageInfo.same(info1, info2)
43        | same _ = false        | same _ = false
# Line 46  Line 48 
48        | hash (TensorTy dd) = List.foldl (fn (d, s) => 0w11 * Word.fromInt d + s) 0w4 dd        | hash (TensorTy dd) = List.foldl (fn (d, s) => 0w11 * Word.fromInt d + s) 0w4 dd
49        | hash (TupleTy tys) = List.foldl (fn (ty, s) => hash ty + s) 0w7 tys        | hash (TupleTy tys) = List.foldl (fn (ty, s) => hash ty + s) 0w7 tys
50        | hash (SeqTy(ty, n)) = Word.fromInt n * hash ty + 0w11        | hash (SeqTy(ty, n)) = Word.fromInt n * hash ty + 0w11
51        | hash (AddrTy info) = 0w5 + ImageInfo.hash info        | hash (DynSeqTy ty) = hash ty + 0w13
52        | hash (ImageTy info) = 0w13 * ImageInfo.hash info + 0w6        | hash (AddrTy info) = 0w17 + ImageInfo.hash info
53          | hash (ImageTy info) = 0w19 * ImageInfo.hash info + 0w6
54    
55      fun toString BoolTy = "bool"      fun toString BoolTy = "bool"
56        | toString StringTy = "string"        | toString StringTy = "string"
# Line 61  Line 64 
64              "(", String.concatWith " * " (List.map toString tys), ")"              "(", String.concatWith " * " (List.map toString tys), ")"
65            ]            ]
66        | toString (SeqTy(ty, n)) = concat[toString ty, "{", Int.toString n, "}"]        | toString (SeqTy(ty, n)) = concat[toString ty, "{", Int.toString n, "}"]
67          | toString (DynSeqTy ty) = toString ty ^ "{}"
68        | toString (AddrTy info) = concat["addr(", ImageInfo.toString info, ")"]        | toString (AddrTy info) = concat["addr(", ImageInfo.toString info, ")"]
69        | toString (ImageTy info) = concat["image(", ImageInfo.toString info, ")"]        | toString (ImageTy info) = concat["image(", ImageInfo.toString info, ")"]
70    

Legend:
Removed from v.1685  
changed lines
  Added in v.1689

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