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

SCM Repository

[diderot] Diff of /trunk/src/compiler/mid-il/mid-il.sml
ViewVC logotype

Diff of /trunk/src/compiler/mid-il/mid-il.sml

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

revision 2355, Sun Apr 7 11:35:08 2013 UTC revision 2356, Sun Apr 7 14:45:25 2013 UTC
# Line 55  Line 55 
55        | MulVecMat of int * int        | MulVecMat of int * int
56        | MulMatVec of int * int        | MulMatVec of int * int
57        | MulMatMat of int * int * int        | MulMatMat of int * int * int
58          | MulVecTen3 of int * int * int
59          | MulTen3Vec of int * int * int
60          | ColonMul of ty * ty
61        | Cross        | Cross
62        | Norm of ty        | Norm of ty
63        | Normalize of int        | Normalize of int
# Line 67  Line 70 
70        | Identity of int        | Identity of int
71        | Zero of ty        | Zero of ty
72        | Trace of int        | Trace of int
73          | Transpose of int * int
74        | Select of ty * int        | Select of ty * int
75        | Index of ty * int        | Index of ty * int
76        | Subscript of ty        | Subscript of ty
# Line 108  Line 112 
112        | resultArity (MulVecMat _) = 1        | resultArity (MulVecMat _) = 1
113        | resultArity (MulMatVec _) = 1        | resultArity (MulMatVec _) = 1
114        | resultArity (MulMatMat _) = 1        | resultArity (MulMatMat _) = 1
115          | resultArity (MulVecTen3 _) = 1
116          | resultArity (MulTen3Vec _) = 1
117          | resultArity (ColonMul _) = 1
118        | resultArity Cross = 1        | resultArity Cross = 1
119        | resultArity (Norm _) = 1        | resultArity (Norm _) = 1
120        | resultArity (Normalize _) = 1        | resultArity (Normalize _) = 1
# Line 120  Line 127 
127        | resultArity (Identity _) = 1        | resultArity (Identity _) = 1
128        | resultArity (Zero _) = 1        | resultArity (Zero _) = 1
129        | resultArity (Trace _) = 1        | resultArity (Trace _) = 1
130          | resultArity (Transpose _) = 1
131        | resultArity (Select _) = 1        | resultArity (Select _) = 1
132        | resultArity (Index _) = 1        | resultArity (Index _) = 1
133        | resultArity (Subscript _) = 1        | resultArity (Subscript _) = 1
# Line 161  Line 169 
169        | arity (MulVecMat _) = 2        | arity (MulVecMat _) = 2
170        | arity (MulMatVec _) = 2        | arity (MulMatVec _) = 2
171        | arity (MulMatMat _) = 2        | arity (MulMatMat _) = 2
172          | arity (MulVecTen3 _) = 2
173          | arity (MulTen3Vec _) = 2
174          | arity (ColonMul _) = 2
175        | arity Cross = 2        | arity Cross = 2
176        | arity (Norm _) = 1        | arity (Norm _) = 1
177        | arity (Normalize _) = 1        | arity (Normalize _) = 1
# Line 173  Line 184 
184        | arity (Identity _) = 0        | arity (Identity _) = 0
185        | arity (Zero _) = 0        | arity (Zero _) = 0
186        | arity (Trace _) = 1        | arity (Trace _) = 1
187          | arity (Transpose _) = 1
188        | arity (Select _) = 1        | arity (Select _) = 1
189        | arity (Index _) = 1        | arity (Index _) = 1
190        | arity (Subscript _) = 2        | arity (Subscript _) = 2
# Line 193  Line 205 
205        | arity (InputWithDefault _) = 1        | arity (InputWithDefault _) = 1
206        | arity (Print _) = ~1        | arity (Print _) = ~1
207    
208        fun isPure (Print _) = false
209          | isPure _ = true
210    
211      fun same (Add(a0), Add(b0)) = samety(a0, b0)      fun same (Add(a0), Add(b0)) = samety(a0, b0)
212        | same (Sub(a0), Sub(b0)) = samety(a0, b0)        | same (Sub(a0), Sub(b0)) = samety(a0, b0)
213        | same (Mul(a0), Mul(b0)) = samety(a0, b0)        | same (Mul(a0), Mul(b0)) = samety(a0, b0)
# Line 214  Line 229 
229        | same (MulVecMat(a0,a1), MulVecMat(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)        | same (MulVecMat(a0,a1), MulVecMat(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)
230        | same (MulMatVec(a0,a1), MulMatVec(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)        | same (MulMatVec(a0,a1), MulMatVec(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)
231        | same (MulMatMat(a0,a1,a2), MulMatMat(b0,b1,b2)) = sameint(a0, b0) andalso sameint(a1, b1) andalso sameint(a2, b2)        | same (MulMatMat(a0,a1,a2), MulMatMat(b0,b1,b2)) = sameint(a0, b0) andalso sameint(a1, b1) andalso sameint(a2, b2)
232          | same (MulVecTen3(a0,a1,a2), MulVecTen3(b0,b1,b2)) = sameint(a0, b0) andalso sameint(a1, b1) andalso sameint(a2, b2)
233          | same (MulTen3Vec(a0,a1,a2), MulTen3Vec(b0,b1,b2)) = sameint(a0, b0) andalso sameint(a1, b1) andalso sameint(a2, b2)
234          | same (ColonMul(a0,a1), ColonMul(b0,b1)) = samety(a0, b0) andalso samety(a1, b1)
235        | same (Cross, Cross) = true        | same (Cross, Cross) = true
236        | same (Norm(a0), Norm(b0)) = samety(a0, b0)        | same (Norm(a0), Norm(b0)) = samety(a0, b0)
237        | same (Normalize(a0), Normalize(b0)) = sameint(a0, b0)        | same (Normalize(a0), Normalize(b0)) = sameint(a0, b0)
# Line 226  Line 244 
244        | same (Identity(a0), Identity(b0)) = sameint(a0, b0)        | same (Identity(a0), Identity(b0)) = sameint(a0, b0)
245        | same (Zero(a0), Zero(b0)) = samety(a0, b0)        | same (Zero(a0), Zero(b0)) = samety(a0, b0)
246        | same (Trace(a0), Trace(b0)) = sameint(a0, b0)        | same (Trace(a0), Trace(b0)) = sameint(a0, b0)
247          | same (Transpose(a0,a1), Transpose(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)
248        | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)        | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
249        | same (Index(a0,a1), Index(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)        | same (Index(a0,a1), Index(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
250        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)
# Line 268  Line 287 
287        | hash (MulVecMat(a0,a1)) = 0w71 + hashint a0 + hashint a1        | hash (MulVecMat(a0,a1)) = 0w71 + hashint a0 + hashint a1
288        | hash (MulMatVec(a0,a1)) = 0w73 + hashint a0 + hashint a1        | hash (MulMatVec(a0,a1)) = 0w73 + hashint a0 + hashint a1
289        | hash (MulMatMat(a0,a1,a2)) = 0w79 + hashint a0 + hashint a1 + hashint a2        | hash (MulMatMat(a0,a1,a2)) = 0w79 + hashint a0 + hashint a1 + hashint a2
290        | hash Cross = 0w83        | hash (MulVecTen3(a0,a1,a2)) = 0w83 + hashint a0 + hashint a1 + hashint a2
291        | hash (Norm(a0)) = 0w89 + hashty a0        | hash (MulTen3Vec(a0,a1,a2)) = 0w89 + hashint a0 + hashint a1 + hashint a2
292        | hash (Normalize(a0)) = 0w97 + hashint a0        | hash (ColonMul(a0,a1)) = 0w97 + hashty a0 + hashty a1
293        | hash (Scale(a0)) = 0w101 + hashty a0        | hash Cross = 0w101
294        | hash (PrincipleEvec(a0)) = 0w103 + hashty a0        | hash (Norm(a0)) = 0w103 + hashty a0
295        | hash EigenVecs2x2 = 0w107        | hash (Normalize(a0)) = 0w107 + hashint a0
296        | hash EigenVecs3x3 = 0w109        | hash (Scale(a0)) = 0w109 + hashty a0
297        | hash EigenVals2x2 = 0w113        | hash (PrincipleEvec(a0)) = 0w113 + hashty a0
298        | hash EigenVals3x3 = 0w127        | hash EigenVecs2x2 = 0w127
299        | hash (Identity(a0)) = 0w131 + hashint a0        | hash EigenVecs3x3 = 0w131
300        | hash (Zero(a0)) = 0w137 + hashty a0        | hash EigenVals2x2 = 0w137
301        | hash (Trace(a0)) = 0w139 + hashint a0        | hash EigenVals3x3 = 0w139
302        | hash (Select(a0,a1)) = 0w149 + hashty a0 + hashint a1        | hash (Identity(a0)) = 0w149 + hashint a0
303        | hash (Index(a0,a1)) = 0w151 + hashty a0 + hashint a1        | hash (Zero(a0)) = 0w151 + hashty a0
304        | hash (Subscript(a0)) = 0w157 + hashty a0        | hash (Trace(a0)) = 0w157 + hashint a0
305        | hash (Ceiling(a0)) = 0w163 + hashint a0        | hash (Transpose(a0,a1)) = 0w163 + hashint a0 + hashint a1
306        | hash (Floor(a0)) = 0w167 + hashint a0        | hash (Select(a0,a1)) = 0w167 + hashty a0 + hashint a1
307        | hash (Round(a0)) = 0w173 + hashint a0        | hash (Index(a0,a1)) = 0w173 + hashty a0 + hashint a1
308        | hash (Trunc(a0)) = 0w179 + hashint a0        | hash (Subscript(a0)) = 0w179 + hashty a0
309        | hash IntToReal = 0w181        | hash (Ceiling(a0)) = 0w181 + hashint a0
310        | hash (RealToInt(a0)) = 0w191 + hashint a0        | hash (Floor(a0)) = 0w191 + hashint a0
311        | hash (VoxelAddress(a0,a1)) = 0w193 + ImageInfo.hash a0 + hashint a1        | hash (Round(a0)) = 0w193 + hashint a0
312        | hash (LoadVoxels(a0,a1)) = 0w197 + ImageInfo.hash a0 + hashint a1        | hash (Trunc(a0)) = 0w197 + hashint a0
313        | hash (PosToImgSpace(a0)) = 0w199 + ImageInfo.hash a0        | hash IntToReal = 0w199
314        | hash (TensorToWorldSpace(a0,a1)) = 0w211 + ImageInfo.hash a0 + hashty a1        | hash (RealToInt(a0)) = 0w211 + hashint a0
315        | hash (EvalKernel(a0,a1,a2)) = 0w223 + hashint a0 + Kernel.hash a1 + hashint a2        | hash (VoxelAddress(a0,a1)) = 0w223 + ImageInfo.hash a0 + hashint a1
316        | hash (LoadImage(a0)) = 0w227 + ImageInfo.hash a0        | hash (LoadVoxels(a0,a1)) = 0w227 + ImageInfo.hash a0 + hashint a1
317        | hash (Inside(a0,a1)) = 0w229 + ImageInfo.hash a0 + hashint a1        | hash (PosToImgSpace(a0)) = 0w229 + ImageInfo.hash a0
318        | hash (Input(a0,a1,a2)) = 0w233 + hashty a0 + hashstring a1 + hashstring a2        | hash (TensorToWorldSpace(a0,a1)) = 0w233 + ImageInfo.hash a0 + hashty a1
319        | hash (InputWithDefault(a0,a1,a2)) = 0w239 + hashty a0 + hashstring a1 + hashstring a2        | hash (EvalKernel(a0,a1,a2)) = 0w239 + hashint a0 + Kernel.hash a1 + hashint a2
320        | hash (Print(a0)) = 0w241 + hashtys a0        | hash (LoadImage(a0)) = 0w241 + ImageInfo.hash a0
321          | hash (Inside(a0,a1)) = 0w251 + ImageInfo.hash a0 + hashint a1
322          | hash (Input(a0,a1,a2)) = 0w257 + hashty a0 + hashstring a1 + hashstring a2
323          | hash (InputWithDefault(a0,a1,a2)) = 0w263 + hashty a0 + hashstring a1 + hashstring a2
324          | hash (Print(a0)) = 0w269 + hashtys a0
325    
326      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]
327        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]
# Line 321  Line 344 
344        | toString (MulVecMat(a0,a1)) = concat["MulVecMat<", intToString a0, ",", intToString a1, ">"]        | toString (MulVecMat(a0,a1)) = concat["MulVecMat<", intToString a0, ",", intToString a1, ">"]
345        | toString (MulMatVec(a0,a1)) = concat["MulMatVec<", intToString a0, ",", intToString a1, ">"]        | toString (MulMatVec(a0,a1)) = concat["MulMatVec<", intToString a0, ",", intToString a1, ">"]
346        | toString (MulMatMat(a0,a1,a2)) = concat["MulMatMat<", intToString a0, ",", intToString a1, ",", intToString a2, ">"]        | toString (MulMatMat(a0,a1,a2)) = concat["MulMatMat<", intToString a0, ",", intToString a1, ",", intToString a2, ">"]
347          | toString (MulVecTen3(a0,a1,a2)) = concat["MulVecTen3<", intToString a0, ",", intToString a1, ",", intToString a2, ">"]
348          | toString (MulTen3Vec(a0,a1,a2)) = concat["MulTen3Vec<", intToString a0, ",", intToString a1, ",", intToString a2, ">"]
349          | toString (ColonMul(a0,a1)) = concat["ColonMul<", tyToString a0, ",", tyToString a1, ">"]
350        | toString Cross = "Cross"        | toString Cross = "Cross"
351        | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"]        | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"]
352        | toString (Normalize(a0)) = concat["Normalize<", intToString a0, ">"]        | toString (Normalize(a0)) = concat["Normalize<", intToString a0, ">"]
# Line 333  Line 359 
359        | toString (Identity(a0)) = concat["Identity<", intToString a0, ">"]        | toString (Identity(a0)) = concat["Identity<", intToString a0, ">"]
360        | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]        | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]
361        | toString (Trace(a0)) = concat["Trace<", intToString a0, ">"]        | toString (Trace(a0)) = concat["Trace<", intToString a0, ">"]
362          | toString (Transpose(a0,a1)) = concat["Transpose<", intToString a0, ",", intToString a1, ">"]
363        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]
364        | toString (Index(a0,a1)) = concat["Index<", tyToString a0, ",", intToString a1, ">"]        | toString (Index(a0,a1)) = concat["Index<", tyToString a0, ",", intToString a1, ">"]
365        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]

Legend:
Removed from v.2355  
changed lines
  Added in v.2356

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