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

trunk/src/compiler/low-il/low-il.sml revision 1295, Thu Jun 9 06:42:54 2011 UTC branches/charisee/src/compiler/low-il/low-il.sml revision 2668, Thu Jun 12 03:29:04 2014 UTC
# Line 10  Line 10 
10  structure LowOps =  structure LowOps =
11    struct    struct
12    
13      (* required helper functions for types *)
14      type ty = LowILTypes.ty      type ty = LowILTypes.ty
   
15      val samety = LowILTypes.same      val samety = LowILTypes.same
16      val hashty = LowILTypes.hash      val hashty = LowILTypes.hash
17      val tyToString = LowILTypes.toString      val tyToString = LowILTypes.toString
18    
19      (* required helper functions for type lists *)
20        type tys = ty list
21        fun sametys (tys1, tys2) = ListPair.allEq samety (tys1, tys2)
22        fun hashtys tys = List.foldl (fn (ty, s) => hashty ty + 0w3 * s) 0w0 tys
23        fun tysToString tys = String.concat["[", String.concatWith "," (List.map tyToString tys), "]" ]
24    
25      (* required helper functions for the int type *)
26      fun sameint (i1 : int, i2) = (i1 = i2)      fun sameint (i1 : int, i2) = (i1 = i2)
27      fun hashint i = Word.fromInt i      fun hashint i = Word.fromInt i
28      fun intToString i = Int.toString i      fun intToString i = Int.toString i
29    
30      (* required helper functions for the string type *)
31      fun samestring (s1 : string, s2) = (s1 = s2)      fun samestring (s1 : string, s2) = (s1 = s2)
32      val hashstring = HashString.hashString      val hashstring = HashString.hashString
33      fun stringToString s = String.concat["\"", s, "\""]      fun stringToString s = String.concat["\"", s, "\""]
34    
35      datatype rator      datatype rator
36        = Add of ty        = IAdd
37        | Sub of ty        | ISub
38        | Mul of ty        | IMul
39        | Div of ty        | IDiv
40        | Neg of ty        | INeg
41          | IndexTensor of int * ty * ty * ty
42          | addSca
43          | subSca
44          | prodSca
45          | divSca
46          | addVec of int
47          | subVec of int
48          | prodVec of int
49          | prodScaV of int
50          | sumVec of int
51        | Abs of ty        | Abs of ty
52        | LT of ty        | LT of ty
53        | LTE of ty        | LTE of ty
# Line 42  Line 60 
60        | Min        | Min
61        | Clamp of ty        | Clamp of ty
62        | Lerp of ty        | Lerp of ty
       | Dot of int  
       | MulVecMat of int * int  
       | MulMatVec of int * int  
       | MulMatMat of int * int * int  
       | Cross  
       | Select of ty * int  
       | Norm of ty  
       | Normalize of int  
       | Scale of ty  
       | CL  
63        | PrincipleEvec of ty        | PrincipleEvec of ty
64        | Identity of int        | EigenVecs2x2
65          | EigenVecs3x3
66          | EigenVals2x2
67          | EigenVals3x3
68        | Zero of ty        | Zero of ty
69        | Trace of int        | Select of ty * int
70          | Index of ty * int
71        | Subscript of ty        | Subscript of ty
72          | MkDynamic of ty * int
73          | Append of ty
74          | Prepend of ty
75          | Concat of ty
76          | Sqrt
77        | Ceiling of int        | Ceiling of int
78        | Floor of int        | Floor of int
79        | Round of int        | Round of int
80        | Trunc of int        | Trunc of int
81        | IntToReal        | IntToReal
82        | RealToInt of int        | RealToInt of int
83          | Transform of ImageInfo.info
84          | Translate of ImageInfo.info
85          | Kernel of Kernel.kernel * int
86        | ImageAddress of ImageInfo.info        | ImageAddress of ImageInfo.info
87        | LoadVoxels of ImageInfo.info * int        | LoadVoxels of ImageInfo.info * int
       | PosToImgSpace of ImageInfo.info  
       | TensorToWorldSpace of ImageInfo.info * ty  
       | LoadImage of ImageInfo.info  
