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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/low-il/low-il.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/low-il/low-il.sml

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

revision 2523, Fri Jan 17 19:25:37 2014 UTC revision 2525, Tue Jan 21 19:14:22 2014 UTC
# Line 49  Line 49 
49        | Max        | Max
50        | Min        | Min
51        | C of int        | C of int
52        | V of int * ty        | V of int * int * ty * ty
53        | S of int * ty        | S of int * ty * ty
       | addVec  
54        | addSca        | addSca
       | subVec  
55        | subSca        | subSca
       | prodVec  
56        | prodSca        | prodSca
       | prodScaV  
57        | divSca        | divSca
       | sumVec  
58        | cons of ty        | cons of ty
59        | img of int * ty        | img of int * ty * int
60        | krn of int * int        | addVec of int
61          | subVec of int
62          | prodVec of int
63          | prodScaV of int
64          | sumVec of int
65        | Clamp of ty        | Clamp of ty
66        | Lerp of ty        | Lerp of ty
67        | Norm of ty        | Norm of ty
# Line 89  Line 88 
88        | RealToInt of int        | RealToInt of int
89        | Transform of ImageInfo.info        | Transform of ImageInfo.info
90        | Translate of ImageInfo.info        | Translate of ImageInfo.info
91          | Kernel of Kernel.kernel * int
92        | ImageAddress of ImageInfo.info        | ImageAddress of ImageInfo.info
93        | LoadVoxels of ImageInfo.info * int        | LoadVoxels of ImageInfo.info * int
94        | Inside of ImageInfo.info * int        | Inside of ImageInfo.info * int
95        | LoadSeq of ty * string        | LoadSeq of ty * string
96        | LoadImage of ty * string * ImageInfo.info        | LoadImage of ImageInfo.info
97          | Input of ty * string * string
98          | InputWithDefault of ty * string * string
99        | Print of tys        | Print of tys
100    
101      fun resultArity IAdd = 1      fun resultArity IAdd = 1
# Line 114  Line 116 
116        | resultArity (C _) = 1        | resultArity (C _) = 1
117        | resultArity (V _) = 1        | resultArity (V _) = 1
118        | resultArity (S _) = 1        | resultArity (S _) = 1
       | resultArity addVec = 1  
119        | resultArity addSca = 1        | resultArity addSca = 1
       | resultArity subVec = 1  
120        | resultArity subSca = 1        | resultArity subSca = 1
       | resultArity prodVec = 1  
121        | resultArity prodSca = 1        | resultArity prodSca = 1
       | resultArity prodScaV = 1  
122        | resultArity divSca = 1        | resultArity divSca = 1
       | resultArity sumVec = 1  
123        | resultArity (cons _) = 1        | resultArity (cons _) = 1
124        | resultArity (img _) = 1        | resultArity (img _) = 1
125        | resultArity (krn _) = 1        | resultArity (addVec _) = 1
126          | resultArity (subVec _) = 1
127          | resultArity (prodVec _) = 1
128          | resultArity (prodScaV _) = 1
129          | resultArity (sumVec _) = 1
130        | resultArity (Clamp _) = 1        | resultArity (Clamp _) = 1
131        | resultArity (Lerp _) = 1        | resultArity (Lerp _) = 1
132        | resultArity (Norm _) = 1        | resultArity (Norm _) = 1
# Line 152  Line 153 
153        | resultArity (RealToInt _) = 1        | resultArity (RealToInt _) = 1
154        | resultArity (Transform _) = 1        | resultArity (Transform _) = 1
155        | resultArity (Translate _) = 1        | resultArity (Translate _) = 1
156          | resultArity (Kernel _) = 1
157        | resultArity (ImageAddress _) = 1        | resultArity (ImageAddress _) = 1
158        | resultArity (LoadVoxels _) = 1        | resultArity (LoadVoxels _) = 1
159        | resultArity (Inside _) = 1        | resultArity (Inside _) = 1
160        | resultArity (LoadSeq _) = 1        | resultArity (LoadSeq _) = 1
161        | resultArity (LoadImage _) = 1        | resultArity (LoadImage _) = 1
162          | resultArity (Input _) = 1
163          | resultArity (InputWithDefault _) = 1
164        | resultArity (Print _) = 0        | resultArity (Print _) = 0
165    
166      fun arity IAdd = 2      fun arity IAdd = 2
# Line 177  Line 181 
181        | arity (C _) = 2        | arity (C _) = 2
182        | arity (V _) = 2        | arity (V _) = 2
183        | arity (S _) = 2        | arity (S _) = 2
       | arity addVec = 2  
