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 394, Thu Oct 14 16:30:29 2010 UTC revision 426, Mon Oct 18 18:49:55 2010 UTC
# Line 12  Line 12 
12        | TensorTy of int list        | TensorTy of int list
13        | KernelTy | ImageTy | FieldTy        | KernelTy | ImageTy | FieldTy
14    
15        val intTy = IntTy
16        val realTy = TensorTy[]
17        val vec3Ty = TensorTy[3]
18    
19      (* smart constructor for tensor type that prunes out dimensions with size 1 *)
20        fun tensorTy dd = TensorTy(List.mapPartial (fn 1 => NONE | d => SOME d) dd)
21    
22      fun same (ty1 : ty, ty2) = (ty1 = ty2)      fun same (ty1 : ty, ty2) = (ty1 = ty2)
23    
24      fun hash BoolTy = 0w1      fun hash BoolTy = 0w1
25        | hash StringTy = 0w2        | hash StringTy = 0w2
26        | hash IntTy = 0w3        | hash IntTy = 0w3
27        | hash (TensorTy dd) = List.foldl (fn (d, s) => Word.fromInt d + s) 0w4 dd        | hash (TensorTy dd) = List.foldl (fn (d, s) => Word.fromInt d + s) 0w4 dd
28          | hash KernelTy = 0w5
29          | hash ImageTy = 0w6
30          | hash FieldTy = 0w7
31    
32      fun toString BoolTy = "bool"      fun toString BoolTy = "bool"
33        | toString StringTy = "string"        | toString StringTy = "string"
# Line 26  Line 36 
36        | toString (TensorTy dd) = String.concat[        | toString (TensorTy dd) = String.concat[
37              "tensor[", String.concatWith "," (List.map Int.toString dd), "]"              "tensor[", String.concatWith "," (List.map Int.toString dd), "]"
38            ]            ]
39          | toString KernelTy = "kernel"
40          | toString ImageTy = "image"
41          | toString FieldTy = "field"
42    
43    end    end

Legend:
Removed from v.394  
changed lines
  Added in v.426

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