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

SCM Repository

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

Diff of /branches/vis15/src/compiler/tree-ir/tree-ops.sml

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

revision 3829, Thu May 5 21:05:37 2016 UTC revision 3830, Thu May 5 22:13:46 2016 UTC
# Line 14  Line 14 
14    struct    struct
15    
16    (* required helper functions for types *)    (* required helper functions for types *)
17      type ty = TreeTypes.t      type ty = TreeTypes.ty
18      val samety = TreeTypes.same      val samety = TreeTypes.same
19      val hashty = TreeTypes.hash      val hashty = TreeTypes.hash
20      val tyToString = TreeTypes.toString      val tyToString = TreeTypes.toString
# Line 70  Line 70 
70        | RMul        | RMul
71        | RDiv        | RDiv
72        | RNeg        | RNeg
73          | RClamp
74          | RLerp
75        | LT of ty        | LT of ty
76        | LTE of ty        | LTE of ty
77        | EQ of ty        | EQ of ty
# Line 80  Line 82 
82        | Abs of ty        | Abs of ty
83        | Max of ty        | Max of ty
84        | Min of ty        | Min of ty
       | Clamp of ty  
       | Lerp of ty  
85        | VAdd of int        | VAdd of int
86        | VSub of int        | VSub of int
87        | VScale of int        | VScale of int
88        | VMul of int        | VMul of int
89        | VNeg of int        | VNeg of int
90        | VSum of int        | VSum of int
91          | VClamp of int
92          | VMapClamp of int
93          | VLerp of int
94        | TensorIndex of ty * shape        | TensorIndex of ty * shape
95        | EigenVecs2x2        | EigenVecs2x2
96        | EigenVecs3x3        | EigenVecs3x3
# Line 146  Line 149 
149        | resultArity RMul = 1        | resultArity RMul = 1
150        | resultArity RDiv = 1        | resultArity RDiv = 1
151        | resultArity RNeg = 1        | resultArity RNeg = 1
152          | resultArity RClamp = 1
153          | resultArity RLerp = 1
154        | resultArity (LT _) = 1        | resultArity (LT _) = 1
155        | resultArity (LTE _) = 1        | resultArity (LTE _) = 1
156        | resultArity (EQ _) = 1        | resultArity (EQ _) = 1
# Line 156  Line 161 
161        | resultArity (Abs _) = 1        | resultArity (Abs _) = 1
162        | resultArity (Max _) = 1        | resultArity (Max _) = 1
163        | resultArity (Min _) = 1        | resultArity (Min _) = 1
       | resultArity (Clamp _) = 1  
       | resultArity (Lerp _) = 1  
164        | resultArity (VAdd _) = 1        | resultArity (VAdd _) = 1
165        | resultArity (VSub _) = 1        | resultArity (VSub _) = 1
166        | resultArity (VScale _) = 1        | resultArity (VScale _) = 1
167        | resultArity (VMul _) = 1        | resultArity (VMul _) = 1
168        | resultArity (VNeg _) = 1        | resultArity (VNeg _) = 1
169        | resultArity (VSum _) = 1        | resultArity (VSum _) = 1
170          | resultArity (VClamp _) = 1
171          | resultArity (VMapClamp _) = 1
172          | resultArity (VLerp _) = 1
173        | resultArity (TensorIndex _) = 1        | resultArity (TensorIndex _) = 1
174        | resultArity EigenVecs2x2 = 1        | resultArity EigenVecs2x2 = 1
175        | resultArity EigenVecs3x3 = 1        | resultArity EigenVecs3x3 = 1
# Line 222  Line 228 
228        | arity RMul = 2        | arity RMul = 2
229        | arity RDiv = 2        | arity RDiv = 2
230        | arity RNeg = 1        | arity RNeg = 1
231          | arity RClamp = 3
232          | arity RLerp = 3
233        | arity (LT _) = 2        | arity (LT _) = 2
234        | arity (LTE _) = 2        | arity (LTE _) = 2
235        | arity (EQ _) = 2        | arity (EQ _) = 2
# Line 232  Line 240 
240        | arity (Abs _) = 1        | arity (Abs _) = 1
241        | arity (Max _) = 2        | arity (Max _) = 2
242        | arity (Min _) = 2        | arity (Min _) = 2
       | arity (Clamp _) = 3  
       | arity (Lerp _) = 3  