184        | arity addSca = 2        | arity addSca = 2
       | arity subVec = 2  
185        | arity subSca = 2        | arity subSca = 2
       | arity prodVec = 2  
186        | arity prodSca = 2        | arity prodSca = 2
       | arity prodScaV = 2  
187        | arity divSca = 2        | arity divSca = 2
       | arity sumVec = 2  
188        | arity (cons _) = 2        | arity (cons _) = 2
189        | arity (img _) = 2        | arity (img _) = 2
190        | arity (krn _) = 2        | arity (addVec _) = 2
191          | arity (subVec _) = 2
192          | arity (prodVec _) = 2
193          | arity (prodScaV _) = 2
194          | arity (sumVec _) = 2
195        | arity (Clamp _) = 3        | arity (Clamp _) = 3
196        | arity (Lerp _) = 3        | arity (Lerp _) = 3
197        | arity (Norm _) = 1        | arity (Norm _) = 1
# Line 215  Line 218 
218        | arity (RealToInt _) = 1        | arity (RealToInt _) = 1
219        | arity (Transform _) = 2        | arity (Transform _) = 2
220        | arity (Translate _) = 2        | arity (Translate _) = 2
221          | arity (Kernel _) = 0
222        | arity (ImageAddress _) = 1        | arity (ImageAddress _) = 1
223        | arity (LoadVoxels _) = 1        | arity (LoadVoxels _) = 1
224        | arity (Inside _) = 2        | arity (Inside _) = 2
225        | arity (LoadSeq _) = 0        | arity (LoadSeq _) = 0
226        | arity (LoadImage _) = 0        | arity (LoadImage _) = 0
227          | arity (Input _) = 0
228          | arity (InputWithDefault _) = 1
229        | arity (Print _) = ~1        | arity (Print _) = ~1
230    
231      fun isPure (MkDynamic _) = false      fun isPure (MkDynamic _) = false
# Line 245  Line 251 
251        | same (Max, Max) = true        | same (Max, Max) = true
252        | same (Min, Min) = true        | same (Min, Min) = true
253        | same (C(a0), C(b0)) = sameint(a0, b0)        | same (C(a0), C(b0)) = sameint(a0, b0)
254        | same (V(a0,a1), V(b0,b1)) = sameint(a0, b0) andalso samety(a1, b1)        | same (V(a0,a1,a2,a3), V(b0,b1,b2,b3)) = sameint(a0, b0) andalso sameint(a1, b1) andalso samety(a2, b2) andalso samety(a3, b3)
255        | same (S(a0,a1), S(b0,b1)) = sameint(a0, b0) andalso samety(a1, b1)        | same (S(a0,a1,a2), S(b0,b1,b2)) = sameint(a0, b0) andalso samety(a1, b1) andalso samety(a2, b2)
       | same (addVec, addVec) = true  
256        | same (addSca, addSca) = true        | same (addSca, addSca) = true
       | same (subVec, subVec) = true  
257        | same (subSca, subSca) = true        | same (subSca, subSca) = true
       | same (prodVec, prodVec) = true  
258        | same (prodSca, prodSca) = true        | same (prodSca, prodSca) = true
       | same (prodScaV, prodScaV) = true  
259        | same (divSca, divSca) = true        | same (divSca, divSca) = true
       | same (sumVec, sumVec) = true  
