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

SCM Repository

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

Diff of /branches/vis12/src/compiler/low-il/low-il.sml

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

revision 2821, Sun Nov 9 02:34:48 2014 UTC revision 2822, Sun Nov 9 02:36:50 2014 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 mask type *)
36        type mask = bool list
37        val samemask : (mask * mask -> bool) = (op =)
38        fun hashmask m =
39              List.foldl (fn (false, w) => w+w | (true, w) => w+w+0w1)
40                (Word.fromInt(List.length m)) m
41        fun maskToString m =
42              String.concat(List.map (fn true => "_" | false => ":") m)
43    
44    (* required helper functions for the input type *)    (* required helper functions for the input type *)
45      type input = ty Inputs.input      type input = ty Inputs.input
46      val sameinput = Inputs.same      val sameinput = Inputs.same
# Line 75  Line 84 
84        | Identity of int        | Identity of int
85        | Zero of ty        | Zero of ty
86        | Transpose of int * int        | Transpose of int * int
87          | Slice of ty * mask
88        | Select of ty * int        | Select of ty * int
89        | Index of ty * int        | Index of ty * int
90        | Subscript of ty        | Subscript of ty
# Line 136  Line 146 
146        | resultArity (Identity _) = 1        | resultArity (Identity _) = 1
147        | resultArity (Zero _) = 1        | resultArity (Zero _) = 1
148        | resultArity (Transpose _) = 1        | resultArity (Transpose _) = 1
149          | resultArity (Slice _) = 1
150        | resultArity (Select _) = 1        | resultArity (Select _) = 1
151        | resultArity (Index _) = 1        | resultArity (Index _) = 1
152        | resultArity (Subscript _) = 1        | resultArity (Subscript _) = 1
# Line 197  Line 208 
208        | arity (Identity _) = 0        | arity (Identity _) = 0
209        | arity (Zero _) = 0        | arity (Zero _) = 0
210        | arity (Transpose _) = 1        | arity (Transpose _) = 1
211          | arity (Slice _) = 1
212        | arity (Select _) = 1        | arity (Select _) = 1
213        | arity (Index _) = 1        | arity (Index _) = 1
214        | arity (Subscript _) = 2        | arity (Subscript _) = 2
# Line 267  Line 279 
279        | same (Identity(a0), Identity(b0)) = sameint(a0, b0)        | same (Identity(a0), Identity(b0)) = sameint(a0, b0)
280        | same (Zero(a0), Zero(b0)) = samety(a0, b0)        | same (Zero(a0), Zero(b0)) = samety(a0, b0)
281        | 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)
282          | same (Slice(a0,a1), Slice(b0,b1)) = samety(a0, b0) andalso samemask(a1, b1)
283        | 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)
284        | 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)
285        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)        | same (Subscript(a0), Subscript(b0)) = samety(a0, b0)
# Line 329  Line 342 
342        | hash (Identity(a0)) = 0w149 + hashint a0        | hash (Identity(a0)) = 0w149 + hashint a0
343        | hash (Zero(a0)) = 0w151 + hashty a0        | hash (Zero(a0)) = 0w151 + hashty a0
344        | hash (Transpose(a0,a1)) = 0w157 + hashint a0 + hashint a1        | hash (Transpose(a0,a1)) = 0w157 + hashint a0 + hashint a1
345        | hash (Select(a0,a1)) = 0w163 + hashty a0 + hashint a1        | hash (Slice(a0,a1)) = 0w163 + hashty a0 + hashmask a1
346        | hash (Index(a0,a1)) = 0w167 + hashty a0 + hashint a1        | hash (Select(a0,a1)) = 0w167 + hashty a0 + hashint a1
347        | hash (Subscript(a0)) = 0w173 + hashty a0        | hash (Index(a0,a1)) = 0w173 + hashty a0 + hashint a1
348        | hash (MkDynamic(a0,a1)) = 0w179 + hashty a0 + hashint a1        | hash (Subscript(a0)) = 0w179 + hashty a0
349        | hash (Append(a0)) = 0w181 + hashty a0        | hash (MkDynamic(a0,a1)) = 0w181 + hashty a0 + hashint a1
350        | hash (Prepend(a0)) = 0w191 + hashty a0        | hash (Append(a0)) = 0w191 + hashty a0
351        | hash (Concat(a0)) = 0w193 + hashty a0        | hash (Prepend(a0)) = 0w193 + hashty a0
352        | hash (Length(a0)) = 0w197 + hashty a0        | hash (Concat(a0)) = 0w197 + hashty a0
353        | hash (Ceiling(a0)) = 0w199 + hashint a0        | hash (Length(a0)) = 0w199 + hashty a0
354        | hash (Floor(a0)) = 0w211 + hashint a0        | hash (Ceiling(a0)) = 0w211 + hashint a0
355        | hash (Round(a0)) = 0w223 + hashint a0        | hash (Floor(a0)) = 0w223 + hashint a0
356        | hash (Trunc(a0)) = 0w227 + hashint a0        | hash (Round(a0)) = 0w227 + hashint a0
357        | hash IntToReal = 0w229        | hash (Trunc(a0)) = 0w229 + hashint a0
358        | hash (RealToInt(a0)) = 0w233 + hashint a0        | hash IntToReal = 0w233
359        | hash (ImageAddress(a0)) = 0w239 + ImageInfo.hash a0        | hash (RealToInt(a0)) = 0w239 + hashint a0
360        | hash (LoadVoxels(a0,a1)) = 0w241 + ImageInfo.hash a0 + hashint a1        | hash (ImageAddress(a0)) = 0w241 + ImageInfo.hash a0
361        | hash (PosToImgSpace(a0)) = 0w251 + ImageInfo.hash a0        | hash (LoadVoxels(a0,a1)) = 0w251 + ImageInfo.hash a0 + hashint a1
362        | hash (TensorToWorldSpace(a0,a1)) = 0w257 + ImageInfo.hash a0 + hashty a1        | hash (PosToImgSpace(a0)) = 0w257 + ImageInfo.hash a0
363        | hash (Inside(a0,a1)) = 0w263 + ImageInfo.hash a0 + hashint a1        | hash (TensorToWorldSpace(a0,a1)) = 0w263 + ImageInfo.hash a0 + hashty a1
364        | hash (LoadSeq(a0,a1)) = 0w269 + hashty a0 + hashstring a1        | hash (Inside(a0,a1)) = 0w269 + ImageInfo.hash a0 + hashint a1
365        | hash (LoadImage(a0,a1)) = 0w271 + hashty a0 + hashstring a1        | hash (LoadSeq(a0,a1)) = 0w271 + hashty a0 + hashstring a1
366        | hash (Input(a0)) = 0w277 + hashinput a0        | hash (LoadImage(a0,a1)) = 0w277 + hashty a0 + hashstring a1
367        | hash (InputWithDefault(a0)) = 0w281 + hashinput a0        | hash (Input(a0)) = 0w281 + hashinput a0
368        | hash (Print(a0)) = 0w283 + hashtys a0        | hash (InputWithDefault(a0)) = 0w283 + hashinput a0
369          | hash (Print(a0)) = 0w293 + hashtys a0
370    
371      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]      fun toString (Add(a0)) = concat["Add<", tyToString a0, ">"]
372        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]        | toString (Sub(a0)) = concat["Sub<", tyToString a0, ">"]
# Line 390  Line 404 
404        | toString (Identity(a0)) = concat["Identity<", intToString a0, ">"]        | toString (Identity(a0)) = concat["Identity<", intToString a0, ">"]
405        | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]        | toString (Zero(a0)) = concat["Zero<", tyToString a0, ">"]
406        | toString (Transpose(a0,a1)) = concat["Transpose<", intToString a0, ",", intToString a1, ">"]        | toString (Transpose(a0,a1)) = concat["Transpose<", intToString a0, ",", intToString a1, ">"]
407          | toString (Slice(a0,a1)) = concat["Slice<", tyToString a0, ",", maskToString a1, ">"]
408        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]        | toString (Select(a0,a1)) = concat["Select<", tyToString a0, ",", intToString a1, ">"]
409        | toString (Index(a0,a1)) = concat["Index<", tyToString a0, ",", intToString a1, ">"]        | toString (Index(a0,a1)) = concat["Index<", tyToString a0, ",", intToString a1, ">"]
410        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]        | toString (Subscript(a0)) = concat["Subscript<", tyToString a0, ">"]

Legend:
Removed from v.2821  
changed lines
  Added in v.2822

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