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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/mid-ir/mid-ir.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/mid-ir/mid-ir.sml

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

revision 3483, Sat Dec 5 15:02:33 2015 UTC revision 3508, Fri Dec 18 14:19:30 2015 UTC
# Line 44  Line 44 
44      fun maskToString m =      fun maskToString m =
45            String.concat(List.map (fn true => "_" | false => ":") m)            String.concat(List.map (fn true => "_" | false => ":") m)
46    
   (* required helper functions for the input type *)  
     type input = ty Inputs.input  
     val sameinput = Inputs.same  
     val hashinput = Inputs.hash  
     val inputToString = Inputs.toString  
   
47    (* required helper functions for the index control type type *)    (* required helper functions for the index control type type *)
48      type idxctl = IndexCtl.ctl      type idxctl = IndexCtl.ctl
49      val sameidxctl = IndexCtl.same      val sameidxctl = IndexCtl.same
# Line 89  Line 83 
83        | Append of ty        | Append of ty
84        | Prepend of ty        | Prepend of ty
85        | Concat of ty        | Concat of ty
86          | Range
87        | Length of ty        | Length of ty
88        | Ceiling of int        | Ceiling of int
89        | Floor of int        | Floor of int
# Line 107  Line 102 
102        | ImageDim of ImageInfo.info * int        | ImageDim of ImageInfo.info * int
103        | LoadSeq of ty * string        | LoadSeq of ty * string
104        | LoadImage of ty * string        | LoadImage of ty * string
       | Input of input  
       | InputWithDefault of input  
105        | Print of tys        | Print of tys
106    
107      fun resultArity IAdd = 1      fun resultArity IAdd = 1
# Line 143  Line 136 
136        | resultArity (Append _) = 2        | resultArity (Append _) = 2
137        | resultArity (Prepend _) = 2        | resultArity (Prepend _) = 2
138        | resultArity (Concat _) = 2        | resultArity (Concat _) = 2
139          | resultArity Range = 2
140        | resultArity (Length _) = 1        | resultArity (Length _) = 1
141        | resultArity (Ceiling _) = 1        | resultArity (Ceiling _) = 1
142        | resultArity (Floor _) = 1        | resultArity (Floor _) = 1
# Line 161  Line 155 
155        | resultArity (ImageDim _) = 1        | resultArity (ImageDim _) = 1
156        | resultArity (LoadSeq _) = 1        | resultArity (LoadSeq _) = 1
157        | resultArity (LoadImage _) = 1        | resultArity (LoadImage _) = 1
       | resultArity (Input _) = 0  
       | resultArity (InputWithDefault _) = 0  
158        | resultArity (Print _) = 0        | resultArity (Print _) = 0
159    
160      fun arity IAdd = 2      fun arity IAdd = 2
# Line 197  Line 189 
189        | arity (Append _) = 1        | arity (Append _) = 1
190        | arity (Prepend _) = 1        | arity (Prepend _) = 1
191        | arity (Concat _) = 1        | arity (Concat _) = 1
192          | arity Range = 1
193        | arity (Length _) = 1        | arity (Length _) = 1
194        | arity (Ceiling _) = 1        | arity (Ceiling _) = 1
195        | arity (Floor _) = 1        | arity (Floor _) = 1
# Line 215  Line 208 
208        | arity (ImageDim _) = 1        | arity (ImageDim _) = 1
209        | arity (LoadSeq _) = 0        | arity (LoadSeq _) = 0
210        | arity (LoadImage _) = 0        | arity (LoadImage _) = 0
       | arity (Input _) = 0  
       | arity (InputWithDefault _) = 1  
211        | arity (Print _) = ~1        | arity (Print _) = ~1
212    
213      fun isPure (MkDynamic _) = false      fun isPure (MkDynamic _) = false
214        | isPure (Append _) = false        | isPure (Append _) = false
215        | isPure (Prepend _) = false        | isPure (Prepend _) = false
216        | isPure (Concat _) = false        | isPure (Concat _) = false
       | isPure (Input _) = false  
       | isPure (InputWithDefault _) = false  