260        | same (cons(a0), cons(b0)) = samety(a0, b0)        | same (cons(a0), cons(b0)) = samety(a0, b0)
261        | same (img(a0,a1), img(b0,b1)) = sameint(a0, b0) andalso samety(a1, b1)        | same (img(a0,a1,a2), img(b0,b1,b2)) = sameint(a0, b0) andalso samety(a1, b1) andalso sameint(a2, b2)
262        | same (krn(a0,a1), krn(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)        | same (addVec(a0), addVec(b0)) = sameint(a0, b0)
263          | same (subVec(a0), subVec(b0)) = sameint(a0, b0)
264          | same (prodVec(a0), prodVec(b0)) = sameint(a0, b0)
265          | same (prodScaV(a0), prodScaV(b0)) = sameint(a0, b0)
266          | same (sumVec(a0), sumVec(b0)) = sameint(a0, b0)
267        | same (Clamp(a0), Clamp(b0)) = samety(a0, b0)        | same (Clamp(a0), Clamp(b0)) = samety(a0, b0)
268        | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)        | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)
269        | same (Norm(a0), Norm(b0)) = samety(a0, b0)        | same (Norm(a0), Norm(b0)) = samety(a0, b0)
# Line 285  Line 290 
290        | same (RealToInt(a0), RealToInt(b0)) = sameint(a0, b0)        | same (RealToInt(a0), RealToInt(b0)) = sameint(a0, b0)
291        | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)        | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)
292        | same (Translate(a0), Translate(b0)) = ImageInfo.same(a0, b0)        | same (Translate(a0), Translate(b0)) = ImageInfo.same(a0, b0)
293          | same (Kernel(a0,a1), Kernel(b0,b1)) = Kernel.same(a0, b0) andalso sameint(a1, b1)
294        | same (ImageAddress(a0), ImageAddress(b0)) = ImageInfo.same(a0, b0)        | same (ImageAddress(a0), ImageAddress(b0)) = ImageInfo.same(a0, b0)
295        | 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)
296        | 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)
297        | 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)
298        | same (LoadImage(a0,a1,a2), LoadImage(b0,b1,b2)) = samety(a0, b0) andalso samestring(a1, b1) andalso ImageInfo.same(a2, b2)        | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)
299          | same (Input(a0,a1,a2), Input(b0,b1,b2)) = samety(a0, b0) andalso samestring(a1, b1) andalso samestring(a2, b2)
300          | same (InputWithDefault(a0,a1,a2), InputWithDefault(b0,b1,b2)) = samety(a0, b0) andalso samestring(a1, b1) andalso samestring(a2, b2)
301        | same (Print(a0), Print(b0)) = sametys(a0, b0)        | same (Print(a0), Print(b0)) = sametys(a0, b0)
302        | same _ = false        | same _ = false
303    
# Line 309  Line 317 
317        | hash Max = 0w47        | hash Max = 0w47
318        | hash Min = 0w53        | hash Min = 0w53
319        | hash (C(a0)) = 0w59 + hashint a0        | hash (C(a0)) = 0w59 + hashint a0
320        | hash (V(a0,a1)) = 0w61 + hashint a0 + hashty a1        | hash (V(a0,a1,a2,a3)) = 0w61 + hashint a0 + hashint a1 + hashty a2 + hashty a3
321        | hash (S(a0,a1)) = 0w67 + hashint a0 + hashty a1        | hash (S(a0,a1,a2)) = 0w67 + hashint a0 + hashty a1 + hashty a2
322        | hash addVec = 0w71        | hash addSca = 0w71
323        | hash addSca = 0w73        | hash subSca = 0w73
324        | hash subVec = 0w79        | hash prodSca = 0w79
325        | hash subSca = 0w83        | hash divSca = 0w83
326        | hash prodVec = 0w89        | hash (cons(a0)) = 0w89 + hashty a0
327        | hash prodSca = 0w97        | hash (img(a0,a1,a2)) = 0w97 + hashint a0 + hashty a1 + hashint a2
328        | hash prodScaV = 0w101        | hash (addVec(a0)) = 0w101 + hashint a0
329        | hash divSca = 0w103        | hash (subVec(a0)) = 0w103 + hashint a0
330        | hash sumVec = 0w107        | hash (prodVec(a0)) = 0w107 + hashint a0
331        | hash (cons(a0)) = 0w109 + hashty a0        | hash (prodScaV(a0)) = 0w109 + hashint a0
332        | hash (img(a0,a1)) = 0w113 + hashint a0 + hashty a1        | hash (sumVec(a0)) = 0w113 + hashint a0
333        | hash (krn(a0,a1)) = 0w127 + hashint a0 + hashint a1        | hash (Clamp(a0)) = 0w127 + hashty a0
334        | hash (Clamp(a0)) = 0w131 + hashty a0        | hash (Lerp(a0)) = 0w131 + hashty a0
335        | hash (Lerp(a0)) = 0w137 + hashty a0        | hash (Norm(a0)) = 0w137 + hashty a0
336        | hash (Norm(a0)) = 0w139 + hashty a0        | hash (Normalize(a0)) = 0w139 + hashint a0
337        | hash (Normalize(a0)) = 0w149 + hashint a0        | hash (PrincipleEvec(a0)) = 0w149 + hashty a0
338        | hash (PrincipleEvec(a0)) = 0w151 + hashty a0        | hash EigenVecs2x2 = 0w151
339        | hash EigenVecs2x2 = 0w157        | hash EigenVecs3x3 = 0w157
340        | hash EigenVecs3x3 = 0w163        | hash EigenVals2x2 = 0w163
341        | hash EigenVals2x2 = 0w167        | hash EigenVals3x3 = 0w167
342        | hash EigenVals3x3 = 0w173        | hash (Zero(a0)) = 0w173 + hashty a0
343        | hash (Zero(a0)) = 0w179 + hashty a0        | hash (Select(a0,a1)) = 0w179 + hashty a0 + hashint a1
344        | hash (Select(a0,a1)) = 0w181 + hashty a0 + hashint a1        | hash (Index(a0,a1)) = 0w181 + hashty a0 + hashint a1
345        | hash (Index(a0,a1)) = 0w191 + hashty a0 + hashint a1        | hash (Subscript(a0)) = 0w191 + hashty a0
346        | hash (Subscript(a0)) = 0w193 + hashty a0        | hash (MkDynamic(a0,a1)) = 0w193 + hashty a0 + hashint a1
347        | hash (MkDynamic(a0,a1)) = 0w197 + hashty a0 + hashint a1        | hash (Append(a0)) = 0w197 + hashty a0
348        | hash (Append(a0)) = 0w199 + hashty a0        | hash (Prepend(a0)) = 0w199 + hashty a0
349        | hash (Prepend(a0)) = 0w211 + hashty a0        | hash (Concat(a0)) = 0w211 + hashty a0
350        | hash (Concat(a0)) = 0w223 + hashty a0        | hash (Length(a0)) = 0w223 + hashty a0
351        | hash (Length(a0)) = 0w227 + hashty a0        | hash (Ceiling(a0)) = 0w227 + hashint a0
352        | hash (Ceiling(a0)) = 0w229 + hashint a0        | hash (Floor(a0)) = 0w229 + hashint a0
353        | hash (Floor(a0)) = 0w233 + hashint a0        | hash (Round(a0)) = 0w233 + hashint a0
354        | hash (Round(a0)) = 0w239 + hashint a0        | hash (Trunc(a0)) = 0w239 + hashint a0
355        | hash (Trunc(a0)) = 0w241 + hashint a0        | hash IntToReal = 0w241
356        | hash IntToReal = 0w251        | hash (RealToInt(a0)) = 0w251 + hashint a0
357        | hash (RealToInt(a0)) = 0w257 + hashint a0        | hash (Transform(a0)) = 0w257 + ImageInfo.hash a0
358        | hash (Transform(a0)) = 0w263 + ImageInfo.hash a0        | hash (Translate(a0)) = 0w263 + ImageInfo.hash a0
359        | hash (Translate(a0)) = 0w269 + ImageInfo.hash a0        | hash (Kernel(a0,a1)) = 0w269 + Kernel.hash a0 + hashint a1
360        | hash (ImageAddress(a0)) = 0w271 + ImageInfo.hash a0        | hash (ImageAddress(a0)) = 0w271 + ImageInfo.hash a0
361        | hash (LoadVoxels(a0,a1)) = 0w277 + ImageInfo.hash a0 + hashint a1        | hash (LoadVoxels(a0,a1)) = 0w277 + ImageInfo.hash a0 + hashint a1
362        | hash (Inside(a0,a1)) = 0w281 + ImageInfo.hash a0 + hashint a1        | hash (Inside(a0,a1)) = 0w281 + ImageInfo.hash a0 + hashint a1
363        | hash (LoadSeq(a0,a1)) = 0w283 + hashty a0 + hashstring a1        | hash (LoadSeq(a0,a1)) = 0w283 + hashty a0 + hashstring a1
364        | hash (LoadImage(a0,a1,a2)) = 0w293 + hashty a0 + hashstring a1 + ImageInfo.hash a2        | hash (LoadImage(a0)) = 0w293 + ImageInfo.hash a0
365        | hash (Print(a0)) = 0w307 + hashtys a0        | hash (Input(a0,a1,a2)) = 0w307 + hashty a0 + hashstring a1 + hashstring a2
366          | hash (InputWithDefault(a0,a1,a2)) = 0w311 + hashty a0 + hashstring a1 + hashstring a2
367          | hash (Print(a0)) = 0w313 + hashtys a0
368    
369      fun toString IAdd = "IAdd"      fun toString IAdd = "IAdd"
370        | toString ISub = "ISub"        | toString ISub = "ISub"
# Line 372  Line 382 
382        | toString Max = "Max"        | toString Max = "Max"
383        | toString Min = "Min"        | toString Min = "Min"
384        | toString (C(a0)) = concat["C<", intToString a0, ">"]        | toString (C(a0)) = concat["C<", intToString a0, ">"]
385        | toString (V(a0,a1)) = concat["V<", intToString a0, ",", tyToString a1, ">"]        | toString (V(a0,a1,a2,a3)) = concat["V<", intToString a0, ",", intToString a1, ",", tyToString a2, ",", tyToString a3, ">"]
386        | toString (S(a0,a1)) = concat["S<", intToString a0, ",", tyToString a1, ">"]        | toString (S(a0,a1,a2)) = concat["S<", intToString a0, ",", tyToString a1, ",", tyToString a2, ">"]
       | toString addVec = "addVec"  
