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

SCM Repository

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

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

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

revision 2635, Mon May 26 14:06:39 2014 UTC revision 2636, Tue May 27 16:18:36 2014 UTC
# Line 42  Line 42 
42      fun maskToString m =      fun maskToString m =
43            String.concat(List.map (fn true => "_" | false => ":") m)            String.concat(List.map (fn true => "_" | false => ":") m)
44    
45      (* required helper functions for the input type *)
46        type input = ty Inputs.input
47        val sameinput = Inputs.same
48        val hashinput = Inputs.hash
49        val inputToString = Inputs.toString
50    
51      datatype rator      datatype rator
52        = Add of ty        = Add of ty
53        | Sub of ty        | Sub of ty
# Line 90  Line 96 
96        | CeilToInt        | CeilToInt
97        | FloorToInt        | FloorToInt
98        | Kernel of Kernel.kernel * int        | Kernel of Kernel.kernel * int
       | LoadImage of ImageInfo.info  
99        | Inside of int        | Inside of int
100        | Field of int        | Field of int
101        | Probe of ty * ty        | Probe of ty * ty
# Line 101  Line 106 
106        | NegField        | NegField
107        | DiffField        | DiffField
108        | CurlField of int        | CurlField of int
109        | Input of ty * string * string        | LoadImage of ty * string * ImageInfo.info
110        | InputWithDefault of ty * string * string        | Input of input
111        | Print of tys        | Print of tys
112    
113      fun resultArity (Add _) = 1      fun resultArity (Add _) = 1
# Line 152  Line 157 
157        | resultArity CeilToInt = 1        | resultArity CeilToInt = 1
158        | resultArity FloorToInt = 1        | resultArity FloorToInt = 1
159        | resultArity (Kernel _) = 1        | resultArity (Kernel _) = 1
       | resultArity (LoadImage _) = 1  
160        | resultArity (Inside _) = 1        | resultArity (Inside _) = 1
161        | resultArity (Field _) = 1        | resultArity (Field _) = 1
162        | resultArity (Probe _) = 1        | resultArity (Probe _) = 1
# Line 163  Line 167 
167        | resultArity NegField = 1        | resultArity NegField = 1
168        | resultArity DiffField = 1        | resultArity DiffField = 1
169        | resultArity (CurlField _) = 1        | resultArity (CurlField _) = 1
170        | resultArity (Input _) = 1        | resultArity (LoadImage _) = 1
171        | resultArity (InputWithDefault _) = 1        | resultArity (Input _) = 0
172        | resultArity (Print _) = 0        | resultArity (Print _) = 0
173    
174      fun arity (Add _) = 2      fun arity (Add _) = 2
# Line 214  Line 218 
218        | arity CeilToInt = 1        | arity CeilToInt = 1
219        | arity FloorToInt = 1        | arity FloorToInt = 1
220        | arity (Kernel _) = 0        | arity (Kernel _) = 0
       | arity (LoadImage _) = 1  
221        | arity (Inside _) = 2        | arity (Inside _) = 2
222        | arity (Field _) = 2        | arity (Field _) = 2
223        | arity (Probe _) = 2        | arity (Probe _) = 2
# Line 225  Line 228 
228        | arity NegField = 1        | arity NegField = 1
229        | arity DiffField = 1        | arity DiffField = 1
230        | arity (CurlField _) = 1        | arity (CurlField _) = 1
231          | arity (LoadImage _) = 0
232        | arity (Input _) = 0        | arity (Input _) = 0
       | arity (InputWithDefault _) = 1  
233        | arity (Print _) = ~1        | arity (Print _) = ~1
234    
235      fun isPure (Print _) = false      fun isPure (Print _) = false
# Line 279  Line 282 
282        | same (CeilToInt, CeilToInt) = true        | same (CeilToInt, CeilToInt) = true
283        | same (FloorToInt, FloorToInt) = true        | same (FloorToInt, FloorToInt) = true
284        | same (Kernel(a0,a1), Kernel(b0,b1)) = Kernel.same(a0, b0) andalso sameint(a1, b1)        | same (Kernel(a0,a1), Kernel(b0,b1)) = Kernel.same(a0, b0) andalso sameint(a1, b1)
       | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)  
