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 3628, Sun Jan 31 14:30:06 2016 UTC revision 3732, Thu Apr 7 20:56:16 2016 UTC
# Line 23  Line 23 
23      type tys = ty list      type tys = ty list
24      fun sametys (tys1, tys2) = ListPair.allEq samety (tys1, tys2)      fun sametys (tys1, tys2) = ListPair.allEq samety (tys1, tys2)
25      fun hashtys tys = List.foldl (fn (ty, s) => hashty ty + 0w3 * s) 0w0 tys      fun hashtys tys = List.foldl (fn (ty, s) => hashty ty + 0w3 * s) 0w0 tys
26      fun tysToString tys = String.concat["[", String.concatWith "," (List.map tyToString tys), "]" ]      fun tysToString tys = String.concat["[", String.concatWithMap "," tyToString tys, "]" ]
27    
28    (* required helper functions for the int type *)    (* required helper functions for the int type *)
29      fun sameint (i1 : int, i2) = (i1 = i2)      fun sameint (i1 : int, i2) = (i1 = i2)
# Line 98  Line 98 
98        | R_Product of ty        | R_Product of ty
99        | R_Mean of ty        | R_Mean of ty
100        | R_Variance of ty        | R_Variance of ty
101          | BuildPos of int
102          | EvalKernel of int * Kernel.kernel * int
103        | Kernel of Kernel.kernel * int        | Kernel of Kernel.kernel * int
104        | Transform of ImageInfo.info        | Transform of ImageInfo.info
105        | Translate of ImageInfo.info        | Translate of ImageInfo.info
       | EvalKernel of int * Kernel.kernel * int  
106        | VoxelAddress of ImageInfo.info * int        | VoxelAddress of ImageInfo.info * int
107        | VoxelAddressWithCtl of ImageInfo.info * int * idxctl        | VoxelAddressWithCtl of ImageInfo.info * int * idxctl
108        | LoadVoxels of ImageInfo.info * int        | LoadVoxels of ImageInfo.info * int
109        | Inside of ImageInfo.info * int        | Inside of ImageInfo.info * int
110        | ImageDim of ImageInfo.info * int        | ImageDim of ImageInfo.info * int
111          | BorderCtlDefault of ImageInfo.info
112          | BorderCtlClamp of ImageInfo.info
113          | BorderCtlMirror of ImageInfo.info
114          | BorderCtlWrap of ImageInfo.info
115        | LoadSeq of ty * string        | LoadSeq of ty * string
116        | LoadImage of ty * string        | LoadImage of ty * string
117        | Print of tys        | Print of tys
# Line 159  Line 164 
164        | resultArity (R_Product _) = 1        | resultArity (R_Product _) = 1
165        | resultArity (R_Mean _) = 1        | resultArity (R_Mean _) = 1
166        | resultArity (R_Variance _) = 1        | resultArity (R_Variance _) = 1
167          | resultArity (BuildPos _) = 1
168          | resultArity (EvalKernel _) = 1
169        | resultArity (Kernel _) = 1        | resultArity (Kernel _) = 1
170        | resultArity (Transform _) = 1        | resultArity (Transform _) = 1
171        | resultArity (Translate _) = 1        | resultArity (Translate _) = 1
       | resultArity (EvalKernel _) = 1  
