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

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

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

revision 3677, Fri Feb 12 22:27:24 2016 UTC revision 3678, Mon Feb 15 19:36:00 2016 UTC
# Line 17  Line 17 
17      structure L=LiftEin      structure L=LiftEin
18      in      in
19    
20      val liftflag=true  
21        val sumflag = true
22        val probeflag = true
23        val floatflag = true
24        val liftflag = false
25      val splitflag=false      val splitflag=false
26      val splitlimit=NONE      val limit = NONE
27    
28      val testinitial=0      val testinitial=0
29      val testing=0      val testing=0
30      fun testp n=(case testing      fun testp n=(case testing
# Line 41  Line 46 
46    
47    
48          (* ************* Sweep for 0's'*********** *)          (* ************* Sweep for 0's'*********** *)
         val _ =testp["Pre Sweep\n",P.printbody body,"\n"]  
49          val bodysweep=sweepEin.sweep body          val bodysweep=sweepEin.sweep body
50          val ein1=Ein.EIN{params=params, index=index, body=bodysweep}          val ein = Ein.EIN{params=params, index=index, body=bodysweep}
         val _ =testp["Post Sweep\n",P.printbody bodysweep,"\n"]  
   
51    
  val bind3 = (y,DstIL.EINAPP( ein1,args))  
52    
 (*  
53          (* ************** distribute and push Summation*********** *)          (* ************** distribute and push Summation*********** *)
54          val bind3 = (y,DstIL.EINAPP(SummationEin.main ein1,args))          val bind3 =  case sumflag
55          val _ =testp["\n\n summation \n\n =>", toStringBind bind3]              of false => (y,DstIL.EINAPP( ein,args))
56  *)              | _ => (y,DstIL.EINAPP(SummationEin.main ein,args))
57    
58          (* **************** lift - split ************* *)          (* **************** lift - split ************* *)
59          val newbies5=  (case (splitflag,liftflag,splitlimit)          val newbies5=  (case (floatflag,liftflag,splitflag,limit)
60              of (true,false,NONE) => Split.splitEinApp bind3              of (true,_,_,_)                                         (*Float*)
61              (* **************** split phase ************* *)                  => List.map (fn MidIL.ASSGN(i)=> i ) (FloatEin.transform bind3)
62              | (true,false,SOME limit) =>let              | (false,true,_,_) =>   let
                 val _ = (String.concat["\nSPLit with limit",Int.toString(limit)])  
                 in Split.limitSplit(bind3,limit) end  
             | (true,true,SOME limit) =>  let  
                 (* **************** lift and split Limit ************* *)  
                 val (einapp1,e2a,fieldset)=L.testLift  bind3  
                 val _ = (String.concat["\nSPLit with limit",Int.toString(limit),"\n **** lift Length:",Int.toString(length(e2a))])  
   
                (* val t2=List.map (fn t=>Split.splitEinApp t) e2*)  
                 val t2=List.map (fn t =>Split.limitSplit2(t,limit,fieldset)) e2a  
                 val e2= List.foldr op@ [] t2  
                 val newbies4=Split.limitSplit2(einapp1,limit,fieldset)  
                 val _ = testp["\n split made pieces(",Int.toString(length(e2)-length(e2a)),") orig (", Int.toString(length(newbies4)),")"]  
                 in (e2@newbies4) end  
             | (true,true, NONE) => let  
                 (* **************** lift and split All ************* *)  
                 val (einapp1,e2a,_)=L.testLift  bind3  
                 val _ =  testp["\n **** lift Length"^(Int.toString(length(e2a)))]  
                 val e2= List.foldr op@ [] (List.map (fn t=>Split.splitEinApp t) e2a)  
                 val newbies4=Split.splitEinApp einapp1  
                 val _ = testp["\n split made pieces(",Int.toString(length(e2)-length(e2a)),") orig (", Int.toString(length(newbies4)),")"]  
                 in (e2@newbies4) end  
             | (false,true,_) => let  
 (*  
63                  val (einapp1,e2,_)=L.testLift  bind3                  val (einapp1,e2,_)=L.testLift  bind3
64                  val _ = print("\n **** lift Length"^(Int.toString(length(e2))))                  in (e2@[einapp1]) end                              (*LIFT*)
65                  in (e2@[einapp1]) end              | (false,false,true,NONE) =>  Split.splitEinApp bind3 (*SPLIT*)
66  *)              (* **************** split phase ************* *)
67                  val k=FloatEin.transform bind3              | (false,false,true, SOME limit) => Split.limitSplit(bind3,limit)
                 in List.map (fn MidIL.ASSGN(i)=> i ) k end  
             |  (false,false,_)=>Split.splitEinApp bind3  
   
68          (* end case *))          (* end case *))
69  (*  
         val flatcode=newbies5 (*skip probeein*)  
 *)  
         val _ = "************** TASH"  
         (**************** printing result ***************)  
         val _ =testp["\n\n Returning \n\n =>", String.concatWith",\n\t"(List.map toStringBind newbies5)]  
         val n =length(newbies5)  
        (* val _ = if (n > 1) then print(String.concat["\n **** SPLIT Length",Int.toString(n)]) else print""*)  
70           (* ************** ProbeEIN *********** *)           (* ************** ProbeEIN *********** *)
71          (*gives probeEIN the set. Could split into a sepearate step*)          (*gives probeEIN the set. Could split into a sepearate step*)
72          val fieldset= einVarSet.EinVarSet.empty          val fieldset= einVarSet.EinVarSet.empty
# Line 114  Line 82 
82              in (isField:=(!isField)+isFieldt;isReplaced:=(!isReplaced )+isReplacedt;              in (isField:=(!isField)+isFieldt;isReplaced:=(!isReplaced )+isReplacedt;
83              isFieldR:=(!isFieldR)+isFieldRt;rtn)              isFieldR:=(!isFieldR)+isFieldRt;rtn)
84              end              end
         val code=iter(newbies5, fieldset,varset)  
         val flatcode= List.foldr op@ [] code  
85    
86          val n= List.length(code)          val flatcode = (case  probeflag
87          val m= List.length(flatcode)              of true =>  List.foldr op@ [] (iter(newbies5, fieldset,varset))
88          val _ =(String.concat["\n",HighIL.Var.name srcy ," Pieces",Int.toString (m),"\n"])              | _ => newbies5)
89    
           val _ = if (n>5)  
           then  testp["\n",star,":Name:",HighIL.Var.name srcy ,  
             ":VarCount(",Int.toString(useCount srcy),")","\n\tPieces now: ",Int.toString (n),"flatcode",Int.toString (m),  
             " Fields:",Int.toString(!isField)," isReplaced:",Int.toString(!isReplaced),  
             " Replaced_Fields:",Int.toString(!isFieldR)] else 1  
   
   
         val flatcode= List.foldr op@ [] code  
   
 (*  
         val tbl0= einSet.EinSet.empty  
         fun getSet([],done,_,cnt)=(done,cnt)  
          | getSet((lhs,rhs)::es,done,opset,cnt)=let  
                 val (opset,var) = einSet.rtnVarN(opset,(lhs,rhs))  
                 in  (case var  
                     of NONE => getSet(es,done@[(lhs,rhs)], opset,cnt)  
                     | SOME v=> (("replacing"^DstIL.Var.toString(lhs));getSet(es,done@[(lhs,DstIL.VAR v)], opset,cnt+1))  
                     (*end case*))  
                 end  
         val _="creating set"  
         val (flatcode,cnt)=getSet(flatcode, [],tbl0,0)  
         val _ = " post creating set"  
         val n=length(flatcode)  
         val _ = (String.concat["\n Length: ",Int.toString n," Replaced: ", Int.toString cnt,"\n"])  
 *)  
90          in          in
91              List.map (fn (y,rator)=> DstIL.ASSGN(y,rator)) flatcode              List.map (fn (y,rator)=> DstIL.ASSGN(y,rator)) flatcode
92          end          end

Legend:
Removed from v.3677  
changed lines
  Added in v.3678

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