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 3774, Tue Apr 26 20:03:28 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  
       | VoxelAddress of ImageInfo.info * int  
       | VoxelAddressWithCtl of ImageInfo.info * int * idxctl  
106        | LoadVoxels of ImageInfo.info * int        | LoadVoxels of ImageInfo.info * int
107          | LoadVoxelsWithCtl of ImageInfo.info * int * idxctl
108        | Inside of ImageInfo.info * int        | Inside of ImageInfo.info * int
109        | ImageDim of ImageInfo.info * int        | ImageDim of ImageInfo.info * int
110          | BorderCtlDefault of ImageInfo.info
111          | BorderCtlClamp of ImageInfo.info
112          | BorderCtlMirror of ImageInfo.info
113          | BorderCtlWrap of ImageInfo.info
114        | LoadSeq of ty * string        | LoadSeq of ty * string
115        | LoadImage of ty * string        | LoadImage of ty * string
116        | Print of tys        | Print of tys
# Line 159  Line 163 
163        | resultArity (R_Product _) = 1        | resultArity (R_Product _) = 1
164        | resultArity (R_Mean _) = 1        | resultArity (R_Mean _) = 1
165        | resultArity (R_Variance _) = 1        | resultArity (R_Variance _) = 1
166          | resultArity (BuildPos _) = 1
167          | resultArity (EvalKernel _) = 1
168        | resultArity (Kernel _) = 1        | resultArity (Kernel _) = 1
169        | resultArity (Transform _) = 1        | resultArity (Transform _) = 1
170        | resultArity (Translate _) = 1        | resultArity (Translate _) = 1
       | resultArity (EvalKernel _) = 1  
       | resultArity (VoxelAddress _) = 1  
       | resultArity (VoxelAddressWithCtl _) = 1  
171        | resultArity (LoadVoxels _) = 1        | resultArity (LoadVoxels _) = 1
172          | resultArity (LoadVoxelsWithCtl _) = 1
173        | resultArity (Inside _) = 1        | resultArity (Inside _) = 1
174        | resultArity (ImageDim _) = 1        | resultArity (ImageDim _) = 1
175          | resultArity (BorderCtlDefault _) = 1
176          | resultArity (BorderCtlClamp _) = 1
177          | resultArity (BorderCtlMirror _) = 1
178          | resultArity (BorderCtlWrap _) = 1
179        | resultArity (LoadSeq _) = 1        | resultArity (LoadSeq _) = 1
180        | resultArity (LoadImage _) = 1        | resultArity (LoadImage _) = 1
181        | resultArity (Print _) = 0        | resultArity (Print _) = 0
# Line 220  Line 228 
228        | arity (R_Product _) = 3        | arity (R_Product _) = 3
229        | arity (R_Mean _) = 3        | arity (R_Mean _) = 3
230        | arity (R_Variance _) = 4        | arity (R_Variance _) = 4
231          | arity (BuildPos _) = 1
232          | arity (EvalKernel _) = 1
233        | arity (Kernel _) = 0        | arity (Kernel _) = 0
234        | arity (Transform _) = 1        | arity (Transform _) = 1
235        | arity (Translate _) = 1        | arity (Translate _) = 1
236        | arity (EvalKernel _) = 1        | arity (LoadVoxels _) = 2
237        | arity (VoxelAddress _) = ~1        | arity (LoadVoxelsWithCtl _) = 2
       | arity (VoxelAddressWithCtl _) = ~1  
       | arity (LoadVoxels _) = 1  
