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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/tree-il/tree-ops.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/tree-il/tree-ops.sml

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

revision 3543, Mon Jan 4 21:06:20 2016 UTC revision 3544, Tue Jan 5 00:01:44 2016 UTC
# Line 43  Line 43 
43      val hashinput = Inputs.hash      val hashinput = Inputs.hash
44      val inputToString = Inputs.toString      val inputToString = Inputs.toString
45    
46     (* required helper functions for the intlist type *)
47     type intlist=int list
48     fun sameintlist  (tys1, tys2) = ListPair.allEq (fn (a,b)=> (a=b)) (tys1, tys2)
49     fun hashintlist tys = List.foldl (fn (ty, s) => Word.fromInt ty + 0w3 * s) 0w0 tys
50     fun intlistToString tys = String.concat["[", String.concatWith "," (List.map Int.toString tys), "]" ]
51    
52      datatype rator      datatype rator
53        = IAdd        = IAdd
54        | ISub        | ISub
55        | IMul        | IMul
56        | IDiv        | IDiv
57        | INeg        | INeg
58        | IndexTensor of bool*ty* ty (*bool-isLocal,indexTy,argTy*)        | IndexTensor of bool*intlist* ty (*bool-isLocal,indexTy,argTy*)
59        | addSca        | addSca
60        | subSca        | subSca
61        | prodSca        | prodSca
# Line 271  Line 277 
277        | same (IMul, IMul) = true        | same (IMul, IMul) = true
278        | same (IDiv, IDiv) = true        | same (IDiv, IDiv) = true
279        | same (INeg, INeg) = true        | same (INeg, INeg) = true
280        | same (IndexTensor(a0,a1,a2), IndexTensor(b0,b1,b2)) = a0=b0  andalso samety(a1, b1) andalso samety(a2, b2)        | same (IndexTensor(a0,a1,a2), IndexTensor(b0,b1,b2)) = a0=b0  andalso (a1=b1) andalso samety(a2, b2)
281        | same (addSca, addSca) = true        | same (addSca, addSca) = true
282        | same (subSca, subSca) = true        | same (subSca, subSca) = true
283        | same (prodSca, prodSca) = true        | same (prodSca, prodSca) = true
# Line 345  Line 351 
351        | hash IMul = 0w7        | hash IMul = 0w7
352        | hash IDiv = 0w11        | hash IDiv = 0w11
353        | hash INeg = 0w13        | hash INeg = 0w13
354        | hash (IndexTensor(a0,a1,a2)) = 0w19 + hashBool a0+hashty a1+hashty a2        | hash (IndexTensor(a0,a1,a2)) = 0w19 + hashBool a0+hashIntList a1+hashty a2
355        | hash addSca = 0w23        | hash addSca = 0w23
356        | hash subSca = 0w29        | hash subSca = 0w29
357        | hash prodSca = 0w31        | hash prodSca = 0w31
# Line 418  Line 424 
424        | toString IMul = "IMul"        | toString IMul = "IMul"
425        | toString IDiv = "IDiv"        | toString IDiv = "IDiv"
426        | toString INeg = "INeg"        | toString INeg = "INeg"
427        | toString (IndexTensor(a0,a1,a2)) = concat["IndexTensor(", toStringBool a0, ")IndexTy<", tyToString a1, ">_ArgTy_(", tyToString  a2,")"]        | toString (IndexTensor(a0,a1,a2)) = concat["IndexTensor(", toStringBool a0, ")IndexTy<", intlistToString a1, ">_ArgTy_(", tyToString  a2,")"]
428        | toString addSca = "addSca"        | toString addSca = "addSca"
429        | toString subSca = "subSca"        | toString subSca = "subSca"
430        | toString powSca = "powSca"        | toString powSca = "powSca"

Legend:
Removed from v.3543  
changed lines
  Added in v.3544

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