243        | arity (VAdd _) = 2        | arity (VAdd _) = 2
244        | arity (VSub _) = 2        | arity (VSub _) = 2
245        | arity (VScale _) = 2        | arity (VScale _) = 2
246        | arity (VMul _) = 2        | arity (VMul _) = 2
247        | arity (VNeg _) = 2        | arity (VNeg _) = 2
248        | arity (VSum _) = 1        | arity (VSum _) = 1
249          | arity (VClamp _) = 3
250          | arity (VMapClamp _) = 3
251          | arity (VLerp _) = 3
252        | arity (TensorIndex _) = 1        | arity (TensorIndex _) = 1
253        | arity EigenVecs2x2 = 1        | arity EigenVecs2x2 = 1
254        | arity EigenVecs3x3 = 1        | arity EigenVecs3x3 = 1
# Line 304  Line 313 
313        | same (RMul, RMul) = true        | same (RMul, RMul) = true
314        | same (RDiv, RDiv) = true        | same (RDiv, RDiv) = true
315        | same (RNeg, RNeg) = true        | same (RNeg, RNeg) = true
316          | same (RClamp, RClamp) = true
317          | same (RLerp, RLerp) = true
318        | same (LT(a0), LT(b0)) = samety(a0, b0)        | same (LT(a0), LT(b0)) = samety(a0, b0)
319        | same (LTE(a0), LTE(b0)) = samety(a0, b0)        | same (LTE(a0), LTE(b0)) = samety(a0, b0)
320        | same (EQ(a0), EQ(b0)) = samety(a0, b0)        | same (EQ(a0), EQ(b0)) = samety(a0, b0)
# Line 314  Line 325 
325        | same (Abs(a0), Abs(b0)) = samety(a0, b0)        | same (Abs(a0), Abs(b0)) = samety(a0, b0)
326        | same (Max(a0), Max(b0)) = samety(a0, b0)        | same (Max(a0), Max(b0)) = samety(a0, b0)
327        | same (Min(a0), Min(b0)) = samety(a0, b0)        | same (Min(a0), Min(b0)) = samety(a0, b0)
       | same (Clamp(a0), Clamp(b0)) = samety(a0, b0)  
       | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)  