88        | Inside of ImageInfo.info * int        | Inside of ImageInfo.info * int
89        | Input of ty * string        | LoadSeq of ty * string
90        | InputWithDefault of ty * string        | LoadImage of ImageInfo.info
91          | imgAddr of ImageInfo.info * ty * int
92      fun arity (Add _) = 2        | imgLoad of ImageInfo.info * int * int
93        | arity (Sub _) = 2        | Input of ty * string * string
94        | arity (Mul _) = 2        | InputWithDefault of ty * string * string
95        | arity (Div _) = 2        | Print of tys
96        | arity (Neg _) = 1  
97        fun resultArity IAdd = 1
98          | resultArity ISub = 1
99          | resultArity IMul = 1
100          | resultArity IDiv = 1
101          | resultArity INeg = 1
102          | resultArity (IndexTensor _) = 1
103          | resultArity addSca = 1
104          | resultArity subSca = 1
105          | resultArity prodSca = 1
106          | resultArity divSca = 1
107          | resultArity (addVec _) = 1
108          | resultArity (subVec _) = 1
109          | resultArity (prodVec _) = 1
110          | resultArity (prodScaV _) = 1
111          | resultArity (sumVec _) = 1
112          | resultArity (Abs _) = 1
113          | resultArity (LT _) = 1
114          | resultArity (LTE _) = 1
115          | resultArity (EQ _) = 1
116          | resultArity (NEQ _) = 1
117          | resultArity (GT _) = 1
118          | resultArity (GTE _) = 1
119          | resultArity Not = 1
120          | resultArity Max = 1
121          | resultArity Min = 1
122          | resultArity (Clamp _) = 1
123          | resultArity (Lerp _) = 1
124          | resultArity (PrincipleEvec _) = 1
125          | resultArity EigenVecs2x2 = 1
126          | resultArity EigenVecs3x3 = 1
127          | resultArity EigenVals2x2 = 1
128          | resultArity EigenVals3x3 = 1
129          | resultArity (Zero _) = 1
130          | resultArity (Select _) = 1
131          | resultArity (Index _) = 1
132          | resultArity (Subscript _) = 1
133          | resultArity (MkDynamic _) = 1
134          | resultArity (Append _) = 2
135          | resultArity (Prepend _) = 2
136          | resultArity (Concat _) = 2
137          | resultArity Sqrt = 1
138          | resultArity (Ceiling _) = 1
139          | resultArity (Floor _) = 1
140          | resultArity (Round _) = 1
141          | resultArity (Trunc _) = 1
142          | resultArity IntToReal = 1
143          | resultArity (RealToInt _) = 1
144          | resultArity (Transform _) = 1
145          | resultArity (Translate _) = 1
146          | resultArity (Kernel _) = 1
147          | resultArity (ImageAddress _) = 1
148          | resultArity (LoadVoxels _) = 1
149          | resultArity (Inside _) = 1
150          | resultArity (LoadSeq _) = 1
151          | resultArity (LoadImage _) = 1
152          | resultArity (imgAddr _) = 1
153          | resultArity (imgLoad _) = 1
154          | resultArity (Input _) = 1
155          | resultArity (InputWithDefault _) = 1
156          | resultArity (Print _) = 0
157    
158        fun arity IAdd = 2
159          | arity ISub = 2
160          | arity IMul = 2
161          | arity IDiv = 2
162          | arity INeg = 1
163          | arity (IndexTensor _) = 2
164          | arity addSca = 2
165          | arity subSca = 2
166          | arity prodSca = 2
167          | arity divSca = 2
168          | arity (addVec _) = 2
169          | arity (subVec _) = 2
170          | arity (prodVec _) = 2
171          | arity (prodScaV _) = 2
172          | arity (sumVec _) = 2
173        | arity (Abs _) = 1        | arity (Abs _) = 1
174        | arity (LT _) = 2        | arity (LT _) = 2
175        | arity (LTE _) = 2        | arity (LTE _) = 2
# Line 89  Line 182 
182        | arity Min = 2        | arity Min = 2
183        | arity (Clamp _) = 3        | arity (Clamp _) = 3
184        | arity (Lerp _) = 3        | arity (Lerp _) = 3
       | arity (Dot _) = 2  
       | arity (MulVecMat _) = 2  
       | arity (MulMatVec _) = 2  
       | arity (MulMatMat _) = 2  
       | arity Cross = 2  
       | arity (Select _) = 1  
       | arity (Norm _) = 1  
       | arity (Normalize _) = 1  
       | arity (Scale _) = 2  
       | arity CL = 1  
