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 2870, Wed Feb 25 21:47:43 2015 UTC revision 3060, Fri Mar 13 22:12:44 2015 UTC
# Line 32  Line 32 
32      val hashstring = HashString.hashString      val hashstring = HashString.hashString
33      fun stringToString s = String.concat["\"", s, "\""]      fun stringToString s = String.concat["\"", s, "\""]
34    
35      (* required helper functions for the input type *)
36        type input = ty Inputs.input
37        val sameinput = Inputs.same
38        val hashinput = Inputs.hash
39        val inputToString = Inputs.toString
40    
41      datatype rator      datatype rator
42        = IAdd        = IAdd
43        | ISub        | ISub
# Line 92  Line 98 
98        | ImageAddress of ImageInfo.info        | ImageAddress of ImageInfo.info
99        | LoadVoxels of ImageInfo.info * int        | LoadVoxels of ImageInfo.info * int
100        | Inside of ImageInfo.info * int        | Inside of ImageInfo.info * int
       | LoadSeq of ty * string  
       | LoadImage of ImageInfo.info  
101        | imgAddr of ImageInfo.info * ty * int        | imgAddr of ImageInfo.info * ty * int
102        | imgLoad of ImageInfo.info * int * int        | imgLoad of ImageInfo.info * int * int
103        | baseAddr of ImageInfo.info        | baseAddr of ImageInfo.info
104        | Input of ty * string * string        | LoadSeq of ty * string
105        | InputWithDefault of ty * string * string        | LoadImage of ty * string * ImageInfo.info
106          | Input of input
107        | Print of tys        | Print of tys
108    
109      fun resultArity IAdd = 1      fun resultArity IAdd = 1
# Line 160  Line 165 
165        | resultArity (ImageAddress _) = 1        | resultArity (ImageAddress _) = 1
166        | resultArity (LoadVoxels _) = 1        | resultArity (LoadVoxels _) = 1
167        | resultArity (Inside _) = 1        | resultArity (Inside _) = 1
       | resultArity (LoadSeq _) = 1  
       | resultArity (LoadImage _) = 1  
168        | resultArity (imgAddr _) = 1        | resultArity (imgAddr _) = 1
169        | resultArity (imgLoad _) = 1        | resultArity (imgLoad _) = 1
170        | resultArity (baseAddr _) = 1        | resultArity (baseAddr _) = 1
171        | resultArity (Input _) = 1        | resultArity (LoadSeq _) = 1
172        | resultArity (InputWithDefault _) = 1        | resultArity (LoadImage _) = 1
173          | resultArity (Input _) = 0
174        | resultArity (Print _) = 0        | resultArity (Print _) = 0
175    
176      fun arity IAdd = 2      fun arity IAdd = 2
# Line 228  Line 232 
232        | arity (ImageAddress _) = 1        | arity (ImageAddress _) = 1
233        | arity (LoadVoxels _) = 1        | arity (LoadVoxels _) = 1
234        | arity (Inside _) = 2        | arity (Inside _) = 2
       | arity (LoadSeq _) = 0  
       | arity (LoadImage _) = 0  
235        | arity (imgAddr _) = 2        | arity (imgAddr _) = 2
236        | arity (imgLoad _) = 2        | arity (imgLoad _) = 2
237        | arity (baseAddr _) = 2        | arity (baseAddr _) = 2
238          | arity (LoadSeq _) = 0
239          | arity (LoadImage _) = 0
240        | arity (Input _) = 0        | arity (Input _) = 0
       | arity (InputWithDefault _) = 1  
