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 3511, Fri Dec 18 17:43:38 2015 UTC revision 3529, Tue Dec 22 18:25:22 2015 UTC
# Line 69  Line 69 
69        | Min of ty        | Min of ty
70        | Clamp of ty        | Clamp of ty
71        | Lerp of ty        | Lerp of ty
72          | Dist of ty
73        | Normalize of int        | Normalize of int
74        | PrincipleEvec of ty        | PrincipleEvec of ty
75        | EigenVecs2x2        | EigenVecs2x2
# Line 85  Line 86 
86        | Concat of ty        | Concat of ty
87        | Range        | Range
88        | Length of ty        | Length of ty
89          | SphereQuery of ty * ty
90        | Ceiling of int        | Ceiling of int
91        | Floor of int        | Floor of int
92        | Round of int        | Round of int
93        | Trunc of int        | Trunc of int
94        | IntToReal        | IntToReal
95        | RealToInt of int        | RealToInt of int
96          | R_All of ty
97          | R_Exists of ty
98          | R_Max of ty
99          | R_Min of ty
100          | R_Sum of ty
101          | R_Product of ty
102          | R_Mean of ty
103          | R_Variance of ty
104        | Kernel of Kernel.kernel * int        | Kernel of Kernel.kernel * int
105        | Transform of ImageInfo.info        | Transform of ImageInfo.info
106        | Translate of ImageInfo.info        | Translate of ImageInfo.info
# Line 103  Line 113 
113        | LoadSeq of ty * string        | LoadSeq of ty * string
114        | LoadImage of ty * string        | LoadImage of ty * string
115        | Print of tys        | Print of tys
       | MathFn of MathFns.t  
116    
117      fun resultArity IAdd = 1      fun resultArity IAdd = 1
118        | resultArity ISub = 1        | resultArity ISub = 1
# Line 123  Line 132 
132        | resultArity (Min _) = 1        | resultArity (Min _) = 1
133        | resultArity (Clamp _) = 1        | resultArity (Clamp _) = 1
134        | resultArity (Lerp _) = 1        | resultArity (Lerp _) = 1
135          | resultArity (Dist _) = 1
136        | resultArity (Normalize _) = 1        | resultArity (Normalize _) = 1
137        | resultArity (PrincipleEvec _) = 1        | resultArity (PrincipleEvec _) = 1
138        | resultArity EigenVecs2x2 = 1        | resultArity EigenVecs2x2 = 1
# Line 139  Line 149 
149        | resultArity (Concat _) = 2        | resultArity (Concat _) = 2
150        | resultArity Range = 2        | resultArity Range = 2
151        | resultArity (Length _) = 1        | resultArity (Length _) = 1
152          | resultArity (SphereQuery _) = 1
153        | resultArity (Ceiling _) = 1        | resultArity (Ceiling _) = 1
154        | resultArity (Floor _) = 1        | resultArity (Floor _) = 1
155        | resultArity (Round _) = 1        | resultArity (Round _) = 1
156        | resultArity (Trunc _) = 1        | resultArity (Trunc _) = 1
157        | resultArity IntToReal = 1        | resultArity IntToReal = 1
158        | resultArity (RealToInt _) = 1        | resultArity (RealToInt _) = 1
159          | resultArity (R_All _) = 1
160          | resultArity (R_Exists _) = 1
161          | resultArity (R_Max _) = 1
162          | resultArity (R_Min _) = 1
163          | resultArity (R_Sum _) = 1
164          | resultArity (R_Product _) = 1
165          | resultArity (R_Mean _) = 1
166          | resultArity (R_Variance _) = 1
167        | resultArity (Kernel _) = 1        | resultArity (Kernel _) = 1
168        | resultArity (Transform _) = 1        | resultArity (Transform _) = 1
169        | resultArity (Translate _) = 1        | resultArity (Translate _) = 1
# Line 157  Line 176 
176        | resultArity (LoadSeq _) = 1        | resultArity (LoadSeq _) = 1
177        | resultArity (LoadImage _) = 1        | resultArity (LoadImage _) = 1
178        | resultArity (Print _) = 0        | resultArity (Print _) = 0
       | resultArity (MathFn _) = 1  
