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/split.sml
ViewVC logotype

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

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

revision 3259, Mon Sep 21 15:14:52 2015 UTC revision 3260, Wed Sep 23 16:09:21 2015 UTC
# Line 34  Line 34 
34    
35      val numFlag=1   (*remove common subexpression*)      val numFlag=1   (*remove common subexpression*)
36      val testing=0      val testing=0
37      fun setEin(params,index,body)=Ein.EIN{params=params, index=index, body=body}      fun mkEin e = E.mkEin e
38      fun assignEinApp(y,params,index,body,args)= (y,DstIL.EINAPP(setEin(params,index,body),args))      val einappzero= DstIL.EINAPP(mkEin([],[],E.Const 0),[])
     val einappzero=DstIL.EINAPP(setEin([],[],E.Const 0),[])  
39      fun setEinZero y=  (y,einappzero)      fun setEinZero y=  (y,einappzero)
40      fun cleanParams e =cleanP.cleanParams e      fun cleanParams e =cleanP.cleanParams e
41      fun cleanIndex e =cleanI.cleanIndex e      fun cleanIndex e =cleanI.cleanIndex e
42      fun printEINAPP e=MidToString.printEINAPP e      fun toStringBind e= MidToString.toStringBind e
43      fun itos i =Int.toString i      fun itos i =Int.toString i
     fun filterSca e=Filter.filterSca e  
44      fun err str=raise Fail str      fun err str=raise Fail str
45      val cnt = ref 0      val cnt = ref 0
46      fun incUse (DstIL.V{useCnt, ...}) = (useCnt := !useCnt + 1)      fun incUse (DstIL.V{useCnt, ...}) = (useCnt := !useCnt + 1)
# Line 116  Line 114 
114          | _           => 2          | _           => 2
115      (*end case*))      (*end case*))
116    
   
   
117      fun rewriteOp3(name,sx,e1,x)=let      fun rewriteOp3(name,sx,e1,x)=let
118          val ((y, DstIL.EINAPP(ein,args)),fieldset,flag)=x          val ((y, DstIL.EINAPP(ein,args)),fieldset,flag)=x
119          val params=Ein.params ein          val params=Ein.params ein
# Line 138  Line 134 
134          | 2     => (e1,params,args,[],fieldset)             (*not lifted*)          | 2     => (e1,params,args,[],fieldset)             (*not lifted*)
135          (*end*))          (*end*))
136    
   
   
   
137      fun rewriteOps(name,list1,params,index,sx,args,fieldset0,flag)=let      fun rewriteOps(name,list1,params,index,sx,args,fieldset0,flag)=let
138          fun m([],rest,params,args,code,fieldset)=(rest,params,args,code,fieldset)          fun m([],rest,params,args,code,fieldset)=(rest,params,args,code,fieldset)
139          | m(e1::es,rest,params,args,code,fieldset)=let          | m(e1::es,rest,params,args,code,fieldset)=let
# Line 382  Line 375 
375          | itercode(e1::newbies,rest,code,cnt)=let          | itercode(e1::newbies,rest,code,cnt)=let
376              val ((einapp3,code3),_) = split(e1,fieldset,numFlag)              val ((einapp3,code3),_) = split(e1,fieldset,numFlag)
377              val (rest4,code4)=itercode(code3,[],[],cnt+1)              val (rest4,code4)=itercode(code3,[],[],cnt+1)
378                  val _ =testp [printEINAPP(e1),"\n\t===>\n",printEINAPP(einapp3),"\nand\n",(String.concatWith",\n\t"(List.map printEINAPP (code4@rest4)))]                  val _ =testp [toStringBind(e1),"\n\t===>\n",toStringBind(einapp3),"\nand\n",(String.concatWith",\n\t"(List.map toStringBind (code4@rest4)))]
379              in              in
380                  itercode(newbies,rest@[einapp3],code4@( rest4)@code,cnt+2)                  itercode(newbies,rest@[einapp3],code4@( rest4)@code,cnt+2)
381              end              end
# Line 397  Line 390 
390          (* **** split in parts **** *)          (* **** split in parts **** *)
391          (*          (*
392          val ((einapp4,newbies4),fieldset)=split(einapp3,fieldset,0)          val ((einapp4,newbies4),fieldset)=split(einapp3,fieldset,0)
393          val _ =testp["\n\t===>\n",printEINAPP(einapp4),"\nand\n",(String.concatWith",\n\t"(List.map printEINAPP newbies4))]          val _ =testp["\n\t===>\n",toStringBind(einapp4),"\nand\n",(String.concatWith",\n\t"(List.map toStringBind newbies4))]
394          val (newbies5)= iterMultiple(einapp4,newbies4,fieldset)          val (newbies5)= iterMultiple(einapp4,newbies4,fieldset)
395          *)          *)
396    

Legend:
Removed from v.3259  
changed lines
  Added in v.3260

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