172        | resultArity (VoxelAddress _) = 1        | resultArity (VoxelAddress _) = 1
173        | resultArity (VoxelAddressWithCtl _) = 1        | resultArity (VoxelAddressWithCtl _) = 1
174        | resultArity (LoadVoxels _) = 1        | resultArity (LoadVoxels _) = 1
175        | resultArity (Inside _) = 1        | resultArity (Inside _) = 1
176        | resultArity (ImageDim _) = 1        | resultArity (ImageDim _) = 1
177          | resultArity (BorderCtlDefault _) = 1
178          | resultArity (BorderCtlClamp _) = 1
179          | resultArity (BorderCtlMirror _) = 1
180          | resultArity (BorderCtlWrap _) = 1
181        | resultArity (LoadSeq _) = 1        | resultArity (LoadSeq _) = 1
182        | resultArity (LoadImage _) = 1        | resultArity (LoadImage _) = 1
183        | resultArity (Print _) = 0        | resultArity (Print _) = 0
# Line 220  Line 230 
230        | arity (R_Product _) = 3        | arity (R_Product _) = 3
231        | arity (R_Mean _) = 3        | arity (R_Mean _) = 3
232        | arity (R_Variance _) = 4        | arity (R_Variance _) = 4
233          | arity (BuildPos _) = 1
234          | arity (EvalKernel _) = 1
235        | arity (Kernel _) = 0        | arity (Kernel _) = 0
236        | arity (Transform _) = 1        | arity (Transform _) = 1
237        | arity (Translate _) = 1        | arity (Translate _) = 1
       | arity (EvalKernel _) = 1  
238        | arity (VoxelAddress _) = ~1        | arity (VoxelAddress _) = ~1
239        | arity (VoxelAddressWithCtl _) = ~1        | arity (VoxelAddressWithCtl _) = ~1
240        | arity (LoadVoxels _) = 1        | arity (LoadVoxels _) = 1
241        | arity (Inside _) = 2        | arity (Inside _) = 2
242        | arity (ImageDim _) = 1        | arity (ImageDim _) = 1
243          | arity (BorderCtlDefault _) = 2
244          | arity (BorderCtlClamp _) = 1
245          | arity (BorderCtlMirror _) = 1
246          | arity (BorderCtlWrap _) = 1
247        | arity (LoadSeq _) = 0        | arity (LoadSeq _) = 0
248        | arity (LoadImage _) = 0        | arity (LoadImage _) = 0
249        | arity (Print _) = ~1        | arity (Print _) = ~1
# Line 288  Line 303 
303        | same (R_Product(a0), R_Product(b0)) = samety(a0, b0)        | same (R_Product(a0), R_Product(b0)) = samety(a0, b0)
304        | same (R_Mean(a0), R_Mean(b0)) = samety(a0, b0)        | same (R_Mean(a0), R_Mean(b0)) = samety(a0, b0)
305        | same (R_Variance(a0), R_Variance(b0)) = samety(a0, b0)        | same (R_Variance(a0), R_Variance(b0)) = samety(a0, b0)
306          | same (BuildPos(a0), BuildPos(b0)) = sameint(a0, b0)
307          | same (EvalKernel(a0,a1,a2), EvalKernel(b0,b1,b2)) = sameint(a0, b0) andalso Kernel.same(a1, b1) andalso sameint(a2, b2)
308        | 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)
309        | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)        | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)
310        | same (Translate(a0), Translate(b0)) = ImageInfo.same(a0, b0)        | same (Translate(a0), Translate(b0)) = ImageInfo.same(a0, b0)
       | same (EvalKernel(a0,a1,a2), EvalKernel(b0,b1,b2)) = sameint(a0, b0) andalso Kernel.same(a1, b1) andalso sameint(a2, b2)  
