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

SCM Repository

[diderot] Diff of /branches/charisee_dev/src/compiler/high-to-mid/einSet.sml
ViewVC logotype

Diff of /branches/charisee_dev/src/compiler/high-to-mid/einSet.sml

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

revision 3382, Sat Nov 7 03:51:29 2015 UTC revision 3383, Mon Nov 9 02:39:26 2015 UTC
# Line 22  Line 22 
22    
23     fun cmp((_,MidIL.EINAPP(e1,_)),(_,MidIL.EINAPP(e2,_)))=(Word.compare(HashEin.hashfn e1, HashEin.hashfn e2))     fun cmp((_,MidIL.EINAPP(e1,_)),(_,MidIL.EINAPP(e2,_)))=(Word.compare(HashEin.hashfn e1, HashEin.hashfn e2))
24    
25    
26     structure OprKey =     structure OprKey =
27          struct          struct
28          type ord_key =MidIL.var*MidIL.rhs          type ord_key =MidIL.var*MidIL.rhs
# Line 32  Line 33 
33    
34      fun einSetToString(str,v,MidIL.EINAPP(e,args))=(String.concat["\n",str,DstV.toString v,"=",      fun einSetToString(str,v,MidIL.EINAPP(e,args))=(String.concat["\n",str,DstV.toString v,"=",
35                  P.printerE e,"(",String.concatWith","(List.map DstV.toString args),")\n"])                  P.printerE e,"(",String.concatWith","(List.map DstV.toString args),")\n"])
36            |einSetToString _ =""
37    
38      fun allEq([], []) = true      fun allEq([], []) = true
39        | allEq(x::xs, y::ys) = DstIL.Var.same(x,y) andalso allEq (xs,ys)        | allEq(x::xs, y::ys) = DstIL.Var.same(x,y) andalso allEq (xs,ys)
# Line 39  Line 41 
41    
42      fun setFind (tbl,_,MidIL.EINAPP(ein0,arg0))= (      fun setFind (tbl,_,MidIL.EINAPP(ein0,arg0))= (
43          EinSet.find(          EinSet.find(
44              (fn (_,MidIL.EINAPP(ein1,arg1))=>(EqualEin.isEinEqual(ein0,ein1) andalso allEq(arg0,arg1)))              (fn (_,MidIL.EINAPP(ein1,arg1))=>(EqualEin.isEinEqual(ein0,ein1) andalso allEq(arg0,arg1)) | _ =>false
45          )) tbl          ))) tbl
46            | setFind  _ = NONE
47    
48      fun rtnVar (tbl,v,e)=(case setFind(tbl,v,e)      fun rtnVar (tbl,v,e)=(case setFind(tbl,v,e)
49          of NONE     => ((einSetToString("\n\t inserting: ",v,e));(EinSet.add(tbl,(v,e)), NONE))          of NONE     => ((einSetToString("\n\t inserting: ",v,e));(EinSet.add(tbl,(v,e)), NONE))
50          | SOME(v1,e1) => ( (einSetToString("\n\nfound: ",v,e));(einSetToString("\n with: ",v1,e1));(tbl,SOME v1))          | SOME(v1,e1) => ( (einSetToString("\n\nfound: ",v,e));(einSetToString("\n with: ",v1,e1));(tbl,SOME v1))
51          (*end case*))          (*end case*))
52    
53    fun rtnVarN (tbl,(v,e))=(case setFind(tbl,v,e)
54    of NONE     => ((einSetToString("\n\t inserting: ",v,e));(EinSet.add(tbl,(v,e)), NONE))
55    | SOME(v1,e1) => ( (einSetToString("\n\nfound: ",v,e));(einSetToString("\n with: ",v1,e1));(tbl,SOME v1))
56    (*end case*))
57    
58      fun setToString tbl=List.map (fn (e1,e2)=> einSetToString("\n",e1,e2)) (EinSet.listItems (tbl))      fun setToString tbl=List.map (fn (e1,e2)=> einSetToString("\n",e1,e2)) (EinSet.listItems (tbl))
59    
60    

Legend:
Removed from v.3382  
changed lines
  Added in v.3383

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