387        | toString addSca = "addSca"        | toString addSca = "addSca"
       | toString subVec = "subVec"  
388        | toString subSca = "subSca"        | toString subSca = "subSca"
       | toString prodVec = "prodVec"  
389        | toString prodSca = "prodSca"        | toString prodSca = "prodSca"
       | toString prodScaV = "prodScaV"  
390        | toString divSca = "divSca"        | toString divSca = "divSca"
       | toString sumVec = "sumVec"  
391        | toString (cons(a0)) = concat["cons<", tyToString a0, ">"]        | toString (cons(a0)) = concat["cons<", tyToString a0, ">"]
392        | toString (img(a0,a1)) = concat["img<", intToString a0, ",", tyToString a1, ">"]        | toString (img(a0,a1,a2)) = concat["img<", intToString a0, ",", tyToString a1, ",", intToString a2, ">"]
393        | toString (krn(a0,a1)) = concat["krn<", intToString a0, ",", intToString a1, ">"]        | toString (addVec(a0)) = concat["addVec<", intToString a0, ">"]
394          | toString (subVec(a0)) = concat["subVec<", intToString a0, ">"]
395          | toString (prodVec(a0)) = concat["prodVec<", intToString a0, ">"]
396          | toString (prodScaV(a0)) = concat["prodScaV<", intToString a0, ">"]
397          | toString (sumVec(a0)) = concat["sumVec<", intToString a0, ">"]
398        | toString (Clamp(a0)) = concat["Clamp<", tyToString a0, ">"]        | toString (Clamp(a0)) = concat["Clamp<", tyToString a0, ">"]
399        | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]        | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]
400        | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"]        | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"]
# Line 412  Line 421 
421        | toString (RealToInt(a0)) = concat["RealToInt<", intToString a0, ">"]        | toString (RealToInt(a0)) = concat["RealToInt<", intToString a0, ">"]
422        | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]        | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]
423        | toString (Translate(a0)) = concat["Translate<", ImageInfo.toString a0, ">"]        | toString (Translate(a0)) = concat["Translate<", ImageInfo.toString a0, ">"]
424          | toString (Kernel(a0,a1)) = concat["Kernel<", Kernel.toString a0, ",", intToString a1, ">"]
425        | toString (ImageAddress(a0)) = concat["ImageAddress<", ImageInfo.toString a0, ">"]        | toString (ImageAddress(a0)) = concat["ImageAddress<", ImageInfo.toString a0, ">"]
426        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", ImageInfo.toString a0, ",", intToString a1, ">"]
427        | toString (Inside(a0,a1)) = concat["Inside<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (Inside(a0,a1)) = concat["Inside<", ImageInfo.toString a0, ",", intToString a1, ">"]
428        | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]        | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]
429        | toString (LoadImage(a0,a1,a2)) = concat["LoadImage<", tyToString a0, ",", stringToString a1, ",", ImageInfo.toString a2, ">"]        | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]
430          | toString (Input(a0,a1,a2)) = concat["Input<", tyToString a0, ",", stringToString a1, ",", stringToString a2, ">"]
431          | toString (InputWithDefault(a0,a1,a2)) = concat["InputWithDefault<", tyToString a0, ",", stringToString a1, ",", stringToString a2, ">"]
432        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]
433    
434    end    end

Legend:
Removed from v.2523  
changed lines
  Added in v.2525

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