185        | arity (PrincipleEvec _) = 2        | arity (PrincipleEvec _) = 2
186        | arity (Identity _) = 0        | arity EigenVecs2x2 = 1
187          | arity EigenVecs3x3 = 1
188          | arity EigenVals2x2 = 1
189          | arity EigenVals3x3 = 1
190        | arity (Zero _) = 0        | arity (Zero _) = 0
191        | arity (Trace _) = 1        | arity (Select _) = 1
192          | arity (Index _) = 1
193        | arity (Subscript _) = 2        | arity (Subscript _) = 2
194          | arity (MkDynamic _) = 1
195          | arity (Append _) = 1
196          | arity (Prepend _) = 1
197          | arity (Concat _) = 1
198          | arity Sqrt = 1
199        | arity (Ceiling _) = 1        | arity (Ceiling _) = 1
200        | arity (Floor _) = 1        | arity (Floor _) = 1
201        | arity (Round _) = 1        | arity (Round _) = 1
202        | arity (Trunc _) = 1        | arity (Trunc _) = 1
203        | arity IntToReal = 1        | arity IntToReal = 1
204        | arity (RealToInt _) = 1        | arity (RealToInt _) = 1
205          | arity (Transform _) = 2
206          | arity (Translate _) = 2
207          | arity (Kernel _) = 0
208        | arity (ImageAddress _) = 1        | arity (ImageAddress _) = 1
209        | arity (LoadVoxels _) = 1        | arity (LoadVoxels _) = 1
       | arity (PosToImgSpace _) = 2  
       | arity (TensorToWorldSpace _) = 2  
       | arity (LoadImage _) = 1  