238        | arity (Inside _) = 2        | arity (Inside _) = 2
239        | arity (ImageDim _) = 1        | arity (ImageDim _) = 1
240          | arity (BorderCtlDefault _) = 2
241          | arity (BorderCtlClamp _) = 1
242          | arity (BorderCtlMirror _) = 1
243          | arity (BorderCtlWrap _) = 1
244        | arity (LoadSeq _) = 0        | arity (LoadSeq _) = 0
245        | arity (LoadImage _) = 0        | arity (LoadImage _) = 0
246        | arity (Print _) = ~1        | arity (Print _) = ~1
# Line 288  Line 300 
300        | same (R_Product(a0), R_Product(b0)) = samety(a0, b0)        | same (R_Product(a0), R_Product(b0)) = samety(a0, b0)
301        | same (R_Mean(a0), R_Mean(b0)) = samety(a0, b0)        | same (R_Mean(a0), R_Mean(b0)) = samety(a0, b0)
302        | same (R_Variance(a0), R_Variance(b0)) = samety(a0, b0)        | same (R_Variance(a0), R_Variance(b0)) = samety(a0, b0)
303          | same (BuildPos(a0), BuildPos(b0)) = sameint(a0, b0)
304          | same (EvalKernel(a0,a1,a2), EvalKernel(b0,b1,b2)) = sameint(a0, b0) andalso Kernel.same(a1, b1) andalso sameint(a2, b2)
305        | 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)
306        | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)        | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)
307        | 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)  
       | same (VoxelAddress(a0,a1), VoxelAddress(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)  
       | same (VoxelAddressWithCtl(a0,a1,a2), VoxelAddressWithCtl(b0,b1,b2)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1) andalso sameidxctl(a2, b2)  
308        | 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)
309          | same (LoadVoxelsWithCtl(a0,a1,a2), LoadVoxelsWithCtl(b0,b1,b2)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1) andalso sameidxctl(a2, b2)
310        | 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)
311        | 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)
312          | same (BorderCtlDefault(a0), BorderCtlDefault(b0)) = ImageInfo.same(a0, b0)
313          | same (BorderCtlClamp(a0), BorderCtlClamp(b0)) = ImageInfo.same(a0, b0)
314          | same (BorderCtlMirror(a0), BorderCtlMirror(b0)) = ImageInfo.same(a0, b0)
315          | same (BorderCtlWrap(a0), BorderCtlWrap(b0)) = ImageInfo.same(a0, b0)
316        | 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)
317        | 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)
318        | same (Print(a0), Print(b0)) = sametys(a0, b0)        | same (Print(a0), Print(b0)) = sametys(a0, b0)
# Line 350  Line 366 
366        | hash (R_Product(a0)) = 0w199 + hashty a0        | hash (R_Product(a0)) = 0w199 + hashty a0
367        | hash (R_Mean(a0)) = 0w211 + hashty a0        | hash (R_Mean(a0)) = 0w211 + hashty a0
368        | hash (R_Variance(a0)) = 0w223 + hashty a0        | hash (R_Variance(a0)) = 0w223 + hashty a0
369        | hash (Kernel(a0,a1)) = 0w227 + Kernel.hash a0 + hashint a1        | hash (BuildPos(a0)) = 0w227 + hashint a0
370        | hash (Transform(a0)) = 0w229 + ImageInfo.hash a0        | hash (EvalKernel(a0,a1,a2)) = 0w229 + hashint a0 + Kernel.hash a1 + hashint a2
371        | hash (Translate(a0)) = 0w233 + ImageInfo.hash a0        | hash (Kernel(a0,a1)) = 0w233 + Kernel.hash a0 + hashint a1
372        | hash (EvalKernel(a0,a1,a2)) = 0w239 + hashint a0 + Kernel.hash a1 + hashint a2        | hash (Transform(a0)) = 0w239 + ImageInfo.hash a0
373        | hash (VoxelAddress(a0,a1)) = 0w241 + ImageInfo.hash a0 + hashint a1        | hash (Translate(a0)) = 0w241 + ImageInfo.hash a0
374        | hash (VoxelAddressWithCtl(a0,a1,a2)) = 0w251 + ImageInfo.hash a0 + hashint a1 + hashidxctl a2        | hash (LoadVoxels(a0,a1)) = 0w251 + ImageInfo.hash a0 + hashint a1
375        | hash (LoadVoxels(a0,a1)) = 0w257 + ImageInfo.hash a0 + hashint a1        | hash (LoadVoxelsWithCtl(a0,a1,a2)) = 0w257 + ImageInfo.hash a0 + hashint a1 + hashidxctl a2
376        | hash (Inside(a0,a1)) = 0w263 + ImageInfo.hash a0 + hashint a1        | hash (Inside(a0,a1)) = 0w263 + ImageInfo.hash a0 + hashint a1
377        | hash (ImageDim(a0,a1)) = 0w269 + ImageInfo.hash a0 + hashint a1        | hash (ImageDim(a0,a1)) = 0w269 + ImageInfo.hash a0 + hashint a1
378        | hash (LoadSeq(a0,a1)) = 0w271 + hashty a0 + hashstring a1        | hash (BorderCtlDefault(a0)) = 0w271 + ImageInfo.hash a0
379        | hash (LoadImage(a0,a1)) = 0w277 + hashty a0 + hashstring a1        | hash (BorderCtlClamp(a0)) = 0w277 + ImageInfo.hash a0
380        | hash (Print(a0)) = 0w281 + hashtys a0        | hash (BorderCtlMirror(a0)) = 0w281 + ImageInfo.hash a0
381        | hash (MathFn(a0)) = 0w283 + MathFns.hash a0        | hash (BorderCtlWrap(a0)) = 0w283 + ImageInfo.hash a0
382          | hash (LoadSeq(a0,a1)) = 0w293 + hashty a0 + hashstring a1
383          | hash (LoadImage(a0,a1)) = 0w307 + hashty a0 + hashstring a1
384          | hash (Print(a0)) = 0w311 + hashtys a0
385          | hash (MathFn(a0)) = 0w313 + MathFns.hash a0
386    
387      fun toString IAdd = "IAdd"      fun toString IAdd = "IAdd"
388        | toString ISub = "ISub"        | toString ISub = "ISub"
# Line 411  Line 431 
431        | toString (R_Product(a0)) = concat["R_Product<", tyToString a0, ">"]        | toString (R_Product(a0)) = concat["R_Product<", tyToString a0, ">"]
432        | toString (R_Mean(a0)) = concat["R_Mean<", tyToString a0, ">"]        | toString (R_Mean(a0)) = concat["R_Mean<", tyToString a0, ">"]
433        | toString (R_Variance(a0)) = concat["R_Variance<", tyToString a0, ">"]        | toString (R_Variance(a0)) = concat["R_Variance<", tyToString a0, ">"]
434          | toString (BuildPos(a0)) = concat["BuildPos<", intToString a0, ">"]
435          | toString (EvalKernel(a0,a1,a2)) = concat["EvalKernel<", intToString a0, ",", Kernel.toString a1, ",", intToString a2, ">"]
436        | toString (Kernel(a0,a1)) = concat["Kernel<", Kernel.toString a0, ",", intToString a1, ">"]        | toString (Kernel(a0,a1)) = concat["Kernel<", Kernel.toString a0, ",", intToString a1, ">"]
437        | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]        | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]
438        | 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, ">"]  
       | toString (VoxelAddress(a0,a1)) = concat["VoxelAddress<", ImageInfo.toString a0, ",", intToString a1, ">"]  
       | toString (VoxelAddressWithCtl(a0,a1,a2)) = concat["VoxelAddressWithCtl<", ImageInfo.toString a0, ",", intToString a1, ",", idxctlToString a2, ">"]  
