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 333, Thu Aug 19 20:52:48 2010 UTC revision 391, Thu Oct 14 13:18:24 2010 UTC
# Line 11  Line 11 
11  structure MidOps =  structure MidOps =
12    struct    struct
13    
14      datatype ty = BoolTy | StringTy | IntTy | VecTy of int      type ty = MidILTypes.ty
15    
16      val realTy = VecTy 0      val samety = MidILTypes.same
17        val hashty = MidILTypes.hash
18      fun samety (ty1 : ty, ty2) = (ty1 = ty2)      val tyToString = MidILTypes.toString
     fun hashty BoolTy = 0w1  
       | hashty StringTy = 0w2  
       | hashty IntTy = 0w3  
       | hashty (VecTy d) = Word.fromInt d + 0w4  
     fun tyToString BoolTy = "bool"  
       | tyToString StringTy = "string"  
       | tyToString IntTy = "int"  
       | tyToString (VecTy 0) = "real"  
       | tyToString (VecTy d) = "vec" ^ Int.toString d  
19    
20      fun sameint (i1 : int, i2) = (i1 = i2)      fun sameint (i1 : int, i2) = (i1 = i2)
21      fun hashint i = Word.fromInt i      fun hashint i = Word.fromInt i
# Line 52  Line 43 
43        | Sin        | Sin
44        | Cos        | Cos
45        | Pow        | Pow
46        | Dot of ty        | Dot of int
47        | Cross        | Cross
48        | Select of int        | Select of int * int
49        | Norm of ty        | Norm of int
50        | Scale of ty        | Scale of int
51        | InvScale of ty        | InvScale of int
52        | CL        | CL
53        | PrincipleEvec of ty        | PrincipleEvec of ty
54        | Subscript of ty        | Subscript of ty
# Line 72  Line 63 
63        | Transform of ImageInfo.info        | Transform of ImageInfo.info
64        | EvalKernel of int * Kernel.kernel * int        | EvalKernel of int * Kernel.kernel * int
65        | LoadImage of ImageInfo.info        | LoadImage of ImageInfo.info
66        | Inside        | Inside of ImageInfo.info
67        | Input of string        | Input of string
68        | InputWithDefault of string        | InputWithDefault of string
69    
# Line 113  Line 104 
104        | arity (Transform _) = 1        | arity (Transform _) = 1
105        | arity (EvalKernel _) = 1        | arity (EvalKernel _) = 1
106        | arity (LoadImage _) = 0        | arity (LoadImage _) = 0
107        | arity Inside = 2        | arity (Inside _) = 1
108        | arity (Input _) = 0        | arity (Input _) = 0
109        | arity (InputWithDefault _) = 1        | arity (InputWithDefault _) = 1
110    
# Line 134  Line 125 
125        | same (Sin, Sin) = true        | same (Sin, Sin) = true
126        | same (Cos, Cos) = true        | same (Cos, Cos) = true
127        | same (Pow, Pow) = true        | same (Pow, Pow) = true
128        | same (Dot(a0), Dot(b0)) = samety(a0, b0)        | same (Dot(a0), Dot(b0)) = sameint(a0, b0)
129        | same (Cross, Cross) = true        | same (Cross, Cross) = true
130        | same (Select(a0), Select(b0)) = sameint(a0, b0)        | same (Select(a0,a1), Select(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)
131        | same (Norm(a0), Norm(b0)) = samety(a0, b0)        | same (Norm(a0), Norm(b0)) = sameint(a0, b0)
132        | same (Scale(a0), Scale(b0)) = samety(a0, b0)        | same (Scale(a0), Scale(b0)) = sameint(a0, b0)
133        | same (InvScale(a0), InvScale(b0)) = samety(a0, b0)        | same (InvScale(a0), InvScale(b0)) = sameint(a0, b0)
134        | same (CL, CL) = true        | same (CL, CL) = true
135        | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0)        | same (PrincipleEvec(a0), PrincipleEvec(b0)) = samety(a0, b0)
136        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)
# Line 154  Line 145 
145        | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)        | same (Transform(a0), Transform(b0)) = ImageInfo.same(a0, b0)
146        | same (EvalKernel(a0,a1,a2), EvalKernel(b0,b1,b2)) = sameint(a0, b0) andalso Kernel.same(a1, b1) andalso sameint(a2, b2)        | same (EvalKernel(a0,a1,a2), EvalKernel(b0,b1,b2)) = sameint(a0, b0) andalso Kernel.same(a1, b1) andalso sameint(a2, b2)
147        | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)        | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)
148        | same (Inside, Inside) = true        | same (Inside(a0), Inside(b0)) = ImageInfo.same(a0, b0)
149        | same (Input(a0), Input(b0)) = samestring(a0, b0)        | same (Input(a0), Input(b0)) = samestring(a0, b0)
150        | same (InputWithDefault(a0), InputWithDefault(b0)) = samestring(a0, b0)        | same (InputWithDefault(a0), InputWithDefault(b0)) = samestring(a0, b0)
151        | same _ = false        | same _ = false
# Line 176  Line 167 
167        | hash Sin = 0w53        | hash Sin = 0w53
168        | hash Cos = 0w59        | hash Cos = 0w59
169        | hash Pow = 0w61        | hash Pow = 0w61
170        | hash (Dot(a0)) = 0w67 + hashty a0        | hash (Dot(a0)) = 0w67 + hashint a0
171        | hash Cross = 0w71        | hash Cross = 0w71
172        | hash (Select(a0)) = 0w73 + hashint a0        | hash (Select(a0,a1)) = 0w73 + hashint a0 + hashint a1
173        | hash (Norm(a0)) = 0w79 + hashty a0        | hash (Norm(a0)) = 0w79 + hashint a0
174        | hash (Scale(a0)) = 0w83 + hashty a0        | hash (Scale(a0)) = 0w83 + hashint a0
175        | hash (InvScale(a0)) = 0w89 + hashty a0        | hash (InvScale(a0)) = 0w89 + hashint a0
176        | hash CL = 0w97        | hash CL = 0w97
177        | hash (PrincipleEvec(a0)) = 0w101 + hashty a0        | hash (PrincipleEvec(a0)) = 0w101 + hashty a0
178        | hash (Subscript(a0)) = 0w103 + hashty a0        | hash (Subscript(a0)) = 0w103 + hashty a0
# Line 196  Line 187 
187        | hash (Transform(a0)) = 0w151 + ImageInfo.hash a0        | hash (Transform(a0)) = 0w151 + ImageInfo.hash a0
188        | hash (EvalKernel(a0,a1,a2)) = 0w157 + hashint a0 + Kernel.hash a1 + hashint a2        | hash (EvalKernel(a0,a1,a2)) = 0w157 + hashint a0 + Kernel.hash a1 + hashint a2
189        | hash (LoadImage(a0)) = 0w163 + ImageInfo.hash a0        | hash (LoadImage(a0)) = 0w163 + ImageInfo.hash a0
190        | hash Inside = 0w167        | hash (Inside(a0)) = 0w167 + ImageInfo.hash a0
191        | hash (Input(a0)) = 0w173 + hashstring a0        | hash (Input(a0)) = 0w173 + hashstring a0
192        | hash (InputWithDefault(a0)) = 0w179 + hashstring a0        | hash (InputWithDefault(a0)) = 0w179 + hashstring a0
193    
# Line 217  Line 208 
208        | toString Sin = "Sin"        | toString Sin = "Sin"
209        | toString Cos = "Cos"        | toString Cos = "Cos"
210        | toString Pow = "Pow"        | toString Pow = "Pow"
211        | toString (Dot(a0)) = concat["Dot<", tyToString a0, ">"]        | toString (Dot(a0)) = concat["Dot<", intToString a0, ">"]
212        | toString Cross = "Cross"        | toString Cross = "Cross"
213        | toString (Select(a0)) = concat["Select<", intToString a0, ">"]        | toString (Select(a0,a1)) = concat["Select<", intToString a0, ",", intToString a1, ">"]
214        | toString (Norm(a0)) = concat["Norm<", tyToString a0, ">"]        | toString (Norm(a0)) = concat["Norm<", intToString a0, ">"]
215        | toString (Scale(a0)) = concat["Scale<", tyToString a0, ">"]        | toString (Scale(a0)) = concat["Scale<", intToString a0, ">"]
216        | toString (InvScale(a0)) = concat["InvScale<", tyToString a0, ">"]        | toString (InvScale(a0)) = concat["InvScale<", intToString a0, ">"]
217        | toString CL = "CL"        | toString CL = "CL"
218        | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"]        | toString (PrincipleEvec(a0)) = concat["PrincipleEvec<", tyToString a0, ">"]
219        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]
# Line 237  Line 228 
228        | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]        | toString (Transform(a0)) = concat["Transform<", ImageInfo.toString a0, ">"]
229        | toString (EvalKernel(a0,a1,a2)) = concat["EvalKernel<", intToString a0, ",", Kernel.toString a1, ",", intToString a2, ">"]        | toString (EvalKernel(a0,a1,a2)) = concat["EvalKernel<", intToString a0, ",", Kernel.toString a1, ",", intToString a2, ">"]
230        | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]        | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]
231        | toString Inside = "Inside"        | toString (Inside(a0)) = concat["Inside<", ImageInfo.toString a0, ">"]
232        | toString (Input(a0)) = concat["Input<", stringToString a0, ">"]        | toString (Input(a0)) = concat["Input<", stringToString a0, ">"]
233        | toString (InputWithDefault(a0)) = concat["InputWithDefault<", stringToString a0, ">"]        | toString (InputWithDefault(a0)) = concat["InputWithDefault<", stringToString a0, ">"]
234    

Legend:
Removed from v.333  
changed lines
  Added in v.391

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