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 2615, Wed May 14 00:22:49 2014 UTC revision 2620, Thu May 15 15:14:58 2014 UTC
# Line 24  Line 24 
24    
25    (* required helper functions for the int type *)    (* required helper functions for the int type *)
26      fun sameint (i1 : int, i2) = (i1 = i2)      fun sameint (i1 : int, i2) = (i1 = i2)
       fun samereal (i1, i2) = sameint(Real.floor i1,Real.floor  i2)  
27      fun hashint i = Word.fromInt i      fun hashint i = Word.fromInt i
     fun hashreal i = Word.fromInt(Real.floor  i)  
28      fun intToString i = Int.toString i      fun intToString i = Int.toString i
      fun realToString i = Int.toString(Real.floor (i))  
29    
30    (* required helper functions for the string type *)    (* required helper functions for the string type *)
31      fun samestring (s1 : string, s2) = (s1 = s2)      fun samestring (s1 : string, s2) = (s1 = s2)
# Line 51  Line 48 
48        | Not        | Not
49        | Max        | Max
50        | Min        | Min
       | CR of real  
51        | C of int        | C of int
52        | V of int * int * ty * ty        | V of int * int * ty * ty
53        | S of int * ty * ty        | S of int * ty * ty
# Line 67  Line 63 
63        | prodVec of int        | prodVec of int
64        | prodScaV of int        | prodScaV of int
65        | sumVec of int        | sumVec of int
66          | LoadVec of ty * int
67          | StoreVec of ty * int
68        | Clamp of ty        | Clamp of ty
69        | Lerp of ty        | Lerp of ty
70        | Norm of ty        | Norm of ty
# Line 118  Line 116 
116        | resultArity Not = 1        | resultArity Not = 1
117        | resultArity Max = 1        | resultArity Max = 1
118        | resultArity Min = 1        | resultArity Min = 1
       | resultArity (CR _) = 1  
119        | resultArity (C _) = 1        | resultArity (C _) = 1
120        | resultArity (V _) = 1        | resultArity (V _) = 1
121        | resultArity (S _) = 1        | resultArity (S _) = 1
# Line 134  Line 131 
131        | resultArity (prodVec _) = 1        | resultArity (prodVec _) = 1
132        | resultArity (prodScaV _) = 1        | resultArity (prodScaV _) = 1
133        | resultArity (sumVec _) = 1        | resultArity (sumVec _) = 1
134          | resultArity (LoadVec _) = 1
135          | resultArity (StoreVec _) = 1
136        | resultArity (Clamp _) = 1        | resultArity (Clamp _) = 1
137        | resultArity (Lerp _) = 1        | resultArity (Lerp _) = 1
138        | resultArity (Norm _) = 1        | resultArity (Norm _) = 1
# Line 185  Line 184 
184        | arity Not = 1        | arity Not = 1
185        | arity Max = 2        | arity Max = 2
186        | arity Min = 2        | arity Min = 2
       | arity (CR _) = 2  
187        | arity (C _) = 2        | arity (C _) = 2
188        | arity (V _) = 2        | arity (V _) = 2
189        | arity (S _) = 2        | arity (S _) = 2
# Line 201  Line 199 
199        | arity (prodVec _) = 2        | arity (prodVec _) = 2
200        | arity (prodScaV _) = 2        | arity (prodScaV _) = 2
201        | arity (sumVec _) = 2        | arity (sumVec _) = 2
202          | arity (LoadVec _) = 2
203          | arity (StoreVec _) = 1
204        | arity (Clamp _) = 3        | arity (Clamp _) = 3
205        | arity (Lerp _) = 3        | arity (Lerp _) = 3
206        | arity (Norm _) = 1        | arity (Norm _) = 1
# Line 259  Line 259 
259        | same (Not, Not) = true        | same (Not, Not) = true
260        | same (Max, Max) = true        | same (Max, Max) = true
261        | same (Min, Min) = true        | same (Min, Min) = true
       | same (CR(a0), CR(b0)) = samereal(a0, b0)  