311        | same (VoxelAddress(a0,a1), VoxelAddress(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)        | same (VoxelAddress(a0,a1), VoxelAddress(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)
312        | same (VoxelAddressWithCtl(a0,a1,a2), VoxelAddressWithCtl(b0,b1,b2)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1) andalso sameidxctl(a2, b2)        | same (VoxelAddressWithCtl(a0,a1,a2), VoxelAddressWithCtl(b0,b1,b2)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1) andalso sameidxctl(a2, b2)
313        | same (LoadVoxels(a0,a1), LoadVoxels(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)        | same (LoadVoxels(a0,a1), LoadVoxels(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)
314        | same (Inside(a0,a1), Inside(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)        | same (Inside(a0,a1), Inside(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)
315        | same (ImageDim(a0,a1), ImageDim(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)        | same (ImageDim(a0,a1), ImageDim(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)
316          | same (BorderCtlDefault(a0), BorderCtlDefault(b0)) = ImageInfo.same(a0, b0)
317          | same (BorderCtlClamp(a0), BorderCtlClamp(b0)) = ImageInfo.same(a0, b0)
318          | same (BorderCtlMirror(a0), BorderCtlMirror(b0)) = ImageInfo.same(a0, b0)
319          | same (BorderCtlWrap(a0), BorderCtlWrap(b0)) = ImageInfo.same(a0, b0)
320        | 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)
321        | 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)
322        | same (Print(a0), Print(b0)) = sametys(a0, b0)        | same (Print(a0), Print(b0)) = sametys(a0, b0)
# Line 350  Line 370 
370        | hash (R_Product(a0)) = 0w199 + hashty a0        | hash (R_Product(a0)) = 0w199 + hashty a0
371        | hash (R_Mean(a0)) = 0w211 + hashty a0        | hash (R_Mean(a0)) = 0w211 + hashty a0
372        | hash (R_Variance(a0)) = 0w223 + hashty a0        | hash (R_Variance(a0)) = 0w223 + hashty a0
373        | hash (Kernel(a0,a1)) = 0w227 + Kernel.hash a0 + hashint a1        | hash (BuildPos(a0)) = 0w227 + hashint a0
374        | hash (Transform(a0)) = 0w229 + ImageInfo.hash a0        | hash (EvalKernel(a0,a1,a2)) = 0w229 + hashint a0 + Kernel.hash a1 + hashint a2
375        | hash (Translate(a0)) = 0w233 + ImageInfo.hash a0        | hash (Kernel(a0,a1)) = 0w233 + Kernel.hash a0 + hashint a1
376        | hash (EvalKernel(a0,a1,a2)) = 0w239 + hashint a0 + Kernel.hash a1 + hashint a2        | hash (Transform(a0)) = 0w239 + ImageInfo.hash a0
377        | hash (VoxelAddress(a0,a1)) = 0w241 + ImageInfo.hash a0 + hashint a1        | hash (Translate(a0)) = 0w241 + ImageInfo.hash a0
378        | hash (VoxelAddressWithCtl(a0,a1,a2)) = 0w251 + ImageInfo.hash a0 + hashint a1 + hashidxctl a2        | hash (VoxelAddress(a0,a1)) = 0w251 + ImageInfo.hash a0 + hashint a1
379        | hash (LoadVoxels(a0,a1)) = 0w257 + ImageInfo.hash a0 + hashint a1        | hash (VoxelAddressWithCtl(a0,a1,a2)) = 0w257 + ImageInfo.hash a0 + hashint a1 + hashidxctl a2
380        | hash (Inside(a0,a1)) = 0w263 + ImageInfo.hash a0 + hashint a1        | hash (LoadVoxels(a0,a1)) = 0w263 + ImageInfo.hash a0 + hashint a1
381        | hash (ImageDim(a0,a1)) = 0w269 + ImageInfo.hash a0 + hashint a1        | hash (Inside(a0,a1)) = 0w269 + ImageInfo.hash a0 + hashint a1
382        | hash (LoadSeq(a0,a1)) = 0w271 + hashty a0 + hashstring a1        | hash (ImageDim(a0,a1)) = 0w271 + ImageInfo.hash a0 + hashint a1
383        | hash (LoadImage(a0,a1)) = 0w277 + hashty a0 + hashstring a1        | hash (BorderCtlDefault(a0)) = 0w277 + ImageInfo.hash a0
384        | hash (Print(a0)) = 0w281 + hashtys a0        | hash (BorderCtlClamp(a0)) = 0w281 + ImageInfo.hash a0
385        | hash (MathFn(a0)) = 0w283 + MathFns.hash a0        | hash (BorderCtlMirror(a0)) = 0w283 + ImageInfo.hash a0
386          | hash (BorderCtlWrap(a0)) = 0w293 + ImageInfo.hash a0
387          | hash (LoadSeq(a0,a1)) = 0w307 + hashty a0 + hashstring a1
388          | hash (LoadImage(a0,a1)) = 0w311 + hashty a0 + hashstring a1
389          | hash (Print(a0)) = 0w313 + hashtys a0
390          | hash (MathFn(a0)) = 0w317 + MathFns.hash a0
391    
392      fun toString IAdd = "IAdd"      fun toString IAdd = "IAdd"
393        | toString ISub = "ISub"        | toString ISub = "ISub"
# Line 411  Line 436 
436        | toString (R_Product(a0)) = concat["R_Product<", tyToString a0, ">"]        | toString (R_Product(a0)) = concat["R_Product<", tyToString a0, ">"]
437        | toString (R_Mean(a0)) = concat["R_Mean<", tyToString a0, ">"]        | toString (R_Mean(a0)) = concat["R_Mean<", tyToString a0, ">"]
438        | toString (R_Variance(a0)) = concat["R_Variance<", tyToString a0, ">"]        | toString (R_Variance(a0)) = concat["R_Variance<", tyToString a0, ">"]
439          | toString (BuildPos(a0)) = concat["BuildPos<", intToString a0, ">"]
440          | toString (EvalKernel(a0,a1,a2)) = concat["EvalKernel<", intToString a0, ",", Kernel.toString a1, ",", intToString a2, ">"]
441        | toString (Kernel(a0,a1)) = concat["Kernel<", Kernel.toString a0, ",", intToString a1, ">"]        | toString (Kernel(a0,a1)) = concat["Kernel<", Kernel.toString a0, ",", intToString a1, ">"]
442        | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]        | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]
443        | toString (Translate(a0)) = concat["Translate<", ImageInfo.toString a0, ">"]        | toString (Translate(a0)) = concat["Translate<", ImageInfo.toString a0, ">"]
       | toString (EvalKernel(a0,a1,a2)) = concat["EvalKernel<", intToString a0, ",", Kernel.toString a1, ",", intToString a2, ">"]  
444        | toString (VoxelAddress(a0,a1)) = concat["VoxelAddress<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (VoxelAddress(a0,a1)) = concat["VoxelAddress<", ImageInfo.toString a0, ",", intToString a1, ">"]
445        | toString (VoxelAddressWithCtl(a0,a1,a2)) = concat["VoxelAddressWithCtl<", ImageInfo.toString a0, ",", intToString a1, ",", idxctlToString a2, ">"]        | toString (VoxelAddressWithCtl(a0,a1,a2)) = concat["VoxelAddressWithCtl<", ImageInfo.toString a0, ",", intToString a1, ",", idxctlToString a2, ">"]
446        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", ImageInfo.toString a0, ",", intToString a1, ">"]
447        | toString (Inside(a0,a1)) = concat["Inside<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (Inside(a0,a1)) = concat["Inside<", ImageInfo.toString a0, ",", intToString a1, ">"]
448        | toString (ImageDim(a0,a1)) = concat["ImageDim<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (ImageDim(a0,a1)) = concat["ImageDim<", ImageInfo.toString a0, ",", intToString a1, ">"]
449          | toString (BorderCtlDefault(a0)) = concat["BorderCtlDefault<", ImageInfo.toString a0, ">"]
450          | toString (BorderCtlClamp(a0)) = concat["BorderCtlClamp<", ImageInfo.toString a0, ">"]
451          | toString (BorderCtlMirror(a0)) = concat["BorderCtlMirror<", ImageInfo.toString a0, ">"]
452          | toString (BorderCtlWrap(a0)) = concat["BorderCtlWrap<", ImageInfo.toString a0, ">"]
453        | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]        | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]
454        | toString (LoadImage(a0,a1)) = concat["LoadImage<", tyToString a0, ",", stringToString a1, ">"]        | toString (LoadImage(a0,a1)) = concat["LoadImage<", tyToString a0, ",", stringToString a1, ">"]
455        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]

Legend:
Removed from v.3628  
changed lines
  Added in v.3732

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