210        | arity (Inside _) = 2        | arity (Inside _) = 2
211          | arity (LoadSeq _) = 0
212          | arity (LoadImage _) = 0
213          | arity (imgAddr _) = 2
214          | arity (imgLoad _) = 2
215        | arity (Input _) = 0        | arity (Input _) = 0
216        | arity (InputWithDefault _) = 1        | arity (InputWithDefault _) = 1
217          | arity (Print _) = ~1
218    
219      fun same (Add(a0), Add(b0)) = samety(a0, b0)      fun isPure (MkDynamic _) = false
220        | same (Sub(a0), Sub(b0)) = samety(a0, b0)        | isPure (Append _) = false
221        | same (Mul(a0), Mul(b0)) = samety(a0, b0)        | isPure (Prepend _) = false
222        | same (Div(a0), Div(b0)) = samety(a0, b0)        | isPure (Concat _) = false
223        | same (Neg(a0), Neg(b0)) = samety(a0, b0)        | isPure (Print _) = false
224          | isPure _ = true
225    
226        fun same (IAdd, IAdd) = true
227          | same (ISub, ISub) = true
228          | same (IMul, IMul) = true
229          | same (IDiv, IDiv) = true
230          | same (INeg, INeg) = true
231          | same (IndexTensor(a0,a1,a2,a3), IndexTensor(b0,b1,b2,b3)) = sameint(a0, b0) andalso samety(a1, b1) andalso samety(a2, b2) andalso samety(a3, b3)
232          | same (addSca, addSca) = true
233          | same (subSca, subSca) = true
234          | same (prodSca, prodSca) = true
235          | same (divSca, divSca) = true
236          | same (addVec(a0), addVec(b0)) = sameint(a0, b0)
237          | same (subVec(a0), subVec(b0)) = sameint(a0, b0)
238          | same (prodVec(a0), prodVec(b0)) = sameint(a0, b0)
239          | same (prodScaV(a0), prodScaV(b0)) = sameint(a0, b0)
240          | same (sumVec(a0), sumVec(b0)) = sameint(a0, b0)
241        | same (Abs(a0), Abs(b0)) = samety(a0, b0)        | same (Abs(a0), Abs(b0)) = samety(a0, b0)
242        | same (LT(a0), LT(b0)) = samety(a0, b0)        | same (LT(a0), LT(b0)) = samety(a0, b0)
243        | same (LTE(a0), LTE(b0)) = samety(a0, b0)        | same (LTE(a0), LTE(b0)) = samety(a0, b0)
# Line 136  Line 250 
250        | same (Min, Min) = true        | same (Min, Min) = true
251        | same (Clamp(a0), Clamp(b0)) = samety(a0, b0)        | same (Clamp(a0), Clamp(b0)) = samety(a0, b0)
252        | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)        | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)
       | same (Dot(a0), Dot(b0)) = sameint(a0, b0)  
       | same (MulVecMat(a0,a1), MulVecMat(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)  
       | same (MulMatVec(a0,a1), MulMatVec(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)  
       | same (MulMatMat(a0,a1,a2), MulMatMat(b0,b1,b2)) = sameint(a0, b0) andalso sameint(a1, b1) andalso sameint(a2, b2)  
       | same (Cross, Cross) = true  
       | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)  
       | same (Norm(a0), Norm(b0)) = samety(a0, b0)  
       | same (Normalize(a0), Normalize(b0)) = sameint(a0, b0)  
       | same (Scale(a0), Scale(b0)) = samety(a0, b0)  
       | same (CL, CL) = true  
253        | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0)        | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0)
254        | same (Identity(a0), Identity(b0)) = sameint(a0, b0)        | same (EigenVecs2x2, EigenVecs2x2) = true
255          | same (EigenVecs3x3, EigenVecs3x3) = true
256          | same (EigenVals2x2, EigenVals2x2) = true
257          | same (EigenVals3x3, EigenVals3x3) = true
258        | same (Zero(a0), Zero(b0)) = samety(a0, b0)        | same (Zero(a0), Zero(b0)) = samety(a0, b0)
259        | same (Trace(a0), Trace(b0)) = sameint(a0, b0)        | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
260          | same (Index(a0,a1), Index(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
261        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)
262          | same (MkDynamic(a0,a1), MkDynamic(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
263          | same (Append(a0), Append(b0)) = samety(a0, b0)
264          | same (Prepend(a0), Prepend(b0)) = samety(a0, b0)
265          | same (Concat(a0), Concat(b0)) = samety(a0, b0)
266          | same (Sqrt, Sqrt) = true
267        | same (Ceiling(a0), Ceiling(b0)) = sameint(a0, b0)        | same (Ceiling(a0), Ceiling(b0)) = sameint(a0, b0)
268        | same (Floor(a0), Floor(b0)) = sameint(a0, b0)        | same (Floor(a0), Floor(b0)) = sameint(a0, b0)
269        | same (Round(a0), Round(b0)) = sameint(a0, b0)        | same (Round(a0), Round(b0)) = sameint(a0, b0)
270        | same (Trunc(a0), Trunc(b0)) = sameint(a0, b0)        | same (Trunc(a0), Trunc(b0)) = sameint(a0, b0)
271        | same (IntToReal, IntToReal) = true        | same (IntToReal, IntToReal) = true
272        | same (RealToInt(a0), RealToInt(b0)) = sameint(a0, b0)        | same (RealToInt(a0), RealToInt(b0)) = sameint(a0, b0)
273          | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)
274          | same (Translate(a0), Translate(b0)) = ImageInfo.same(a0, b0)
275          | same (Kernel(a0,a1), Kernel(b0,b1)) = Kernel.same(a0, b0) andalso sameint(a1, b1)
276        | same (ImageAddress(a0), ImageAddress(b0)) = ImageInfo.same(a0, b0)        | same (ImageAddress(a0), ImageAddress(b0)) = ImageInfo.same(a0, b0)
277        | 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)
       | same (PosToImgSpace(a0), PosToImgSpace(b0)) = ImageInfo.same(a0, b0)  
       | same (TensorToWorldSpace(a0,a1), TensorToWorldSpace(b0,b1)) = ImageInfo.same(a0, b0) andalso samety(a1, b1)  
       | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)  