241        | arity (Print _) = ~1        | arity (Print _) = ~1
242    
243      fun isPure (MkDynamic _) = false      fun isPure (MkDynamic _) = false
244        | isPure (Append _) = false        | isPure (Append _) = false
245        | isPure (Prepend _) = false        | isPure (Prepend _) = false
246        | isPure (Concat _) = false        | isPure (Concat _) = false
247          | isPure (Input _) = false
248        | isPure (Print _) = false        | isPure (Print _) = false
249        | isPure _ = true        | isPure _ = true
250    
# Line 303  Line 307 
307        | same (ImageAddress(a0), ImageAddress(b0)) = ImageInfo.same(a0, b0)        | same (ImageAddress(a0), ImageAddress(b0)) = ImageInfo.same(a0, b0)
308        | 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)
309        | 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)
       | same (LoadSeq(a0,a1), LoadSeq(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)  
       | same (LoadImage(a0), LoadImage(b0)) = ImageInfo.same(a0, b0)  
310        | same (imgAddr(a0,a1,a2), imgAddr(b0,b1,b2)) = ImageInfo.same(a0, b0) andalso samety(a1, b1) andalso sameint(a2, b2)        | same (imgAddr(a0,a1,a2), imgAddr(b0,b1,b2)) = ImageInfo.same(a0, b0) andalso samety(a1, b1) andalso sameint(a2, b2)
311        | same (imgLoad(a0,a1,a2), imgLoad(b0,b1,b2)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1) andalso sameint(a2, b2)        | same (imgLoad(a0,a1,a2), imgLoad(b0,b1,b2)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1) andalso sameint(a2, b2)
312        | same (baseAddr(a0), baseAddr(b0)) = ImageInfo.same(a0, b0)        | same (baseAddr(a0), baseAddr(b0)) = ImageInfo.same(a0, b0)
313        | same (Input(a0,a1,a2), Input(b0,b1,b2)) = samety(a0, b0) andalso samestring(a1, b1) andalso samestring(a2, b2)        | same (LoadSeq(a0,a1), LoadSeq(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)
314        | same (InputWithDefault(a0,a1,a2), InputWithDefault(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)
315          | same (Input(a0), Input(b0)) = sameinput(a0, b0)
316        | same (Print(a0), Print(b0)) = sametys(a0, b0)        | same (Print(a0), Print(b0)) = sametys(a0, b0)
317        | same _ = false        | same _ = false
318    
# Line 372  Line 375 
375        | hash (ImageAddress(a0)) = 0w271 + ImageInfo.hash a0        | hash (ImageAddress(a0)) = 0w271 + ImageInfo.hash a0
376        | hash (LoadVoxels(a0,a1)) = 0w277 + ImageInfo.hash a0 + hashint a1        | hash (LoadVoxels(a0,a1)) = 0w277 + ImageInfo.hash a0 + hashint a1
377        | hash (Inside(a0,a1)) = 0w281 + ImageInfo.hash a0 + hashint a1        | hash (Inside(a0,a1)) = 0w281 + ImageInfo.hash a0 + hashint a1
378        | hash (LoadSeq(a0,a1)) = 0w283 + hashty a0 + hashstring a1        | hash (imgAddr(a0,a1,a2)) = 0w283 + ImageInfo.hash a0 + hashty a1 + hashint a2
379        | hash (LoadImage(a0)) = 0w293 + ImageInfo.hash a0        | hash (imgLoad(a0,a1,a2)) = 0w293 + ImageInfo.hash a0 + hashint a1 + hashint a2
380        | hash (imgAddr(a0,a1,a2)) = 0w307 + ImageInfo.hash a0 + hashty a1 + hashint a2        | hash (baseAddr(a0)) = 0w307 + ImageInfo.hash a0
381        | hash (imgLoad(a0,a1,a2)) = 0w311 + ImageInfo.hash a0 + hashint a1 + hashint a2        | hash (LoadSeq(a0,a1)) = 0w311 + hashty a0 + hashstring a1
382        | hash (baseAddr(a0)) = 0w313 + ImageInfo.hash a0        | hash (LoadImage(a0,a1,a2)) = 0w313 + hashty a0 + hashstring a1 + ImageInfo.hash a2
383        | hash (Input(a0,a1,a2)) = 0w317 + hashty a0 + hashstring a1 + hashstring a2        | hash (Input(a0)) = 0w317 + hashinput a0
384        | hash (InputWithDefault(a0,a1,a2)) = 0w331 + hashty a0 + hashstring a1 + hashstring a2        | hash (Print(a0)) = 0w331 + hashtys a0
       | hash (Print(a0)) = 0w337 + hashtys a0  
385    
386      fun toString IAdd = "IAdd"      fun toString IAdd = "IAdd"
387        | toString ISub = "ISub"        | toString ISub = "ISub"
# Line 440  Line 442 
442        | toString (ImageAddress(a0)) = concat["ImageAddress<", ImageInfo.toString a0, ">"]        | toString (ImageAddress(a0)) = concat["ImageAddress<", ImageInfo.toString a0, ">"]
443        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (LoadVoxels(a0,a1)) = concat["LoadVoxels<", ImageInfo.toString a0, ",", intToString a1, ">"]
444        | toString (Inside(a0,a1)) = concat["Inside<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (Inside(a0,a1)) = concat["Inside<", ImageInfo.toString a0, ",", intToString a1, ">"]
       | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]  
       | toString (LoadImage(a0)) = concat["LoadImage<", ImageInfo.toString a0, ">"]  
445        | toString (imgAddr(a0,a1,a2)) = concat["imgAddr<", ImageInfo.toString a0, ",", tyToString a1, ",", intToString a2, ">"]        | toString (imgAddr(a0,a1,a2)) = concat["imgAddr<", ImageInfo.toString a0, ",", tyToString a1, ",", intToString a2, ">"]
446        | toString (imgLoad(a0,a1,a2)) = concat["imgLoad<", ImageInfo.toString a0, ",", intToString a1, ",", intToString a2, ">"]        | toString (imgLoad(a0,a1,a2)) = concat["imgLoad<", ImageInfo.toString a0, ",", intToString a1, ",", intToString a2, ">"]
447        | toString (baseAddr(a0)) = concat["baseAddr<", ImageInfo.toString a0, ">"]        | toString (baseAddr(a0)) = concat["baseAddr<", ImageInfo.toString a0, ">"]
448        | toString (Input(a0,a1,a2)) = concat["Input<", tyToString a0, ",", stringToString a1, ",", stringToString a2, ">"]        | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]
449        | toString (InputWithDefault(a0,a1,a2)) = concat["InputWithDefault<", tyToString a0, ",", stringToString a1, ",", stringToString a2, ">"]        | toString (LoadImage(a0,a1,a2)) = concat["LoadImage<", tyToString a0, ",", stringToString a1, ",", ImageInfo.toString a2, ">"]
450          | toString (Input(a0)) = concat["Input<", inputToString a0, ">"]
451        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]
452    
453    end    end

Legend:
Removed from v.2870  
changed lines
  Added in v.3060

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