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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/mid-ir/mid-ir.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/mid-ir/mid-ir.sml

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

revision 3774, Tue Apr 26 20:03:28 2016 UTC revision 3797, Mon May 2 21:10:12 2016 UTC
# Line 35  Line 35 
35      val hashstring = HashString.hashString      val hashstring = HashString.hashString
36      fun stringToString s = String.concat["\"", s, "\""]      fun stringToString s = String.concat["\"", s, "\""]
37    
38    (* required helper functions for the mask type *)    (* required helper functions for the shape type *)
39      type mask = bool list      type shape = TensorShape.t
40      val samemask : (mask * mask -> bool) = (op =)      val sameshape = TensorShape.same
41      fun hashmask m =      val hashshape = TensorShape.hash
42            List.foldl (fn (false, w) => w+w | (true, w) => w+w+0w1)      val shapeToString = TensorShape.toString
             (Word.fromInt(List.length m)) m  
     fun maskToString m =  
           String.concat(List.map (fn true => "_" | false => ":") m)  
43    
44    (* required helper functions for the index control type type *)    (* required helper functions for the index control type type *)
45      type idxctl = IndexCtl.ctl      type idxctl = IndexCtl.ctl
# Line 69  Line 66 
66        | Min of ty        | Min of ty
67        | Clamp of ty        | Clamp of ty
68        | Lerp of ty        | Lerp of ty
69          | TensorIndex of ty * shape
70        | EigenVecs2x2        | EigenVecs2x2
71        | EigenVecs3x3        | EigenVecs3x3
72        | EigenVals2x2        | EigenVals2x2
73        | EigenVals3x3        | EigenVals3x3
74        | Zero of ty        | Zero of ty
75        | Select of ty * int        | Select of ty * int
       | Index of ty * int  
76        | Subscript of ty        | Subscript of ty
77        | MkDynamic of ty * int        | MkDynamic of ty * int
78        | Append of ty        | Append of ty
# Line 134  Line 131 
131        | resultArity (Min _) = 1        | resultArity (Min _) = 1
132        | resultArity (Clamp _) = 1        | resultArity (Clamp _) = 1
133        | resultArity (Lerp _) = 1        | resultArity (Lerp _) = 1
134          | resultArity (TensorIndex _) = 1
135        | resultArity EigenVecs2x2 = 1        | resultArity EigenVecs2x2 = 1
136        | resultArity EigenVecs3x3 = 1        | resultArity EigenVecs3x3 = 1
137        | resultArity EigenVals2x2 = 1        | resultArity EigenVals2x2 = 1
138        | resultArity EigenVals3x3 = 1        | resultArity EigenVals3x3 = 1
139        | resultArity (Zero _) = 1        | resultArity (Zero _) = 1
140        | resultArity (Select _) = 1        | resultArity (Select _) = 1
       | resultArity (Index _) = 1  
141        | resultArity (Subscript _) = 1        | resultArity (Subscript _) = 1
142        | resultArity (MkDynamic _) = 1        | resultArity (MkDynamic _) = 1
143        | resultArity (Append _) = 2        | resultArity (Append _) = 2
# Line 199  Line 196 
196        | arity (Min _) = 2        | arity (Min _) = 2
197        | arity (Clamp _) = 3        | arity (Clamp _) = 3
198        | arity (Lerp _) = 3        | arity (Lerp _) = 3
199          | arity (TensorIndex _) = 1
200        | arity EigenVecs2x2 = 1        | arity EigenVecs2x2 = 1
201        | arity EigenVecs3x3 = 1        | arity EigenVecs3x3 = 1
202        | arity EigenVals2x2 = 1        | arity EigenVals2x2 = 1
203        | arity EigenVals3x3 = 1        | arity EigenVals3x3 = 1
204        | arity (Zero _) = 0        | arity (Zero _) = 0
205        | arity (Select _) = 1        | arity (Select _) = 1
       | arity (Index _) = 1  