179    
180      fun arity IAdd = 2      fun arity IAdd = 2
181        | arity ISub = 2        | arity ISub = 2
# Line 177  Line 195 
195        | arity (Min _) = 2        | arity (Min _) = 2
196        | arity (Clamp _) = 3        | arity (Clamp _) = 3
197        | arity (Lerp _) = 3        | arity (Lerp _) = 3
198          | arity (Dist _) = 2
199        | arity (Normalize _) = 1        | arity (Normalize _) = 1
200        | arity (PrincipleEvec _) = 2        | arity (PrincipleEvec _) = 2
201        | arity EigenVecs2x2 = 1        | arity EigenVecs2x2 = 1
# Line 193  Line 212 
212        | arity (Concat _) = 1        | arity (Concat _) = 1
213        | arity Range = 1        | arity Range = 1
214        | arity (Length _) = 1        | arity (Length _) = 1
215          | arity (SphereQuery _) = 2
216        | arity (Ceiling _) = 1        | arity (Ceiling _) = 1
217        | arity (Floor _) = 1        | arity (Floor _) = 1
218        | arity (Round _) = 1        | arity (Round _) = 1
219        | arity (Trunc _) = 1        | arity (Trunc _) = 1
220        | arity IntToReal = 1        | arity IntToReal = 1
221        | arity (RealToInt _) = 1        | arity (RealToInt _) = 1
222          | arity (R_All _) = 3
223          | arity (R_Exists _) = 3
224          | arity (R_Max _) = 3
225          | arity (R_Min _) = 3
226          | arity (R_Sum _) = 3
227          | arity (R_Product _) = 3
228          | arity (R_Mean _) = 3
229          | arity (R_Variance _) = 4
230        | arity (Kernel _) = 0        | arity (Kernel _) = 0
231        | arity (Transform _) = 1        | arity (Transform _) = 1
232        | arity (Translate _) = 1        | arity (Translate _) = 1
# Line 211  Line 239 
239        | arity (LoadSeq _) = 0        | arity (LoadSeq _) = 0
240        | arity (LoadImage _) = 0        | arity (LoadImage _) = 0
241        | arity (Print _) = ~1        | arity (Print _) = ~1
       | arity (MathFn _) = ~1  