328        | same (VAdd(a0), VAdd(b0)) = sameint(a0, b0)        | same (VAdd(a0), VAdd(b0)) = sameint(a0, b0)
329        | same (VSub(a0), VSub(b0)) = sameint(a0, b0)        | same (VSub(a0), VSub(b0)) = sameint(a0, b0)
330        | same (VScale(a0), VScale(b0)) = sameint(a0, b0)        | same (VScale(a0), VScale(b0)) = sameint(a0, b0)
331        | same (VMul(a0), VMul(b0)) = sameint(a0, b0)        | same (VMul(a0), VMul(b0)) = sameint(a0, b0)
332        | same (VNeg(a0), VNeg(b0)) = sameint(a0, b0)        | same (VNeg(a0), VNeg(b0)) = sameint(a0, b0)
333        | same (VSum(a0), VSum(b0)) = sameint(a0, b0)        | same (VSum(a0), VSum(b0)) = sameint(a0, b0)
334          | same (VClamp(a0), VClamp(b0)) = sameint(a0, b0)
335          | same (VMapClamp(a0), VMapClamp(b0)) = sameint(a0, b0)
336          | same (VLerp(a0), VLerp(b0)) = sameint(a0, b0)
337        | same (TensorIndex(a0,a1), TensorIndex(b0,b1)) = samety(a0, b0) andalso sameshape(a1, b1)        | same (TensorIndex(a0,a1), TensorIndex(b0,b1)) = samety(a0, b0) andalso sameshape(a1, b1)
338        | same (EigenVecs2x2, EigenVecs2x2) = true        | same (EigenVecs2x2, EigenVecs2x2) = true
339        | same (EigenVecs3x3, EigenVecs3x3) = true        | same (EigenVecs3x3, EigenVecs3x3) = true
# Line 381  Line 393 
393        | hash RMul = 0w29        | hash RMul = 0w29
394        | hash RDiv = 0w31        | hash RDiv = 0w31
395        | hash RNeg = 0w37        | hash RNeg = 0w37
396        | hash (LT(a0)) = 0w41 + hashty a0        | hash RClamp = 0w41
397        | hash (LTE(a0)) = 0w43 + hashty a0        | hash RLerp = 0w43
398        | hash (EQ(a0)) = 0w47 + hashty a0        | hash (LT(a0)) = 0w47 + hashty a0
399        | hash (NEQ(a0)) = 0w53 + hashty a0        | hash (LTE(a0)) = 0w53 + hashty a0
400        | hash (GT(a0)) = 0w59 + hashty a0        | hash (EQ(a0)) = 0w59 + hashty a0
401        | hash (GTE(a0)) = 0w61 + hashty a0        | hash (NEQ(a0)) = 0w61 + hashty a0
402        | hash Not = 0w67        | hash (GT(a0)) = 0w67 + hashty a0
403        | hash (Abs(a0)) = 0w71 + hashty a0        | hash (GTE(a0)) = 0w71 + hashty a0
404        | hash (Max(a0)) = 0w73 + hashty a0        | hash Not = 0w73
405        | hash (Min(a0)) = 0w79 + hashty a0        | hash (Abs(a0)) = 0w79 + hashty a0
406        | hash (Clamp(a0)) = 0w83 + hashty a0        | hash (Max(a0)) = 0w83 + hashty a0
407        | hash (Lerp(a0)) = 0w89 + hashty a0        | hash (Min(a0)) = 0w89 + hashty a0
408        | hash (VAdd(a0)) = 0w97 + hashint a0        | hash (VAdd(a0)) = 0w97 + hashint a0
409        | hash (VSub(a0)) = 0w101 + hashint a0        | hash (VSub(a0)) = 0w101 + hashint a0
410        | hash (VScale(a0)) = 0w103 + hashint a0        | hash (VScale(a0)) = 0w103 + hashint a0
411        | hash (VMul(a0)) = 0w107 + hashint a0        | hash (VMul(a0)) = 0w107 + hashint a0
412        | hash (VNeg(a0)) = 0w109 + hashint a0        | hash (VNeg(a0)) = 0w109 + hashint a0
413        | hash (VSum(a0)) = 0w113 + hashint a0        | hash (VSum(a0)) = 0w113 + hashint a0
414        | hash (TensorIndex(a0,a1)) = 0w127 + hashty a0 + hashshape a1        | hash (VClamp(a0)) = 0w127 + hashint a0
415        | hash EigenVecs2x2 = 0w131        | hash (VMapClamp(a0)) = 0w131 + hashint a0
416        | hash EigenVecs3x3 = 0w137        | hash (VLerp(a0)) = 0w137 + hashint a0
417        | hash EigenVals2x2 = 0w139        | hash (TensorIndex(a0,a1)) = 0w139 + hashty a0 + hashshape a1
418        | hash EigenVals3x3 = 0w149        | hash EigenVecs2x2 = 0w149
419        | hash (Zero(a0)) = 0w151 + hashty a0        | hash EigenVecs3x3 = 0w151
420        | hash (Select(a0,a1)) = 0w157 + hashty a0 + hashint a1        | hash EigenVals2x2 = 0w157
421        | hash (Subscript(a0)) = 0w163 + hashty a0        | hash EigenVals3x3 = 0w163
422        | hash (MkDynamic(a0,a1)) = 0w167 + hashty a0 + hashint a1        | hash (Zero(a0)) = 0w167 + hashty a0
423        | hash (Append(a0)) = 0w173 + hashty a0        | hash (Select(a0,a1)) = 0w173 + hashty a0 + hashint a1
424        | hash (Prepend(a0)) = 0w179 + hashty a0        | hash (Subscript(a0)) = 0w179 + hashty a0
425        | hash (Concat(a0)) = 0w181 + hashty a0        | hash (MkDynamic(a0,a1)) = 0w181 + hashty a0 + hashint a1
426        | hash Range = 0w191        | hash (Append(a0)) = 0w191 + hashty a0
427        | hash (Length(a0)) = 0w193 + hashty a0        | hash (Prepend(a0)) = 0w193 + hashty a0
428        | hash (SphereQuery(a0,a1)) = 0w197 + hashty a0 + hashty a1        | hash (Concat(a0)) = 0w197 + hashty a0
429        | hash Sqrt = 0w199        | hash Range = 0w199
430        | hash Cos = 0w211        | hash (Length(a0)) = 0w211 + hashty a0
431        | hash ArcCos = 0w223        | hash (SphereQuery(a0,a1)) = 0w223 + hashty a0 + hashty a1
432        | hash Sine = 0w227        | hash Sqrt = 0w227
433        | hash ArcSin = 0w229        | hash Cos = 0w229
434        | hash Tan = 0w233        | hash ArcCos = 0w233
435        | hash ArcTan = 0w239        | hash Sine = 0w239
436        | hash Exp = 0w241        | hash ArcSin = 0w241
437        | hash (Ceiling(a0)) = 0w251 + hashint a0        | hash Tan = 0w251
438        | hash (Floor(a0)) = 0w257 + hashint a0        | hash ArcTan = 0w257
439        | hash (Round(a0)) = 0w263 + hashint a0        | hash Exp = 0w263
440        | hash (Trunc(a0)) = 0w269 + hashint a0        | hash (Ceiling(a0)) = 0w269 + hashint a0
441        | hash IntToReal = 0w271        | hash (Floor(a0)) = 0w271 + hashint a0
442        | hash (RealToInt(a0)) = 0w277 + hashint a0        | hash (Round(a0)) = 0w277 + hashint a0
443        | hash (R_All(a0)) = 0w281 + hashty a0        | hash (Trunc(a0)) = 0w281 + hashint a0
444        | hash (R_Exists(a0)) = 0w283 + hashty a0        | hash IntToReal = 0w283
445        | hash (R_Max(a0)) = 0w293 + hashty a0        | hash (RealToInt(a0)) = 0w293 + hashint a0
446        | hash (R_Min(a0)) = 0w307 + hashty a0        | hash (R_All(a0)) = 0w307 + hashty a0
447        | hash (R_Sum(a0)) = 0w311 + hashty a0        | hash (R_Exists(a0)) = 0w311 + hashty a0
448        | hash (R_Product(a0)) = 0w313 + hashty a0        | hash (R_Max(a0)) = 0w313 + hashty a0
449        | hash (R_Mean(a0)) = 0w317 + hashty a0        | hash (R_Min(a0)) = 0w317 + hashty a0
450        | hash (R_Variance(a0)) = 0w331 + hashty a0        | hash (R_Sum(a0)) = 0w331 + hashty a0
451        | hash (Transform(a0,a1)) = 0w337 + ImageInfo.hash a0 + hashint a1        | hash (R_Product(a0)) = 0w337 + hashty a0
452        | hash (Translate(a0)) = 0w347 + ImageInfo.hash a0        | hash (R_Mean(a0)) = 0w347 + hashty a0
453        | hash (BaseAddress(a0)) = 0w349 + ImageInfo.hash a0        | hash (R_Variance(a0)) = 0w349 + hashty a0
454        | hash (ControlIndex(a0,a1,a2)) = 0w353 + ImageInfo.hash a0 + hashidxctl a1 + hashint a2        | hash (Transform(a0,a1)) = 0w353 + ImageInfo.hash a0 + hashint a1
455        | hash (Inside(a0,a1)) = 0w359 + ImageInfo.hash a0 + hashint a1        | hash (Translate(a0)) = 0w359 + ImageInfo.hash a0
456        | hash (ImageDim(a0,a1)) = 0w367 + ImageInfo.hash a0 + hashint a1        | hash (BaseAddress(a0)) = 0w367 + ImageInfo.hash a0
457        | hash (LoadSeq(a0,a1)) = 0w373 + hashty a0 + hashstring a1        | hash (ControlIndex(a0,a1,a2)) = 0w373 + ImageInfo.hash a0 + hashidxctl a1 + hashint a2
458        | hash (LoadImage(a0,a1)) = 0w379 + hashty a0 + hashstring a1        | hash (Inside(a0,a1)) = 0w379 + ImageInfo.hash a0 + hashint a1
459        | hash (MathFn(a0)) = 0w383 + MathFns.hash a0        | hash (ImageDim(a0,a1)) = 0w383 + ImageInfo.hash a0 + hashint a1
460          | hash (LoadSeq(a0,a1)) = 0w389 + hashty a0 + hashstring a1
461          | hash (LoadImage(a0,a1)) = 0w397 + hashty a0 + hashstring a1
462          | hash (MathFn(a0)) = 0w401 + MathFns.hash a0
463    
464      fun toString IAdd = "IAdd"      fun toString IAdd = "IAdd"
465        | toString ISub = "ISub"        | toString ISub = "ISub"
# Line 457  Line 472 
472        | toString RMul = "RMul"        | toString RMul = "RMul"
473        | toString RDiv = "RDiv"        | toString RDiv = "RDiv"
474        | toString RNeg = "RNeg"        | toString RNeg = "RNeg"
475          | toString RClamp = "RClamp"
476          | toString RLerp = "RLerp"
477        | toString (LT(a0)) = concat["LT<", tyToString a0, ">"]        | toString (LT(a0)) = concat["LT<", tyToString a0, ">"]
478        | toString (LTE(a0)) = concat["LTE<", tyToString a0, ">"]        | toString (LTE(a0)) = concat["LTE<", tyToString a0, ">"]
479        | toString (EQ(a0)) = concat["EQ<", tyToString a0, ">"]        | toString (EQ(a0)) = concat["EQ<", tyToString a0, ">"]
# Line 467  Line 484 
484        | toString (Abs(a0)) = concat["Abs<", tyToString a0, ">"]        | toString (Abs(a0)) = concat["Abs<", tyToString a0, ">"]
485        | toString (Max(a0)) = concat["Max<", tyToString a0, ">"]        | toString (Max(a0)) = concat["Max<", tyToString a0, ">"]
486        | toString (Min(a0)) = concat["Min<", tyToString a0, ">"]        | toString (Min(a0)) = concat["Min<", tyToString a0, ">"]
       | toString (Clamp(a0)) = concat["Clamp<", tyToString a0, ">"]  
       | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]  
