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

SCM Repository

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

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

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

revision 517, Thu Feb 10 11:45:00 2011 UTC revision 548, Thu Feb 17 22:41:53 2011 UTC
# Line 10  Line 10 
10      datatype ty      datatype ty
11        = BoolTy | StringTy | IntTy        = BoolTy | StringTy | IntTy
12        | TensorTy of int list        | TensorTy of int list
13        | ImageTy of int          (* parameter is dimension *)        | ImageTy of int
14        | KernelTy        | KernelTy
15        | FieldTy        | FieldTy
16          | AnyTy           (* this is used in checking when we can't figure out the type *)
17    
18      val intTy = IntTy      val intTy = IntTy
19      val realTy = TensorTy[]      val realTy = TensorTy[]
# Line 21  Line 22 
22    (* smart constructor for tensor type that prunes out dimensions with size 1 *)    (* smart constructor for tensor type that prunes out dimensions with size 1 *)
23      fun tensorTy dd = TensorTy(List.mapPartial (fn 1 => NONE | d => SOME d) dd)      fun tensorTy dd = TensorTy(List.mapPartial (fn 1 => NONE | d => SOME d) dd)
24    
25      fun same (ty1 : ty, ty2) = (ty1 = ty2)      fun same (AnyTy, _) = true
26          | same (_, AnyTy) = true
27          | same (BoolTy, BoolTy) = true
28          | same (StringTy, StringTy) = true
29          | same (IntTy, IntTy) = true
30          | same (TensorTy dd1, TensorTy dd2) = (dd1 = dd2)
31          | same (ImageTy d1, ImageTy d2) = (d1 = d2)
32          | same (KernelTy, KernelTy) = true
33          | same (FieldTy, FieldTy) = true
34          | same _ = false
35    
36      fun hash BoolTy = 0w1      fun hash BoolTy = 0w1
37        | hash StringTy = 0w2        | hash StringTy = 0w2
# Line 30  Line 40 
40        | hash (ImageTy d) = 0w5 + 0w3 * Word.fromInt d        | hash (ImageTy d) = 0w5 + 0w3 * Word.fromInt d
41        | hash KernelTy = 0w6        | hash KernelTy = 0w6
42        | hash FieldTy = 0w7        | hash FieldTy = 0w7
43          | hash AnyTy = raise Fail "hash(AnyTy)"
44    
45      fun toString BoolTy = "bool"      fun toString BoolTy = "bool"
46        | toString StringTy = "string"        | toString StringTy = "string"
# Line 41  Line 52 
52        | toString (ImageTy d) = String.concat["image", Int.toString d, "D"]        | toString (ImageTy d) = String.concat["image", Int.toString d, "D"]
53        | toString KernelTy = "kernel"        | toString KernelTy = "kernel"
54        | toString FieldTy = "field"        | toString FieldTy = "field"
55          | toString AnyTy = "**any**"
56    
57    end    end

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

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