262        | same (C(a0), C(b0)) = sameint(a0, b0)        | same (C(a0), C(b0)) = sameint(a0, b0)
263        | 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)        | 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)
264        | same (S(a0,a1,a2), S(b0,b1,b2)) = sameint(a0, b0) andalso samety(a1, b1) andalso samety(a2, b2)        | same (S(a0,a1,a2), S(b0,b1,b2)) = sameint(a0, b0) andalso samety(a1, b1) andalso samety(a2, b2)
# Line 275  Line 274 
274        | same (prodVec(a0), prodVec(b0)) = sameint(a0, b0)        | same (prodVec(a0), prodVec(b0)) = sameint(a0, b0)
275        | same (prodScaV(a0), prodScaV(b0)) = sameint(a0, b0)        | same (prodScaV(a0), prodScaV(b0)) = sameint(a0, b0)
276        | same (sumVec(a0), sumVec(b0)) = sameint(a0, b0)        | same (sumVec(a0), sumVec(b0)) = sameint(a0, b0)
277          | same (LoadVec(a0,a1), LoadVec(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
278          | same (StoreVec(a0,a1), StoreVec(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
279        | same (Clamp(a0), Clamp(b0)) = samety(a0, b0)        | same (Clamp(a0), Clamp(b0)) = samety(a0, b0)
280        | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)        | same (Lerp(a0), Lerp(b0)) = samety(a0, b0)
281        | same (Norm(a0), Norm(b0)) = samety(a0, b0)        | same (Norm(a0), Norm(b0)) = samety(a0, b0)
# Line 327  Line 328 
328        | hash Not = 0w43        | hash Not = 0w43
329        | hash Max = 0w47        | hash Max = 0w47
330        | hash Min = 0w53        | hash Min = 0w53
331        | hash (CR(a0)) = 0w59 + hashreal a0        | hash (C(a0)) = 0w59 + hashint a0
332        | hash (C(a0)) = 0w61 + hashint a0        | hash (V(a0,a1,a2,a3)) = 0w61 + hashint a0 + hashint a1 + hashty a2 + hashty a3
333        | hash (V(a0,a1,a2,a3)) = 0w67 + hashint a0 + hashint a1 + hashty a2 + hashty a3        | hash (S(a0,a1,a2)) = 0w67 + hashint a0 + hashty a1 + hashty a2
334        | hash (S(a0,a1,a2)) = 0w71 + hashint a0 + hashty a1 + hashty a2        | hash addSca = 0w71
335        | hash addSca = 0w73        | hash subSca = 0w73
336        | hash subSca = 0w79        | hash prodSca = 0w79
337        | hash prodSca = 0w83        | hash divSca = 0w83
338        | hash divSca = 0w89        | hash (cons(a0,a1)) = 0w89 + hashty a0 + hashint a1
339        | hash (cons(a0,a1)) = 0w97 + hashty a0 + hashint a1        | hash (imgAddr(a0,a1,a2)) = 0w97 + ImageInfo.hash a0 + hashty a1 + hashint a2
340        | hash (imgAddr(a0,a1,a2)) = 0w101 + ImageInfo.hash a0 + hashty a1 + hashint a2        | hash (imgLoad(a0,a1,a2)) = 0w101 + ImageInfo.hash a0 + hashint a1 + hashint a2
341        | hash (imgLoad(a0,a1,a2)) = 0w103 + ImageInfo.hash a0 + hashint a1 + hashint a2        | hash (addVec(a0)) = 0w103 + hashint a0
342        | hash (addVec(a0)) = 0w107 + hashint a0        | hash (subVec(a0)) = 0w107 + hashint a0
343        | hash (subVec(a0)) = 0w109 + hashint a0        | hash (prodVec(a0)) = 0w109 + hashint a0
344        | hash (prodVec(a0)) = 0w113 + hashint a0        | hash (prodScaV(a0)) = 0w113 + hashint a0
345        | hash (prodScaV(a0)) = 0w127 + hashint a0        | hash (sumVec(a0)) = 0w127 + hashint a0
346        | hash (sumVec(a0)) = 0w131 + hashint a0        | hash (LoadVec(a0,a1)) = 0w131 + hashty a0 + hashint a1
347        | hash (Clamp(a0)) = 0w137 + hashty a0        | hash (StoreVec(a0,a1)) = 0w137 + hashty a0 + hashint a1
348        | hash (Lerp(a0)) = 0w139 + hashty a0        | hash (Clamp(a0)) = 0w139 + hashty a0
349        | hash (Norm(a0)) = 0w149 + hashty a0        | hash (Lerp(a0)) = 0w149 + hashty a0
350        | hash (Normalize(a0)) = 0w151 + hashint a0        | hash (Norm(a0)) = 0w151 + hashty a0
351        | hash (PrincipleEvec(a0)) = 0w157 + hashty a0        | hash (Normalize(a0)) = 0w157 + hashint a0
352        | hash EigenVecs2x2 = 0w163        | hash (PrincipleEvec(a0)) = 0w163 + hashty a0
353        | hash EigenVecs3x3 = 0w167        | hash EigenVecs2x2 = 0w167
354        | hash EigenVals2x2 = 0w173        | hash EigenVecs3x3 = 0w173
355        | hash EigenVals3x3 = 0w179        | hash EigenVals2x2 = 0w179
356        | hash (Zero(a0)) = 0w181 + hashty a0        | hash EigenVals3x3 = 0w181
357        | hash (Select(a0,a1)) = 0w191 + hashty a0 + hashint a1        | hash (Zero(a0)) = 0w191 + hashty a0
358        | hash (Index(a0,a1)) = 0w193 + hashty a0 + hashint a1        | hash (Select(a0,a1)) = 0w193 + hashty a0 + hashint a1
359        | hash (Subscript(a0)) = 0w197 + hashty a0        | hash (Index(a0,a1)) = 0w197 + hashty a0 + hashint a1
360        | hash (MkDynamic(a0,a1)) = 0w199 + hashty a0 + hashint a1        | hash (Subscript(a0)) = 0w199 + hashty a0
361        | hash (Append(a0)) = 0w211 + hashty a0        | hash (MkDynamic(a0,a1)) = 0w211 + hashty a0 + hashint a1
362        | hash (Prepend(a0)) = 0w223 + hashty a0        | hash (Append(a0)) = 0w223 + hashty a0
363        | hash (Concat(a0)) = 0w227 + hashty a0        | hash (Prepend(a0)) = 0w227 + hashty a0
364        | hash (Length(a0)) = 0w229 + hashty a0        | hash (Concat(a0)) = 0w229 + hashty a0
365        | hash (Ceiling(a0)) = 0w233 + hashint a0        | hash (Length(a0)) = 0w233 + hashty a0
366        | hash (Floor(a0)) = 0w239 + hashint a0        | hash (Ceiling(a0)) = 0w239 + hashint a0
367        | hash (Round(a0)) = 0w241 + hashint a0        | hash (Floor(a0)) = 0w241 + hashint a0
368        | hash (Trunc(a0)) = 0w251 + hashint a0        | hash (Round(a0)) = 0w251 + hashint a0
369        | hash IntToReal = 0w257        | hash (Trunc(a0)) = 0w257 + hashint a0
370        | hash (RealToInt(a0)) = 0w263 + hashint a0        | hash IntToReal = 0w263
371        | hash (Transform(a0)) = 0w269 + ImageInfo.hash a0        | hash (RealToInt(a0)) = 0w269 + hashint a0
372        | hash (Translate(a0)) = 0w271 + ImageInfo.hash a0        | hash (Transform(a0)) = 0w271 + ImageInfo.hash a0
373        | hash (Kernel(a0,a1)) = 0w277 + Kernel.hash a0 + hashint a1        | hash (Translate(a0)) = 0w277 + ImageInfo.hash a0
374        | hash (ImageAddress(a0)) = 0w281 + ImageInfo.hash a0        | hash (Kernel(a0,a1)) = 0w281 + Kernel.hash a0 + hashint a1
375        | hash (LoadVoxels(a0,a1)) = 0w283 + ImageInfo.hash a0 + hashint a1        | hash (ImageAddress(a0)) = 0w283 + ImageInfo.hash a0
376        | hash (Inside(a0,a1)) = 0w293 + ImageInfo.hash a0 + hashint a1        | hash (LoadVoxels(a0,a1)) = 0w293 + ImageInfo.hash a0 + hashint a1
377        | hash (LoadSeq(a0,a1)) = 0w307 + hashty a0 + hashstring a1        | hash (Inside(a0,a1)) = 0w307 + ImageInfo.hash a0 + hashint a1
378        | hash (LoadImage(a0)) = 0w311 + ImageInfo.hash a0        | hash (LoadSeq(a0,a1)) = 0w311 + hashty a0 + hashstring a1
379        | hash (Input(a0,a1,a2)) = 0w313 + hashty a0 + hashstring a1 + hashstring a2        | hash (LoadImage(a0)) = 0w313 + ImageInfo.hash a0
380        | hash (InputWithDefault(a0,a1,a2)) = 0w317 + hashty a0 + hashstring a1 + hashstring a2        | hash (Input(a0,a1,a2)) = 0w317 + hashty a0 + hashstring a1 + hashstring a2
381        | hash (Print(a0)) = 0w331 + hashtys a0        | hash (InputWithDefault(a0,a1,a2)) = 0w331 + hashty a0 + hashstring a1 + hashstring a2
382          | hash (Print(a0)) = 0w337 + hashtys a0
383    
384      fun toString IAdd = "IAdd"      fun toString IAdd = "IAdd"
385        | toString ISub = "ISub"        | toString ISub = "ISub"
# Line 394  Line 396 
396        | toString Not = "Not"        | toString Not = "Not"
397        | toString Max = "Max"        | toString Max = "Max"
398        | toString Min = "Min"        | toString Min = "Min"
       | toString (CR(a0)) = concat["CR<", realToString a0, ">"]  
399        | toString (C(a0)) = concat["C<", intToString a0, ">"]        | toString (C(a0)) = concat["C<", intToString a0, ">"]
400        | toString (V(a0,a1,a2,a3)) = concat["V<", intToString a0, ",", intToString a1, ",", tyToString a2, ",", tyToString a3, ">"]        | toString (V(a0,a1,a2,a3)) = concat["V<", intToString a0, ",", intToString a1, ",", tyToString a2, ",", tyToString a3, ">"]
401        | toString (S(a0,a1,a2)) = concat["S<", intToString a0, ",", tyToString a1, ",", tyToString a2, ">"]        | toString (S(a0,a1,a2)) = concat["S<", intToString a0, ",", tyToString a1, ",", tyToString a2, ">"]
# Line 410  Line 411 
411        | toString (prodVec(a0)) = concat["prodVec<", intToString a0, ">"]        | toString (prodVec(a0)) = concat["prodVec<", intToString a0, ">"]
412        | toString (prodScaV(a0)) = concat["prodScaV<", intToString a0, ">"]        | toString (prodScaV(a0)) = concat["prodScaV<", intToString a0, ">"]
413        | toString (sumVec(a0)) = concat["sumVec<", intToString a0, ">"]        | toString (sumVec(a0)) = concat["sumVec<", intToString a0, ">"]
414          | toString (LoadVec(a0,a1)) = concat["LoadVec<", tyToString a0, ",", intToString a1, ">"]
415          | toString (StoreVec(a0,a1)) = concat["StoreVec<", tyToString a0, ",", intToString a1, ">"]
416        | toString (Clamp(a0)) = concat["Clamp<", tyToString a0, ">"]        | toString (Clamp(a0)) = concat["Clamp<", tyToString a0, ">"]
417        | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]        | toString (Lerp(a0)) = concat["Lerp<", tyToString a0, ">"]
418        | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"]        | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"]

Legend:
Removed from v.2615  
changed lines
  Added in v.2620

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