487        | toString (VAdd(a0)) = concat["VAdd<", intToString a0, ">"]        | toString (VAdd(a0)) = concat["VAdd<", intToString a0, ">"]
488        | toString (VSub(a0)) = concat["VSub<", intToString a0, ">"]        | toString (VSub(a0)) = concat["VSub<", intToString a0, ">"]
489        | toString (VScale(a0)) = concat["VScale<", intToString a0, ">"]        | toString (VScale(a0)) = concat["VScale<", intToString a0, ">"]
490        | toString (VMul(a0)) = concat["VMul<", intToString a0, ">"]        | toString (VMul(a0)) = concat["VMul<", intToString a0, ">"]
491        | toString (VNeg(a0)) = concat["VNeg<", intToString a0, ">"]        | toString (VNeg(a0)) = concat["VNeg<", intToString a0, ">"]
492        | toString (VSum(a0)) = concat["VSum<", intToString a0, ">"]        | toString (VSum(a0)) = concat["VSum<", intToString a0, ">"]
493          | toString (VClamp(a0)) = concat["VClamp<", intToString a0, ">"]
494          | toString (VMapClamp(a0)) = concat["VMapClamp<", intToString a0, ">"]
495          | toString (VLerp(a0)) = concat["VLerp<", intToString a0, ">"]
496        | toString (TensorIndex(a0,a1)) = concat["TensorIndex<", tyToString a0, ",", shapeToString a1, ">"]        | toString (TensorIndex(a0,a1)) = concat["TensorIndex<", tyToString a0, ",", shapeToString a1, ">"]
497        | toString EigenVecs2x2 = "EigenVecs2x2"        | toString EigenVecs2x2 = "EigenVecs2x2"
498        | toString EigenVecs3x3 = "EigenVecs3x3"        | toString EigenVecs3x3 = "EigenVecs3x3"

Legend:
Removed from v.3829  
changed lines
  Added in v.3830

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