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

SCM Repository

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

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

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

revision 3651, Tue Feb 2 16:59:08 2016 UTC revision 3652, Tue Feb 2 20:23:12 2016 UTC
# Line 23  Line 23 
23      type tys = ty list      type tys = ty list
24      fun sametys (tys1, tys2) = ListPair.allEq samety (tys1, tys2)      fun sametys (tys1, tys2) = ListPair.allEq samety (tys1, tys2)
25      fun hashtys tys = List.foldl (fn (ty, s) => hashty ty + 0w3 * s) 0w0 tys      fun hashtys tys = List.foldl (fn (ty, s) => hashty ty + 0w3 * s) 0w0 tys
26      fun tysToString tys = String.concat["[", String.concatWith "," (List.map tyToString tys), "]" ]      fun tysToString tys = String.concat["[", String.concatWithMap "," tyToString tys, "]" ]
27    
28    (* required helper functions for the int type *)    (* required helper functions for the int type *)
29      fun sameint (i1 : int, i2) = (i1 = i2)      fun sameint (i1 : int, i2) = (i1 = i2)
# Line 35  Line 35 
35      val hashstring = HashString.hashString      val hashstring = HashString.hashString
36      fun stringToString s = String.concat["\"", s, "\""]      fun stringToString s = String.concat["\"", s, "\""]
37    
38      (* required helper functions for the shape type *)
39        type shape = int list
40        val sameshape : (shape * shape -> bool) = (op =)
41        fun hashshape shp =
42              List.foldl (fn (i, w) => Word.xorb(Word.<<(w, 0w1), Word.fromInt i))
43                (Word.fromInt(List.length shp)) shp
44        fun shapeToString shp = String.concat["[", String.concatWithMap "," Int.toString shp, "]"]
45    
46    (* required helper functions for the mask type *)    (* required helper functions for the mask type *)
47      type mask = bool list      type mask = bool list
48      val samemask : (mask * mask -> bool) = (op =)      val samemask : (mask * mask -> bool) = (op =)
# Line 69  Line 77 
77        | VNeg of int        | VNeg of int
78        | VSum of int        | VSum of int
79        | VProj of int * int        | VProj of int * int
80        | TensorIndex of ty * intlist        | TensorIndex of ty * shape
81        | ProjectLast of ty * intlist        | ProjectLast of ty * shape
82        | LT of ty        | LT of ty
83        | LTE of ty        | LTE of ty
84        | EQ of ty        | EQ of ty
# Line 316  Line 324 
324        | same (VNeg(a0), VNeg(b0)) = sameint(a0, b0)        | same (VNeg(a0), VNeg(b0)) = sameint(a0, b0)
325        | same (VSum(a0), VSum(b0)) = sameint(a0, b0)        | same (VSum(a0), VSum(b0)) = sameint(a0, b0)
326        | same (VProj(a0,a1), VProj(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)        | same (VProj(a0,a1), VProj(b0,b1)) = sameint(a0, b0) andalso sameint(a1, b1)
327        | same (TensorIndex(a0,a1), TensorIndex(b0,b1)) = samety(a0, b0) andalso sameintlist(a1, b1)        | same (TensorIndex(a0,a1), TensorIndex(b0,b1)) = samety(a0, b0) andalso sameshape(a1, b1)
328        | same (ProjectLast(a0,a1), ProjectLast(b0,b1)) = samety(a0, b0) andalso sameintlist(a1, b1)        | same (ProjectLast(a0,a1), ProjectLast(b0,b1)) = samety(a0, b0) andalso sameshape(a1, b1)
329        | same (LT(a0), LT(b0)) = samety(a0, b0)        | same (LT(a0), LT(b0)) = samety(a0, b0)
330        | same (LTE(a0), LTE(b0)) = samety(a0, b0)        | same (LTE(a0), LTE(b0)) = samety(a0, b0)
331        | same (EQ(a0), EQ(b0)) = samety(a0, b0)        | same (EQ(a0), EQ(b0)) = samety(a0, b0)
# Line 397  Line 405 
405        | hash (VNeg(a0)) = 0w59 + hashint a0        | hash (VNeg(a0)) = 0w59 + hashint a0
406        | hash (VSum(a0)) = 0w61 + hashint a0        | hash (VSum(a0)) = 0w61 + hashint a0
407        | hash (VProj(a0,a1)) = 0w67 + hashint a0 + hashint a1        | hash (VProj(a0,a1)) = 0w67 + hashint a0 + hashint a1
408        | hash (TensorIndex(a0,a1)) = 0w71 + hashty a0 + hashintlist a1        | hash (TensorIndex(a0,a1)) = 0w71 + hashty a0 + hashshape a1
409        | hash (ProjectLast(a0,a1)) = 0w73 + hashty a0 + hashintlist a1        | hash (ProjectLast(a0,a1)) = 0w73 + hashty a0 + hashshape a1
410        | hash (LT(a0)) = 0w79 + hashty a0        | hash (LT(a0)) = 0w79 + hashty a0
411        | hash (LTE(a0)) = 0w83 + hashty a0        | hash (LTE(a0)) = 0w83 + hashty a0
412        | hash (EQ(a0)) = 0w89 + hashty a0        | hash (EQ(a0)) = 0w89 + hashty a0
# Line 477  Line 485 
485        | toString (VNeg(a0)) = concat["VNeg<", intToString a0, ">"]        | toString (VNeg(a0)) = concat["VNeg<", intToString a0, ">"]
486        | toString (VSum(a0)) = concat["VSum<", intToString a0, ">"]        | toString (VSum(a0)) = concat["VSum<", intToString a0, ">"]
487        | toString (VProj(a0,a1)) = concat["VProj<", intToString a0, ",", intToString a1, ">"]        | toString (VProj(a0,a1)) = concat["VProj<", intToString a0, ",", intToString a1, ">"]
488        | toString (TensorIndex(a0,a1)) = concat["TensorIndex<", tyToString a0, ",", intlistToString a1, ">"]        | toString (TensorIndex(a0,a1)) = concat["TensorIndex<", tyToString a0, ",", shapeToString a1, ">"]
489        | toString (ProjectLast(a0,a1)) = concat["ProjectLast<", tyToString a0, ",", intlistToString a1, ">"]        | toString (ProjectLast(a0,a1)) = concat["ProjectLast<", tyToString a0, ",", shapeToString a1, ">"]
490        | toString (LT(a0)) = concat["LT<", tyToString a0, ">"]        | toString (LT(a0)) = concat["LT<", tyToString a0, ">"]
491        | toString (LTE(a0)) = concat["LTE<", tyToString a0, ">"]        | toString (LTE(a0)) = concat["LTE<", tyToString a0, ">"]
492        | toString (EQ(a0)) = concat["EQ<", tyToString a0, ">"]        | toString (EQ(a0)) = concat["EQ<", tyToString a0, ">"]

Legend:
Removed from v.3651  
changed lines
  Added in v.3652

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