285        | same (Inside(a0), Inside(b0)) = sameint(a0, b0)        | same (Inside(a0), Inside(b0)) = sameint(a0, b0)
286        | same (Field(a0), Field(b0)) = sameint(a0, b0)        | same (Field(a0), Field(b0)) = sameint(a0, b0)
287        | same (Probe(a0,a1), Probe(b0,b1)) = samety(a0, b0) andalso samety(a1, b1)        | same (Probe(a0,a1), Probe(b0,b1)) = samety(a0, b0) andalso samety(a1, b1)
# Line 290  Line 292 
292        | same (NegField, NegField) = true        | same (NegField, NegField) = true
293        | same (DiffField, DiffField) = true        | same (DiffField, DiffField) = true
294        | same (CurlField(a0), CurlField(b0)) = sameint(a0, b0)        | same (CurlField(a0), CurlField(b0)) = sameint(a0, b0)
295        | same (Input(a0,a1,a2), Input(b0,b1,b2)) = samety(a0, b0) andalso samestring(a1, b1) andalso samestring(a2, b2)        | same (LoadImage(a0,a1,a2), LoadImage(b0,b1,b2)) = samety(a0, b0) andalso samestring(a1, b1) andalso ImageInfo.same(a2, b2)
296        | same (InputWithDefault(a0,a1,a2), InputWithDefault(b0,b1,b2)) = samety(a0, b0) andalso samestring(a1, b1) andalso samestring(a2, b2)        | same (Input(a0), Input(b0)) = sameinput(a0, b0)
297        | same (Print(a0), Print(b0)) = sametys(a0, b0)        | same (Print(a0), Print(b0)) = sametys(a0, b0)
298        | same _ = false        | same _ = false
299    
# Line 342  Line 344 
344        | hash CeilToInt = 0w199        | hash CeilToInt = 0w199
345        | hash FloorToInt = 0w211        | hash FloorToInt = 0w211
346        | hash (Kernel(a0,a1)) = 0w223 + Kernel.hash a0 + hashint a1        | hash (Kernel(a0,a1)) = 0w223 + Kernel.hash a0 + hashint a1
347        | hash (LoadImage(a0)) = 0w227 + ImageInfo.hash a0        | hash (Inside(a0)) = 0w227 + hashint a0
348        | hash (Inside(a0)) = 0w229 + hashint a0        | hash (Field(a0)) = 0w229 + hashint a0
349        | hash (Field(a0)) = 0w233 + hashint a0        | hash (Probe(a0,a1)) = 0w233 + hashty a0 + hashty a1
350        | hash (Probe(a0,a1)) = 0w239 + hashty a0 + hashty a1        | hash AddField = 0w239
351        | hash AddField = 0w241        | hash SubField = 0w241
352        | hash SubField = 0w251        | hash ScaleField = 0w251
353        | hash ScaleField = 0w257        | hash OffsetField = 0w257
354        | hash OffsetField = 0w263        | hash NegField = 0w263
355        | hash NegField = 0w269        | hash DiffField = 0w269
356        | hash DiffField = 0w271        | hash (CurlField(a0)) = 0w271 + hashint a0
357        | hash (CurlField(a0)) = 0w277 + hashint a0        | hash (LoadImage(a0,a1,a2)) = 0w277 + hashty a0 + hashstring a1 + ImageInfo.hash a2
358        | hash (Input(a0,a1,a2)) = 0w281 + hashty a0 + hashstring a1 + hashstring a2        | hash (Input(a0)) = 0w281 + hashinput a0
359        | hash (InputWithDefault(a0,a1,a2)) = 0w283 + hashty a0 + hashstring a1 + hashstring a2        | hash (Print(a0)) = 0w283 + hashtys a0
       | hash (Print(a0)) = 0w293 + hashtys a0  
360    
361      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]
362        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]
# Line 404  Line 405 
405        | toString CeilToInt = "CeilToInt"        | toString CeilToInt = "CeilToInt"
406        | toString FloorToInt = "FloorToInt"        | toString FloorToInt = "FloorToInt"
407        | toString (Kernel(a0,a1)) = concat["Kernel<", Kernel.toString a0, ",", intToString a1, ">"]        | toString (Kernel(a0,a1)) = concat["Kernel<", Kernel.toString a0, ",", intToString a1, ">"]
       | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]  
408        | toString (Inside(a0)) = concat["Inside<", intToString a0, ">"]        | toString (Inside(a0)) = concat["Inside<", intToString a0, ">"]
409        | toString (Field(a0)) = concat["Field<", intToString a0, ">"]        | toString (Field(a0)) = concat["Field<", intToString a0, ">"]
410        | toString (Probe(a0,a1)) = concat["Probe<", tyToString a0, ",", tyToString a1, ">"]        | toString (Probe(a0,a1)) = concat["Probe<", tyToString a0, ",", tyToString a1, ">"]
# Line 415  Line 415 
415        | toString NegField = "NegField"        | toString NegField = "NegField"
416        | toString DiffField = "DiffField"        | toString DiffField = "DiffField"
417        | toString (CurlField(a0)) = concat["CurlField<", intToString a0, ">"]        | toString (CurlField(a0)) = concat["CurlField<", intToString a0, ">"]
418        | toString (Input(a0,a1,a2)) = concat["Input<", tyToString a0, ",", stringToString a1, ",", stringToString a2, ">"]        | toString (LoadImage(a0,a1,a2)) = concat["LoadImage<", tyToString a0, ",", stringToString a1, ",", ImageInfo.toString a2, ">"]
419        | toString (InputWithDefault(a0,a1,a2)) = concat["InputWithDefault<", tyToString a0, ",", stringToString a1, ",", stringToString a2, ">"]        | toString (Input(a0)) = concat["Input<", inputToString a0, ">"]
420        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]
421    
422    end    end

Legend:
Removed from v.2635  
changed lines
  Added in v.2636

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