217        | isPure (Print _) = false        | isPure (Print _) = false
218        | isPure _ = true        | isPure _ = true
219    
# Line 260  Line 249 
249        | same (Append(a0), Append(b0)) = samety(a0, b0)        | same (Append(a0), Append(b0)) = samety(a0, b0)
250        | same (Prepend(a0), Prepend(b0)) = samety(a0, b0)        | same (Prepend(a0), Prepend(b0)) = samety(a0, b0)
251        | same (Concat(a0), Concat(b0)) = samety(a0, b0)        | same (Concat(a0), Concat(b0)) = samety(a0, b0)
252          | same (Range, Range) = true
253        | same (Length(a0), Length(b0)) = samety(a0, b0)        | same (Length(a0), Length(b0)) = samety(a0, b0)
254        | same (Ceiling(a0), Ceiling(b0)) = sameint(a0, b0)        | same (Ceiling(a0), Ceiling(b0)) = sameint(a0, b0)
255        | same (Floor(a0), Floor(b0)) = sameint(a0, b0)        | same (Floor(a0), Floor(b0)) = sameint(a0, b0)
# Line 278  Line 268 
268        | same (ImageDim(a0,a1), ImageDim(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)        | same (ImageDim(a0,a1), ImageDim(b0,b1)) = ImageInfo.same(a0, b0) andalso sameint(a1, b1)
269        | same (LoadSeq(a0,a1), LoadSeq(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)        | same (LoadSeq(a0,a1), LoadSeq(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)
270        | same (LoadImage(a0,a1), LoadImage(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)        | same (LoadImage(a0,a1), LoadImage(b0,b1)) = samety(a0, b0) andalso samestring(a1, b1)
       | same (Input(a0), Input(b0)) = sameinput(a0, b0)  
       | same (InputWithDefault(a0), InputWithDefault(b0)) = sameinput(a0, b0)  
271        | same (Print(a0), Print(b0)) = sametys(a0, b0)        | same (Print(a0), Print(b0)) = sametys(a0, b0)
272        | same _ = false        | same _ = false
273    
# Line 315  Line 303 
303        | hash (Append(a0)) = 0w127 + hashty a0        | hash (Append(a0)) = 0w127 + hashty a0
304        | hash (Prepend(a0)) = 0w131 + hashty a0        | hash (Prepend(a0)) = 0w131 + hashty a0
305        | hash (Concat(a0)) = 0w137 + hashty a0        | hash (Concat(a0)) = 0w137 + hashty a0
306        | hash (Length(a0)) = 0w139 + hashty a0        | hash Range = 0w139
307        | hash (Ceiling(a0)) = 0w149 + hashint a0        | hash (Length(a0)) = 0w149 + hashty a0
308        | hash (Floor(a0)) = 0w151 + hashint a0        | hash (Ceiling(a0)) = 0w151 + hashint a0
309        | hash (Round(a0)) = 0w157 + hashint a0        | hash (Floor(a0)) = 0w157 + hashint a0
310        | hash (Trunc(a0)) = 0w163 + hashint a0        | hash (Round(a0)) = 0w163 + hashint a0
311        | hash IntToReal = 0w167        | hash (Trunc(a0)) = 0w167 + hashint a0
312        | hash (RealToInt(a0)) = 0w173 + hashint a0        | hash IntToReal = 0w173
313        | hash (Kernel(a0,a1)) = 0w179 + Kernel.hash a0 + hashint a1        | hash (RealToInt(a0)) = 0w179 + hashint a0
314        | hash (Transform(a0)) = 0w181 + ImageInfo.hash a0        | hash (Kernel(a0,a1)) = 0w181 + Kernel.hash a0 + hashint a1
315        | hash (Translate(a0)) = 0w191 + ImageInfo.hash a0        | hash (Transform(a0)) = 0w191 + ImageInfo.hash a0
316        | hash (EvalKernel(a0,a1,a2)) = 0w193 + hashint a0 + Kernel.hash a1 + hashint a2        | hash (Translate(a0)) = 0w193 + ImageInfo.hash a0
317        | hash (VoxelAddress(a0,a1)) = 0w197 + ImageInfo.hash a0 + hashint a1        | hash (EvalKernel(a0,a1,a2)) = 0w197 + hashint a0 + Kernel.hash a1 + hashint a2
318        | hash (VoxelAddressWithCtl(a0,a1,a2)) = 0w199 + ImageInfo.hash a0 + hashint a1 + hashidxctl a2        | hash (VoxelAddress(a0,a1)) = 0w199 + ImageInfo.hash a0 + hashint a1
319        | hash (LoadVoxels(a0,a1)) = 0w211 + ImageInfo.hash a0 + hashint a1        | hash (VoxelAddressWithCtl(a0,a1,a2)) = 0w211 + ImageInfo.hash a0 + hashint a1 + hashidxctl a2
320        | hash (Inside(a0,a1)) = 0w223 + ImageInfo.hash a0 + hashint a1        | hash (LoadVoxels(a0,a1)) = 0w223 + ImageInfo.hash a0 + hashint a1
321        | hash (ImageDim(a0,a1)) = 0w227 + ImageInfo.hash a0 + hashint a1        | hash (Inside(a0,a1)) = 0w227 + ImageInfo.hash a0 + hashint a1
322        | hash (LoadSeq(a0,a1)) = 0w229 + hashty a0 + hashstring a1        | hash (ImageDim(a0,a1)) = 0w229 + ImageInfo.hash a0 + hashint a1
323        | hash (LoadImage(a0,a1)) = 0w233 + hashty a0 + hashstring a1        | hash (LoadSeq(a0,a1)) = 0w233 + hashty a0 + hashstring a1
324        | hash (Input(a0)) = 0w239 + hashinput a0        | hash (LoadImage(a0,a1)) = 0w239 + hashty a0 + hashstring a1
325        | hash (InputWithDefault(a0)) = 0w241 + hashinput a0        | hash (Print(a0)) = 0w241 + hashtys a0
       | hash (Print(a0)) = 0w251 + hashtys a0  
326    
327      fun toString IAdd = "IAdd"      fun toString IAdd = "IAdd"
328        | toString ISub = "ISub"        | toString ISub = "ISub"
# Line 369  Line 356 
356        | toString (Append(a0)) = concat["Append<", tyToString a0, ">"]        | toString (Append(a0)) = concat["Append<", tyToString a0, ">"]
357        | toString (Prepend(a0)) = concat["Prepend<", tyToString a0, ">"]        | toString (Prepend(a0)) = concat["Prepend<", tyToString a0, ">"]
358        | toString (Concat(a0)) = concat["Concat<", tyToString a0, ">"]        | toString (Concat(a0)) = concat["Concat<", tyToString a0, ">"]
359          | toString Range = "Range"
360        | toString (Length(a0)) = concat["Length<", tyToString a0, ">"]        | toString (Length(a0)) = concat["Length<", tyToString a0, ">"]
361        | toString (Ceiling(a0)) = concat["Ceiling<", intToString a0, ">"]        | toString (Ceiling(a0)) = concat["Ceiling<", intToString a0, ">"]
362        | toString (Floor(a0)) = concat["Floor<", intToString a0, ">"]        | toString (Floor(a0)) = concat["Floor<", intToString a0, ">"]
# Line 387  Line 375 
375        | toString (ImageDim(a0,a1)) = concat["ImageDim<", ImageInfo.toString a0, ",", intToString a1, ">"]        | toString (ImageDim(a0,a1)) = concat["ImageDim<", ImageInfo.toString a0, ",", intToString a1, ">"]
376        | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]        | toString (LoadSeq(a0,a1)) = concat["LoadSeq<", tyToString a0, ",", stringToString a1, ">"]
377        | toString (LoadImage(a0,a1)) = concat["LoadImage<", tyToString a0, ",", stringToString a1, ">"]        | toString (LoadImage(a0,a1)) = concat["LoadImage<", tyToString a0, ",", stringToString a1, ">"]
       | toString (Input(a0)) = concat["Input<", inputToString a0, ">"]  
       | toString (InputWithDefault(a0)) = concat["InputWithDefault<", inputToString a0, ">"]  
378        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]        | toString (Print(a0)) = concat["Print<", tysToString a0, ">"]
379    
380    end    end
381    
382  structure MidIR = SSAFn(  structure MidIR = SSAFn(
383    val ilName = "mid-ir"    val irName = "mid-ir"
384    structure Ty = MidTypes    structure Ty = MidTypes
385    structure Op = MidOps)    structure Op = MidOps)
386    

Legend:
Removed from v.3483  
changed lines
  Added in v.3508

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