242    
243      fun isPure (MkDynamic _) = false      fun isPure (MkDynamic _) = false
244        | isPure (Append _) = false        | isPure (Append _) = false
# Line 238  Line 265 
265        | same (Min(a0), Min(b0)) = samety(a0, b0)        | same (Min(a0), Min(b0)) = samety(a0, b0)
266        | same (Clamp(a0), Clamp(b0)) = samety(a0, b0)        | same (Clamp(a0), Clamp(b0)) = samety(a0, b0)
267        | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)        | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)
268          | same (Dist(a0), Dist(b0)) = samety(a0, b0)
269        | same (Normalize(a0), Normalize(b0)) = sameint(a0, b0)        | same (Normalize(a0), Normalize(b0)) = sameint(a0, b0)
270        | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0)        | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0)
271        | same (EigenVecs2x2, EigenVecs2x2) = true        | same (EigenVecs2x2, EigenVecs2x2) = true
# Line 254  Line 282 
282        | same (Concat(a0), Concat(b0)) = samety(a0, b0)        | same (Concat(a0), Concat(b0)) = samety(a0, b0)
283        | same (Range, Range) = true        | same (Range, Range) = true
284        | same (Length(a0), Length(b0)) = samety(a0, b0)        | same (Length(a0), Length(b0)) = samety(a0, b0)
285          | same (SphereQuery(a0,a1), SphereQuery(b0,b1)) = samety(a0, b0) andalso samety(a1, b1)
286        | same (Ceiling(a0), Ceiling(b0)) = sameint(a0, b0)        | same (Ceiling(a0), Ceiling(b0)) = sameint(a0, b0)
287        | same (Floor(a0), Floor(b0)) = sameint(a0, b0)        | same (Floor(a0), Floor(b0)) = sameint(a0, b0)
288        | same (Round(a0), Round(b0)) = sameint(a0, b0)        | same (Round(a0), Round(b0)) = sameint(a0, b0)
289        | same (Trunc(a0), Trunc(b0)) = sameint(a0, b0)        | same (Trunc(a0), Trunc(b0)) = sameint(a0, b0)
290        | same (IntToReal, IntToReal) = true        | same (IntToReal, IntToReal) = true
291        | same (RealToInt(a0), RealToInt(b0)) = sameint(a0, b0)        | same (RealToInt(a0), RealToInt(b0)) = sameint(a0, b0)
292          | same (R_All(a0), R_All(b0)) = samety(a0, b0)
293          | same (R_Exists(a0), R_Exists(b0)) = samety(a0, b0)
294          | same (R_Max(a0), R_Max(b0)) = samety(a0, b0)
295          | same (R_Min(a0), R_Min(b0)) = samety(a0, b0)
296          | same (R_Sum(a0), R_Sum(b0)) = samety(a0, b0)
297          | same (R_Product(a0), R_Product(b0)) = samety(a0, b0)
298          | same (R_Mean(a0), R_Mean(b0)) = samety(a0, b0)
299          | same (R_Variance(a0), R_Variance(b0)) = samety(a0, b0)
300        | same (Kernel(a0,a1), Kernel(b0,b1)) = Kernel.same(a0, b0) andalso sameint(a1, b1)        | same (Kernel(a0,a1), Kernel(b0,b1)) = Kernel.same(a0, b0) andalso sameint(a1, b1)
301        | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)        | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)
302        | same (Translate(a0), Translate(b0)) = ImageInfo.same(a0, b0)        | same (Translate(a0), Translate(b0)) = ImageInfo.same(a0, b0)
# Line 272  Line 309 
309        | same (LoadSeq(a0,a1), LoadSeq(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)        | same (LoadSeq(a0,a1), LoadSeq(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)
310        | same (LoadImage(a0,a1), LoadImage(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)        | same (LoadImage(a0,a1), LoadImage(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)
311        | same (Print(a0), Print(b0)) = sametys(a0, b0)        | same (Print(a0), Print(b0)) = sametys(a0, b0)
       | same (MathFn(a0), MathFn(b0)) = MathFns.same(a0, b0)  
312        | same _ = false        | same _ = false
313    
314      fun hash IAdd = 0w3      fun hash IAdd = 0w3
# Line 293  Line 329 
329        | hash (Min(a0)) = 0w59 + hashty a0        | hash (Min(a0)) = 0w59 + hashty a0
330        | hash (Clamp(a0)) = 0w61 + hashty a0        | hash (Clamp(a0)) = 0w61 + hashty a0
331        | hash (Lerp(a0)) = 0w67 + hashty a0        | hash (Lerp(a0)) = 0w67 + hashty a0
332        | hash (Normalize(a0)) = 0w71 + hashint a0        | hash (Dist(a0)) = 0w71 + hashty a0
333        | hash (PrincipleEvec(a0)) = 0w73 + hashty a0        | hash (Normalize(a0)) = 0w73 + hashint a0
334        | hash EigenVecs2x2 = 0w79        | hash (PrincipleEvec(a0)) = 0w79 + hashty a0
335        | hash EigenVecs3x3 = 0w83        | hash EigenVecs2x2 = 0w83
336        | hash EigenVals2x2 = 0w89        | hash EigenVecs3x3 = 0w89
337        | hash EigenVals3x3 = 0w97        | hash EigenVals2x2 = 0w97
338        | hash (Zero(a0)) = 0w101 + hashty a0        | hash EigenVals3x3 = 0w101
339        | hash (Select(a0,a1)) = 0w103 + hashty a0 + hashint a1        | hash (Zero(a0)) = 0w103 + hashty a0
340        | hash (Index(a0,a1)) = 0w107 + hashty a0 + hashint a1        | hash (Select(a0,a1)) = 0w107 + hashty a0 + hashint a1
341        | hash (Subscript(a0)) = 0w109 + hashty a0        | hash (Index(a0,a1)) = 0w109 + hashty a0 + hashint a1
342        | hash (MkDynamic(a0,a1)) = 0w113 + hashty a0 + hashint a1        | hash (Subscript(a0)) = 0w113 + hashty a0
343        | hash (Append(a0)) = 0w127 + hashty a0        | hash (MkDynamic(a0,a1)) = 0w127 + hashty a0 + hashint a1
344        | hash (Prepend(a0)) = 0w131 + hashty a0        | hash (Append(a0)) = 0w131 + hashty a0
345        | hash (Concat(a0)) = 0w137 + hashty a0        | hash (Prepend(a0)) = 0w137 + hashty a0
346        | hash Range = 0w139        | hash (Concat(a0)) = 0w139 + hashty a0
347        | hash (Length(a0)) = 0w149 + hashty a0        | hash Range = 0w149
348        | hash (Ceiling(a0)) = 0w151 + hashint a0        | hash (Length(a0)) = 0w151 + hashty a0
349        | hash (Floor(a0)) = 0w157 + hashint a0        | hash (SphereQuery(a0,a1)) = 0w157 + hashty a0 + hashty a1
350        | hash (Round(a0)) = 0w163 + hashint a0        | hash (Ceiling(a0)) = 0w163 + hashint a0
351        | hash (Trunc(a0)) = 0w167 + hashint a0        | hash (Floor(a0)) = 0w167 + hashint a0
352        | hash IntToReal = 0w173        | hash (Round(a0)) = 0w173 + hashint a0
353        | hash (RealToInt(a0)) = 0w179 + hashint a0        | hash (Trunc(a0)) = 0w179 + hashint a0
354        | hash (Kernel(a0,a1)) = 0w181 + Kernel.hash a0 + hashint a1        | hash IntToReal = 0w181
355        | hash (Transform(a0)) = 0w191 + ImageInfo.hash a0        | hash (RealToInt(a0)) = 0w191 + hashint a0
356        | hash (Translate(a0)) = 0w193 + ImageInfo.hash a0        | hash (R_All(a0)) = 0w193 + hashty a0
357        | hash (EvalKernel(a0,a1,a2)) = 0w197 + hashint a0 + Kernel.hash a1 + hashint a2        | hash (R_Exists(a0)) = 0w197 + hashty a0
358        | hash (VoxelAddress(a0,a1)) = 0w199 + ImageInfo.hash a0 + hashint a1        | hash (R_Max(a0)) = 0w199 + hashty a0
359        | hash (VoxelAddressWithCtl(a0,a1,a2)) = 0w211 + ImageInfo.hash a0 + hashint a1 + hashidxctl a2        | hash (R_Min(a0)) = 0w211 + hashty a0
360        | hash (LoadVoxels(a0,a1)) = 0w223 + ImageInfo.hash a0 + hashint a1        | hash (R_Sum(a0)) = 0w223 + hashty a0
361        | hash (Inside(a0,a1)) = 0w227 + ImageInfo.hash a0 + hashint a1        | hash (R_Product(a0)) = 0w227 + hashty a0
362        | hash (ImageDim(a0,a1)) = 0w229 + ImageInfo.hash a0 + hashint a1        | hash (R_Mean(a0)) = 0w229 + hashty a0
363        | hash (LoadSeq(a0,a1)) = 0w233 + hashty a0 + hashstring a1        | hash (R_Variance(a0)) = 0w233 + hashty a0
364        | hash (LoadImage(a0,a1)) = 0w239 + hashty a0 + hashstring a1        | hash (Kernel(a0,a1)) = 0w239 + Kernel.hash a0 + hashint a1
365        | hash (Print(a0)) = 0w241 + hashtys a0        | hash (Transform(a0)) = 0w241 + ImageInfo.hash a0
366        | hash (MathFn(a0)) = 0w251 + MathFns.hash a0        | hash (Translate(a0)) = 0w251 + ImageInfo.hash a0
367          | hash (EvalKernel(a0,a1,a2)) = 0w257 + hashint a0 + Kernel.hash a1 + hashint a2
368          | hash (VoxelAddress(a0,a1)) = 0w263 + ImageInfo.hash a0 + hashint a1
369          | hash (VoxelAddressWithCtl(a0,a1,a2)) = 0w269 + ImageInfo.hash a0 + hashint a1 + hashidxctl a2
370          | hash (LoadVoxels(a0,a1)) = 0w271 + ImageInfo.hash a0 + hashint a1
371          | hash (Inside(a0,a1)) = 0w277 + ImageInfo.hash a0 + hashint a1
372          | hash (ImageDim(a0,a1)) = 0w281 + ImageInfo.hash a0 + hashint a1
373          | hash (LoadSeq(a0,a1)) = 0w283 + hashty a0 + hashstring a1
374          | hash (LoadImage(a0,a1)) = 0w293 + hashty a0 + hashstring a1
375          | hash (Print(a0)) = 0w307 + hashtys a0
376    
377      fun toString IAdd = "IAdd"      fun toString IAdd = "IAdd"
378        | toString ISub = "ISub"        | toString ISub = "ISub"
# Line 347  Line 392 
392        | toString (Min(a0)) = concat["Min<", tyToString a0, ">"]        | toString (Min(a0)) = concat["Min<", tyToString a0, ">"]
393        | toString (Clamp(a0)) = concat["Clamp<", tyToString a0, ">"]        | toString (Clamp(a0)) = concat["Clamp<", tyToString a0, ">"]
394        | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]        | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]
395          | toString (Dist(a0)) = concat["Dist<", tyToString a0, ">"]
396        | toString (Normalize(a0)) = concat["Normalize<", intToString a0, ">"]        | toString (Normalize(a0)) = concat["Normalize<", intToString a0, ">"]
397        | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"]        | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"]
398        | toString EigenVecs2x2 = "EigenVecs2x2"        | toString EigenVecs2x2 = "EigenVecs2x2"
# Line 363  Line 409 
409        | toString (Concat(a0)) = concat["Concat<", tyToString a0, ">"]        | toString (Concat(a0)) = concat["Concat<", tyToString a0, ">"]
410        | toString Range = "Range"        | toString Range = "Range"
411        | toString (Length(a0)) = concat["Length<", tyToString a0, ">"]        | toString (Length(a0)) = concat["Length<", tyToString a0, ">"]
412          | toString (SphereQuery(a0,a1)) = concat["SphereQuery<", tyToString a0, ",", tyToString a1, ">"]
413        | toString (Ceiling(a0)) = concat["Ceiling<", intToString a0, ">"]        | toString (Ceiling(a0)) = concat["Ceiling<", intToString a0, ">"]
414        | toString (Floor(a0)) = concat["Floor<", intToString a0, ">"]        | toString (Floor(a0)) = concat["Floor<", intToString a0, ">"]
415        | toString (Round(a0)) = concat["Round<", intToString a0, ">"]        | toString (Round(a0)) = concat["Round<", intToString a0, ">"]
416        | toString (Trunc(a0)) = concat["Trunc<", intToString a0, ">"]        | toString (Trunc(a0)) = concat["Trunc<", intToString a0, ">"]
417        | toString IntToReal = "IntToReal"        | toString IntToReal = "IntToReal"
418        | toString (RealToInt(a0)) = concat["RealToInt<", intToString a0, ">"]        | toString (RealToInt(a0)) = concat["RealToInt<", intToString a0, ">"]
419          | toString (R_All(a0)) = concat["R_All<", tyToString a0, ">"]
420          | toString (R_Exists(a0)) = concat["R_Exists<", tyToString a0, ">"]
421          | toString (R_Max(a0)) = concat["R_Max<", tyToString a0, ">"]
422          | toString (R_Min(a0)) = concat["R_Min<", tyToString a0, ">"]
423          | toString (R_Sum(a0)) = concat["R_Sum<", tyToString a0, ">"]
424          | toString (R_Product(a0)) = concat["R_Product<", tyToString a0, ">"]
425          | toString (R_Mean(a0)) = concat["R_Mean<", tyToString a0, ">"]
426          | toString (R_Variance(a0)) = concat["R_Variance<", tyToString a0, ">"]
427        | toString (Kernel(a0,a1)) = concat["Kernel<", Kernel.toString a0, ",", intToString a1, ">"]        | toString (Kernel(a0,a1)) = concat["Kernel<", Kernel.toString a0, ",", intToString a1, ">"]
428        | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]        | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]
429        | toString (Translate(a0)) = concat["Translate<", ImageInfo.toString a0, ">"]        | toString (Translate(a0)) = concat["Translate<", ImageInfo.toString a0, ">"]
# Line 381  Line 436 
436        | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]        | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]
437        | toString (LoadImage(a0,a1)) = concat["LoadImage<", tyToString a0, ",", stringToString a1, ">"]        | toString (LoadImage(a0,a1)) = concat["LoadImage<", tyToString a0, ",", stringToString a1, ">"]
438        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]
       | toString (MathFn(a0)) = concat["MathFn<", MathFns.toString a0, ">"]  
439    
440    end    end
441    

Legend:
Removed from v.3511  
changed lines
  Added in v.3529

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