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

SCM Repository

[diderot] Diff of /branches/vis12-cl/src/compiler/mid-il/mid-il.sml
ViewVC logotype

Diff of /branches/vis12-cl/src/compiler/mid-il/mid-il.sml

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

revision 2824, Mon Nov 10 17:06:01 2014 UTC revision 2825, Mon Nov 10 21:06:31 2014 UTC
# Line 33  Line 33 
33      val hashstring = HashString.hashString      val hashstring = HashString.hashString
34      fun stringToString s = String.concat["\"", s, "\""]      fun stringToString s = String.concat["\"", s, "\""]
35    
36      (* required helper functions for the mask type *)
37        type mask = bool list
38        val samemask : (mask * mask -> bool) = (op =)
39        fun hashmask m =
40              List.foldl (fn (false, w) => w+w | (true, w) => w+w+0w1)
41                (Word.fromInt(List.length m)) m
42        fun maskToString m =
43              String.concat(List.map (fn true => "_" | false => ":") m)
44    
45    (* required helper functions for the input type *)    (* required helper functions for the input type *)
46      type input = ty Inputs.input      type input = ty Inputs.input
47      val sameinput = Inputs.same      val sameinput = Inputs.same
# Line 77  Line 86 
86        | Zero of ty        | Zero of ty
87        | Trace of int        | Trace of int
88        | Transpose of int * int        | Transpose of int * int
89          | Slice of ty * mask
90        | Select of ty * int        | Select of ty * int
91        | Index of ty * int        | Index of ty * int
92        | Subscript of ty        | Subscript of ty
# Line 140  Line 150 
150        | resultArity (Zero _) = 1        | resultArity (Zero _) = 1
151        | resultArity (Trace _) = 1        | resultArity (Trace _) = 1
152        | resultArity (Transpose _) = 1        | resultArity (Transpose _) = 1
153          | resultArity (Slice _) = 1
154        | resultArity (Select _) = 1        | resultArity (Select _) = 1
155        | resultArity (Index _) = 1        | resultArity (Index _) = 1
156        | resultArity (Subscript _) = 1        | resultArity (Subscript _) = 1
# Line 203  Line 214 
214        | arity (Zero _) = 0        | arity (Zero _) = 0
215        | arity (Trace _) = 1        | arity (Trace _) = 1
216        | arity (Transpose _) = 1        | arity (Transpose _) = 1
217          | arity (Slice _) = 1
218        | arity (Select _) = 1        | arity (Select _) = 1
219        | arity (Index _) = 1        | arity (Index _) = 1
220        | arity (Subscript _) = 2        | arity (Subscript _) = 2
# Line 275  Line 287 
287        | same (Zero(a0), Zero(b0)) = samety(a0, b0)        | same (Zero(a0), Zero(b0)) = samety(a0, b0)
288        | same (Trace(a0), Trace(b0)) = sameint(a0, b0)        | same (Trace(a0), Trace(b0)) = sameint(a0, b0)
289        | same (Transpose(a0,a1), Transpose(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)        | same (Transpose(a0,a1), Transpose(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)
290          | same (Slice(a0,a1), Slice(b0,b1)) = samety(a0, b0) andalso samemask(a1, b1)
291        | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)        | same (Select(a0,a1), Select(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
292        | same (Index(a0,a1), Index(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)        | same (Index(a0,a1), Index(b0,b1)) = samety(a0, b0) andalso sameint(a1, b1)
293        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)
# Line 339  Line 352 
352        | hash (Zero(a0)) = 0w151 + hashty a0        | hash (Zero(a0)) = 0w151 + hashty a0
353        | hash (Trace(a0)) = 0w157 + hashint a0        | hash (Trace(a0)) = 0w157 + hashint a0
354        | hash (Transpose(a0,a1)) = 0w163 + hashint a0 + hashint a1        | hash (Transpose(a0,a1)) = 0w163 + hashint a0 + hashint a1
355        | hash (Select(a0,a1)) = 0w167 + hashty a0 + hashint a1        | hash (Slice(a0,a1)) = 0w167 + hashty a0 + hashmask a1
356        | hash (Index(a0,a1)) = 0w173 + hashty a0 + hashint a1        | hash (Select(a0,a1)) = 0w173 + hashty a0 + hashint a1
357        | hash (Subscript(a0)) = 0w179 + hashty a0        | hash (Index(a0,a1)) = 0w179 + hashty a0 + hashint a1
358        | hash (MkDynamic(a0,a1)) = 0w181 + hashty a0 + hashint a1        | hash (Subscript(a0)) = 0w181 + hashty a0
359        | hash (Append(a0)) = 0w191 + hashty a0        | hash (MkDynamic(a0,a1)) = 0w191 + hashty a0 + hashint a1
360        | hash (Prepend(a0)) = 0w193 + hashty a0        | hash (Append(a0)) = 0w193 + hashty a0
361        | hash (Concat(a0)) = 0w197 + hashty a0        | hash (Prepend(a0)) = 0w197 + hashty a0
362        | hash (Length(a0)) = 0w199 + hashty a0        | hash (Concat(a0)) = 0w199 + hashty a0
363        | hash (Ceiling(a0)) = 0w211 + hashint a0        | hash (Length(a0)) = 0w211 + hashty a0
364        | hash (Floor(a0)) = 0w223 + hashint a0        | hash (Ceiling(a0)) = 0w223 + hashint a0
365        | hash (Round(a0)) = 0w227 + hashint a0        | hash (Floor(a0)) = 0w227 + hashint a0
366        | hash (Trunc(a0)) = 0w229 + hashint a0        | hash (Round(a0)) = 0w229 + hashint a0
367        | hash IntToReal = 0w233        | hash (Trunc(a0)) = 0w233 + hashint a0
368        | hash (RealToInt(a0)) = 0w239 + hashint a0        | hash IntToReal = 0w239
369        | hash (VoxelAddress(a0,a1)) = 0w241 + ImageInfo.hash a0 + hashint a1        | hash (RealToInt(a0)) = 0w241 + hashint a0
370        | hash (LoadVoxels(a0,a1)) = 0w251 + ImageInfo.hash a0 + hashint a1        | hash (VoxelAddress(a0,a1)) = 0w251 + ImageInfo.hash a0 + hashint a1
371        | hash (PosToImgSpace(a0)) = 0w257 + ImageInfo.hash a0        | hash (LoadVoxels(a0,a1)) = 0w257 + ImageInfo.hash a0 + hashint a1
372        | hash (TensorToWorldSpace(a0,a1)) = 0w263 + ImageInfo.hash a0 + hashty a1        | hash (PosToImgSpace(a0)) = 0w263 + ImageInfo.hash a0
373        | hash (EvalKernel(a0,a1,a2)) = 0w269 + hashint a0 + Kernel.hash a1 + hashint a2        | hash (TensorToWorldSpace(a0,a1)) = 0w269 + ImageInfo.hash a0 + hashty a1
374        | hash (Inside(a0,a1)) = 0w271 + ImageInfo.hash a0 + hashint a1        | hash (EvalKernel(a0,a1,a2)) = 0w271 + hashint a0 + Kernel.hash a1 + hashint a2
375        | hash (LoadSeq(a0,a1)) = 0w277 + hashty a0 + hashstring a1        | hash (Inside(a0,a1)) = 0w277 + ImageInfo.hash a0 + hashint a1
376        | hash (LoadImage(a0,a1)) = 0w281 + hashty a0 + hashstring a1        | hash (LoadSeq(a0,a1)) = 0w281 + hashty a0 + hashstring a1
377        | hash (Input(a0)) = 0w283 + hashinput a0        | hash (LoadImage(a0,a1)) = 0w283 + hashty a0 + hashstring a1
378        | hash (InputWithDefault(a0)) = 0w293 + hashinput a0        | hash (Input(a0)) = 0w293 + hashinput a0
379        | hash (Print(a0)) = 0w307 + hashtys a0        | hash (InputWithDefault(a0)) = 0w307 + hashinput a0
380          | hash (Print(a0)) = 0w311 + hashtys a0
381    
382      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]
383        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]
# Line 402  Line 416 
416        | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]        | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]
417        | toString (Trace(a0)) = concat["Trace<", intToString a0, ">"]        | toString (Trace(a0)) = concat["Trace<", intToString a0, ">"]
418        | toString (Transpose(a0,a1)) = concat["Transpose<", intToString a0, ",", intToString a1, ">"]        | toString (Transpose(a0,a1)) = concat["Transpose<", intToString a0, ",", intToString a1, ">"]
419          | toString (Slice(a0,a1)) = concat["Slice<", tyToString a0, ",", maskToString a1, ">"]
420        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]
421        | toString (Index(a0,a1)) = concat["Index<", tyToString a0, ",", intToString a1, ">"]        | toString (Index(a0,a1)) = concat["Index<", tyToString a0, ",", intToString a1, ">"]
422        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]

Legend:
Removed from v.2824  
changed lines
  Added in v.2825

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