439        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", ImageInfo.toString a0, ",", intToString a1, ">"]
440          | toString (LoadVoxelsWithCtl(a0,a1,a2)) = concat["LoadVoxelsWithCtl<", ImageInfo.toString a0, ",", intToString a1, ",", idxctlToString a2, ">"]
441        | toString (Inside(a0,a1)) = concat["Inside<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (Inside(a0,a1)) = concat["Inside<", ImageInfo.toString a0, ",", intToString a1, ">"]
442        | toString (ImageDim(a0,a1)) = concat["ImageDim<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (ImageDim(a0,a1)) = concat["ImageDim<", ImageInfo.toString a0, ",", intToString a1, ">"]
443          | toString (BorderCtlDefault(a0)) = concat["BorderCtlDefault<", ImageInfo.toString a0, ">"]
444          | toString (BorderCtlClamp(a0)) = concat["BorderCtlClamp<", ImageInfo.toString a0, ">"]
445          | toString (BorderCtlMirror(a0)) = concat["BorderCtlMirror<", ImageInfo.toString a0, ">"]
446          | toString (BorderCtlWrap(a0)) = concat["BorderCtlWrap<", ImageInfo.toString a0, ">"]
447        | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]        | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]
448        | toString (LoadImage(a0,a1)) = concat["LoadImage<", tyToString a0, ",", stringToString a1, ">"]        | toString (LoadImage(a0,a1)) = concat["LoadImage<", tyToString a0, ",", stringToString a1, ">"]
449        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]

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

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