278        | 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)
279        | same (Input(a0,a1), Input(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)        | same (LoadSeq(a0,a1), LoadSeq(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)
280        | same (InputWithDefault(a0,a1), InputWithDefault(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)        | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)
281          | same (imgAddr(a0,a1,a2), imgAddr(b0,b1,b2)) = ImageInfo.same(a0, b0) andalso samety(a1, b1) andalso sameint(a2, b2)
282          | same (imgLoad(a0,a1,a2), imgLoad(b0,b1,b2)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1) andalso sameint(a2, b2)
283          | same (Input(a0,a1,a2), Input(b0,b1,b2)) = samety(a0, b0) andalso samestring(a1, b1) andalso samestring(a2, b2)
284          | same (InputWithDefault(a0,a1,a2), InputWithDefault(b0,b1,b2)) = samety(a0, b0) andalso samestring(a1, b1) andalso samestring(a2, b2)
285          | same (Print(a0), Print(b0)) = sametys(a0, b0)
286        | same _ = false        | same _ = false
287    
288      fun hash (Add(a0)) = 0w3 + hashty a0      fun hash IAdd = 0w3
289        | hash (Sub(a0)) = 0w5 + hashty a0        | hash ISub = 0w5
290        | hash (Mul(a0)) = 0w7 + hashty a0        | hash IMul = 0w7
291        | hash (Div(a0)) = 0w11 + hashty a0        | hash IDiv = 0w11
292        | hash (Neg(a0)) = 0w13 + hashty a0        | hash INeg = 0w13
293        | hash (Abs(a0)) = 0w17 + hashty a0        | hash (IndexTensor(a0,a1,a2,a3)) = 0w17 + hashint a0 + hashty a1 + hashty a2 + hashty a3
294        | hash (LT(a0)) = 0w19 + hashty a0        | hash addSca = 0w19
295        | hash (LTE(a0)) = 0w23 + hashty a0        | hash subSca = 0w23
296        | hash (EQ(a0)) = 0w29 + hashty a0        | hash prodSca = 0w29
297        | hash (NEQ(a0)) = 0w31 + hashty a0        | hash divSca = 0w31
298        | hash (GT(a0)) = 0w37 + hashty a0        | hash (addVec(a0)) = 0w37 + hashint a0
299        | hash (GTE(a0)) = 0w41 + hashty a0        | hash (subVec(a0)) = 0w41 + hashint a0
300        | hash Not = 0w43        | hash (prodVec(a0)) = 0w43 + hashint a0
301        | hash Max = 0w47        | hash (prodScaV(a0)) = 0w47 + hashint a0
302        | hash Min = 0w53        | hash (sumVec(a0)) = 0w53 + hashint a0
303        | hash (Clamp(a0)) = 0w59 + hashty a0        | hash (Abs(a0)) = 0w59 + hashty a0
304        | hash (Lerp(a0)) = 0w61 + hashty a0        | hash (LT(a0)) = 0w61 + hashty a0
305        | hash (Dot(a0)) = 0w67 + hashint a0        | hash (LTE(a0)) = 0w67 + hashty a0
306        | hash (MulVecMat(a0,a1)) = 0w71 + hashint a0 + hashint a1        | hash (EQ(a0)) = 0w71 + hashty a0
307        | hash (MulMatVec(a0,a1)) = 0w73 + hashint a0 + hashint a1        | hash (NEQ(a0)) = 0w73 + hashty a0
308        | hash (MulMatMat(a0,a1,a2)) = 0w79 + hashint a0 + hashint a1 + hashint a2        | hash (GT(a0)) = 0w79 + hashty a0
309        | hash Cross = 0w83        | hash (GTE(a0)) = 0w83 + hashty a0
310        | hash (Select(a0,a1)) = 0w89 + hashty a0 + hashint a1        | hash Not = 0w89
311        | hash (Norm(a0)) = 0w97 + hashty a0        | hash Max = 0w97
312        | hash (Normalize(a0)) = 0w101 + hashint a0        | hash Min = 0w101
313        | hash (Scale(a0)) = 0w103 + hashty a0        | hash (Clamp(a0)) = 0w103 + hashty a0
314        | hash CL = 0w107        | hash (Lerp(a0)) = 0w107 + hashty a0
315        | hash (PrincipleEvec(a0)) = 0w109 + hashty a0        | hash (PrincipleEvec(a0)) = 0w109 + hashty a0
316        | hash (Identity(a0)) = 0w113 + hashint a0        | hash EigenVecs2x2 = 0w113
317        | hash (Zero(a0)) = 0w127 + hashty a0        | hash EigenVecs3x3 = 0w127
318        | hash (Trace(a0)) = 0w131 + hashint a0        | hash EigenVals2x2 = 0w131
319        | hash (Subscript(a0)) = 0w137 + hashty a0        | hash EigenVals3x3 = 0w137
320        | hash (Ceiling(a0)) = 0w139 + hashint a0        | hash (Zero(a0)) = 0w139 + hashty a0
321        | hash (Floor(a0)) = 0w149 + hashint a0        | hash (Select(a0,a1)) = 0w149 + hashty a0 + hashint a1
322        | hash (Round(a0)) = 0w151 + hashint a0        | hash (Index(a0,a1)) = 0w151 + hashty a0 + hashint a1
323        | hash (Trunc(a0)) = 0w157 + hashint a0        | hash (Subscript(a0)) = 0w157 + hashty a0
324        | hash IntToReal = 0w163        | hash (MkDynamic(a0,a1)) = 0w163 + hashty a0 + hashint a1
325        | hash (RealToInt(a0)) = 0w167 + hashint a0        | hash (Append(a0)) = 0w167 + hashty a0
326        | hash (ImageAddress(a0)) = 0w173 + ImageInfo.hash a0        | hash (Prepend(a0)) = 0w173 + hashty a0
327        | hash (LoadVoxels(a0,a1)) = 0w179 + ImageInfo.hash a0 + hashint a1        | hash (Concat(a0)) = 0w179 + hashty a0
328        | hash (PosToImgSpace(a0)) = 0w181 + ImageInfo.hash a0        | hash Sqrt = 0w181
329        | hash (TensorToWorldSpace(a0,a1)) = 0w191 + ImageInfo.hash a0 + hashty a1        | hash (Ceiling(a0)) = 0w191 + hashint a0
330        | hash (LoadImage(a0)) = 0w193 + ImageInfo.hash a0        | hash (Floor(a0)) = 0w193 + hashint a0
331        | hash (Inside(a0,a1)) = 0w197 + ImageInfo.hash a0 + hashint a1        | hash (Round(a0)) = 0w197 + hashint a0
332        | hash (Input(a0,a1)) = 0w199 + hashty a0 + hashstring a1        | hash (Trunc(a0)) = 0w199 + hashint a0
333        | hash (InputWithDefault(a0,a1)) = 0w211 + hashty a0 + hashstring a1        | hash IntToReal = 0w211
334          | hash (RealToInt(a0)) = 0w223 + hashint a0
335      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]        | hash (Transform(a0)) = 0w227 + ImageInfo.hash a0
336        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]        | hash (Translate(a0)) = 0w229 + ImageInfo.hash a0
337        | toString (Mul(a0)) = concat["Mul<", tyToString a0, ">"]        | hash (Kernel(a0,a1)) = 0w233 + Kernel.hash a0 + hashint a1
338        | toString (Div(a0)) = concat["Div<", tyToString a0, ">"]        | hash (ImageAddress(a0)) = 0w239 + ImageInfo.hash a0
339        | toString (Neg(a0)) = concat["Neg<", tyToString a0, ">"]        | hash (LoadVoxels(a0,a1)) = 0w241 + ImageInfo.hash a0 + hashint a1
340          | hash (Inside(a0,a1)) = 0w251 + ImageInfo.hash a0 + hashint a1
341          | hash (LoadSeq(a0,a1)) = 0w257 + hashty a0 + hashstring a1
342          | hash (LoadImage(a0)) = 0w263 + ImageInfo.hash a0
343          | hash (imgAddr(a0,a1,a2)) = 0w269 + ImageInfo.hash a0 + hashty a1 + hashint a2
344          | hash (imgLoad(a0,a1,a2)) = 0w271 + ImageInfo.hash a0 + hashint a1 + hashint a2
345          | hash (Input(a0,a1,a2)) = 0w277 + hashty a0 + hashstring a1 + hashstring a2
346          | hash (InputWithDefault(a0,a1,a2)) = 0w281 + hashty a0 + hashstring a1 + hashstring a2
347          | hash (Print(a0)) = 0w283 + hashtys a0
348    
349        fun toString IAdd = "IAdd"
350          | toString ISub = "ISub"
351          | toString IMul = "IMul"
352          | toString IDiv = "IDiv"
353          | toString INeg = "INeg"
354          | toString (IndexTensor(a0,a1,a2,a3)) = concat["IndexTensor<", intToString a0, ",", tyToString a1, ",", tyToString a2, ",", tyToString a3, ">"]
355          | toString addSca = "addSca"
356          | toString subSca = "subSca"
357          | toString prodSca = "prodSca"
358          | toString divSca = "divSca"
359          | toString (addVec(a0)) = concat["addVec<", intToString a0, ">"]
360          | toString (subVec(a0)) = concat["subVec<", intToString a0, ">"]
361          | toString (prodVec(a0)) = concat["prodVec<", intToString a0, ">"]
362          | toString (prodScaV(a0)) = concat["prodScaV<", intToString a0, ">"]
363          | toString (sumVec(a0)) = concat["sumVec<", intToString a0, ">"]
364        | toString (Abs(a0)) = concat["Abs<", tyToString a0, ">"]        | toString (Abs(a0)) = concat["Abs<", tyToString a0, ">"]
365        | toString (LT(a0)) = concat["LT<", tyToString a0, ">"]        | toString (LT(a0)) = concat["LT<", tyToString a0, ">"]
366        | toString (LTE(a0)) = concat["LTE<", tyToString a0, ">"]        | toString (LTE(a0)) = concat["LTE<", tyToString a0, ">"]
# Line 231  Line 373 
373        | toString Min = "Min"        | toString Min = "Min"
374        | toString (Clamp(a0)) = concat["Clamp<", tyToString a0, ">"]        | toString (Clamp(a0)) = concat["Clamp<", tyToString a0, ">"]
375        | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]        | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]
       | toString (Dot(a0)) = concat["Dot<", intToString a0, ">"]  
       | toString (MulVecMat(a0,a1)) = concat["MulVecMat<", intToString a0, ",", intToString a1, ">"]  
       | toString (MulMatVec(a0,a1)) = concat["MulMatVec<", intToString a0, ",", intToString a1, ">"]  
       | toString (MulMatMat(a0,a1,a2)) = concat["MulMatMat<", intToString a0, ",", intToString a1, ",", intToString a2, ">"]  
       | toString Cross = "Cross"  
       | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]  
       | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"]  
       | toString (Normalize(a0)) = concat["Normalize<", intToString a0, ">"]  
       | toString (Scale(a0)) = concat["Scale<", tyToString a0, ">"]  
       | toString CL = "CL"  