206        | arity (Subscript _) = 2        | arity (Subscript _) = 2
207        | arity (MkDynamic _) = 1        | arity (MkDynamic _) = 1
208        | arity (Append _) = 1        | arity (Append _) = 1
# Line 271  Line 268 
268        | same (Min(a0), Min(b0)) = samety(a0, b0)        | same (Min(a0), Min(b0)) = samety(a0, b0)
269        | same (Clamp(a0), Clamp(b0)) = samety(a0, b0)        | same (Clamp(a0), Clamp(b0)) = samety(a0, b0)
270        | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)        | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)
271          | same (TensorIndex(a0,a1), TensorIndex(b0,b1)) = samety(a0, b0) andalso sameshape(a1, b1)
272        | same (EigenVecs2x2, EigenVecs2x2) = true        | same (EigenVecs2x2, EigenVecs2x2) = true
273        | same (EigenVecs3x3, EigenVecs3x3) = true        | same (EigenVecs3x3, EigenVecs3x3) = true
274        | same (EigenVals2x2, EigenVals2x2) = true        | same (EigenVals2x2, EigenVals2x2) = true
275        | same (EigenVals3x3, EigenVals3x3) = true        | same (EigenVals3x3, EigenVals3x3) = true
276        | same (Zero(a0), Zero(b0)) = samety(a0, b0)        | same (Zero(a0), Zero(b0)) = samety(a0, b0)
277        | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)        | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
       | same (Index(a0,a1), Index(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)  
278        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)
279        | same (MkDynamic(a0,a1), MkDynamic(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)        | same (MkDynamic(a0,a1), MkDynamic(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
280        | same (Append(a0), Append(b0)) = samety(a0, b0)        | same (Append(a0), Append(b0)) = samety(a0, b0)
# Line 337  Line 334 
334        | hash (Min(a0)) = 0w59 + hashty a0        | hash (Min(a0)) = 0w59 + hashty a0
335        | hash (Clamp(a0)) = 0w61 + hashty a0        | hash (Clamp(a0)) = 0w61 + hashty a0
336        | hash (Lerp(a0)) = 0w67 + hashty a0        | hash (Lerp(a0)) = 0w67 + hashty a0
337        | hash EigenVecs2x2 = 0w71        | hash (TensorIndex(a0,a1)) = 0w71 + hashty a0 + hashshape a1
338        | hash EigenVecs3x3 = 0w73        | hash EigenVecs2x2 = 0w73
339        | hash EigenVals2x2 = 0w79        | hash EigenVecs3x3 = 0w79
340        | hash EigenVals3x3 = 0w83        | hash EigenVals2x2 = 0w83
341        | hash (Zero(a0)) = 0w89 + hashty a0        | hash EigenVals3x3 = 0w89
342        | hash (Select(a0,a1)) = 0w97 + hashty a0 + hashint a1        | hash (Zero(a0)) = 0w97 + hashty a0
343        | hash (Index(a0,a1)) = 0w101 + hashty a0 + hashint a1        | hash (Select(a0,a1)) = 0w101 + hashty a0 + hashint a1
344        | hash (Subscript(a0)) = 0w103 + hashty a0        | hash (Subscript(a0)) = 0w103 + hashty a0
345        | hash (MkDynamic(a0,a1)) = 0w107 + hashty a0 + hashint a1        | hash (MkDynamic(a0,a1)) = 0w107 + hashty a0 + hashint a1
346        | hash (Append(a0)) = 0w109 + hashty a0        | hash (Append(a0)) = 0w109 + hashty a0
# Line 402  Line 399 
399        | toString (Min(a0)) = concat["Min<", tyToString a0, ">"]        | toString (Min(a0)) = concat["Min<", tyToString a0, ">"]
400        | toString (Clamp(a0)) = concat["Clamp<", tyToString a0, ">"]        | toString (Clamp(a0)) = concat["Clamp<", tyToString a0, ">"]
401        | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]        | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]
402          | toString (TensorIndex(a0,a1)) = concat["TensorIndex<", tyToString a0, ",", shapeToString a1, ">"]
403        | toString EigenVecs2x2 = "EigenVecs2x2"        | toString EigenVecs2x2 = "EigenVecs2x2"
404        | toString EigenVecs3x3 = "EigenVecs3x3"        | toString EigenVecs3x3 = "EigenVecs3x3"
405        | toString EigenVals2x2 = "EigenVals2x2"        | toString EigenVals2x2 = "EigenVals2x2"
406        | toString EigenVals3x3 = "EigenVals3x3"        | toString EigenVals3x3 = "EigenVals3x3"
407        | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]        | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]
408        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]
       | toString (Index(a0,a1)) = concat["Index<", tyToString a0, ",", intToString a1, ">"]  
409        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]
410        | toString (MkDynamic(a0,a1)) = concat["MkDynamic<", tyToString a0, ",", intToString a1, ">"]        | toString (MkDynamic(a0,a1)) = concat["MkDynamic<", tyToString a0, ",", intToString a1, ">"]
411        | toString (Append(a0)) = concat["Append<", tyToString a0, ">"]        | toString (Append(a0)) = concat["Append<", tyToString a0, ">"]

Legend:
Removed from v.3774  
changed lines
  Added in v.3797

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