376        | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"]        | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"]
377        | toString (Identity(a0)) = concat["Identity<", intToString a0, ">"]        | toString EigenVecs2x2 = "EigenVecs2x2"
378          | toString EigenVecs3x3 = "EigenVecs3x3"
379          | toString EigenVals2x2 = "EigenVals2x2"
380          | toString EigenVals3x3 = "EigenVals3x3"
381        | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]        | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]
382        | toString (Trace(a0)) = concat["Trace<", intToString a0, ">"]        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]
383          | toString (Index(a0,a1)) = concat["Index<", tyToString a0, ",", intToString a1, ">"]
384        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]
385          | toString (MkDynamic(a0,a1)) = concat["MkDynamic<", tyToString a0, ",", intToString a1, ">"]
386          | toString (Append(a0)) = concat["Append<", tyToString a0, ">"]
387          | toString (Prepend(a0)) = concat["Prepend<", tyToString a0, ">"]
388          | toString (Concat(a0)) = concat["Concat<", tyToString a0, ">"]
389          | toString Sqrt = "Sqrt"
390        | toString (Ceiling(a0)) = concat["Ceiling<", intToString a0, ">"]        | toString (Ceiling(a0)) = concat["Ceiling<", intToString a0, ">"]
391        | toString (Floor(a0)) = concat["Floor<", intToString a0, ">"]        | toString (Floor(a0)) = concat["Floor<", intToString a0, ">"]
392        | toString (Round(a0)) = concat["Round<", intToString a0, ">"]        | toString (Round(a0)) = concat["Round<", intToString a0, ">"]
393        | toString (Trunc(a0)) = concat["Trunc<", intToString a0, ">"]        | toString (Trunc(a0)) = concat["Trunc<", intToString a0, ">"]
394        | toString IntToReal = "IntToReal"        | toString IntToReal = "IntToReal"
395        | toString (RealToInt(a0)) = concat["RealToInt<", intToString a0, ">"]        | toString (RealToInt(a0)) = concat["RealToInt<", intToString a0, ">"]
396          | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]
397          | toString (Translate(a0)) = concat["Translate<", ImageInfo.toString a0, ">"]
398          | toString (Kernel(a0,a1)) = concat["Kernel<", Kernel.toString a0, ",", intToString a1, ">"]
399        | toString (ImageAddress(a0)) = concat["ImageAddress<", ImageInfo.toString a0, ">"]        | toString (ImageAddress(a0)) = concat["ImageAddress<", ImageInfo.toString a0, ">"]
400        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", ImageInfo.toString a0, ",", intToString a1, ">"]
       | toString (PosToImgSpace(a0)) = concat["PosToImgSpace<", ImageInfo.toString a0, ">"]  
       | toString (TensorToWorldSpace(a0,a1)) = concat["TensorToWorldSpace<", ImageInfo.toString a0, ",", tyToString a1, ">"]  
       | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]  
401        | toString (Inside(a0,a1)) = concat["Inside<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (Inside(a0,a1)) = concat["Inside<", ImageInfo.toString a0, ",", intToString a1, ">"]
402        | toString (Input(a0,a1)) = concat["Input<", tyToString a0, ",", stringToString a1, ">"]        | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]
403        | toString (InputWithDefault(a0,a1)) = concat["InputWithDefault<", tyToString a0, ",", stringToString a1, ">"]        | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]
404          | toString (imgAddr(a0,a1,a2)) = concat["imgAddr<", ImageInfo.toString a0, ",", tyToString a1, ",", intToString a2, ">"]
405          | toString (imgLoad(a0,a1,a2)) = concat["imgLoad<", ImageInfo.toString a0, ",", intToString a1, ",", intToString a2, ">"]
406          | toString (Input(a0,a1,a2)) = concat["Input<", tyToString a0, ",", stringToString a1, ",", stringToString a2, ">"]
407          | toString (InputWithDefault(a0,a1,a2)) = concat["InputWithDefault<", tyToString a0, ",", stringToString a1, ",", stringToString a2, ">"]
408          | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]
409    
410    end    end
411    

Legend:
Removed from v.1295  
changed lines
  Added in v.2668

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