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 3383, Mon Nov 9 02:39:26 2015 UTC revision 3460, Mon Nov 23 20:27:35 2015 UTC
# Line 17  Line 17 
17      structure L=LiftEin      structure L=LiftEin
18      in      in
19    
20        val liftflag=false
21        val splitflag=true
22        val splitlimit=SOME 1100
23    
24      val testinitial=0      val testinitial=0
25      val testing=0      val testing=0
26      fun testp n=(case testing      fun testp n=(case testing
# Line 29  Line 33 
33      fun toStringBind e= MidToS.toStringBind e      fun toStringBind e= MidToS.toStringBind e
34      fun useCount (HighIL.V{useCnt, ...}) = !useCnt      fun useCount (HighIL.V{useCnt, ...}) = !useCnt
35      fun expandEinOp (srcy,bind00)=let      fun expandEinOp (srcy,bind00)=let
36          val _=raise Fail"development branch- do not use"          (*val _= raise Fail"development branch- do not use"*)
37          val star="************"          val star="************"
38          val _=print ("\n Start"^star)          val _= ("\n Start"^star)
39          val _ =test0[star,"\n Original EinApp",star,"\n\n","start get test",toStringBind bind00]          val _ =test0[star,"\n Original EinApp",star,"\n\n","start get test",toStringBind bind00]
40          val (y,einapp as DstIL.EINAPP(Ein.EIN{params, index, body},args))=bind00          val (y,einapp as DstIL.EINAPP(Ein.EIN{params, index, body},args))=bind00
41    
42    
43          (* ************* Sweep for 0's'*********** *)          (* ************* Sweep for 0's'*********** *)
44          val _ =(String.concat["Pre Sweep\n",P.printbody body,"\n"])          val _ =testp["Pre Sweep\n",P.printbody body,"\n"]
45          val bodysweep=sweepEin.sweep body          val bodysweep=sweepEin.sweep body
46          val ein1=Ein.EIN{params=params, index=index, body=bodysweep}          val ein1=Ein.EIN{params=params, index=index, body=bodysweep}
47          val _ =(String.concat["Post Sweep\n",P.printbody bodysweep,"\n"])          val _ =testp["Post Sweep\n",P.printbody bodysweep,"\n"]
48    
49    
50          (* ************** distribute and push Summation*********** *)          (* ************** distribute and push Summation*********** *)
51          val bind3 = (y,DstIL.EINAPP(SummationEin.main ein1,args))          val bind3 = (y,DstIL.EINAPP(SummationEin.main ein1,args))
52          val _ =testp["\n\n summation \n\n =>", toStringBind bind3]          val _ =testp["\n\n summation \n\n =>", toStringBind bind3]
53    
54  (* **************** lift no split ************* *)       (* **************** lift - split ************* *)
55  (*          val newbies5=  (case (splitflag,liftflag,splitlimit)
56                of (true,false,_) => Split.splitEinApp bind3
57                    (* **************** split phase ************* *)
58                | (true,true,SOME limit) =>  let
59                    (* **************** lift and split Limit ************* *)
60   val (einapp1,e2)=L.testLift  bind3   val (einapp1,e2)=L.testLift  bind3
61  val newbies5=e2@[einapp1]                  val _ =print (String.concat["\nSPLit with limit",Int.toString(limit),"\n **** lift Length:",Int.toString(length(e2))])
62     val _ =  print("\n **** lift Length"^(Int.toString(length(e2))))                  val newbies4=Split.limitSplit(einapp1,650)
63  *)                  in (e2@newbies4) end
64                | (true,true, NONE) => let
65      (* **************** lift field phase ************* *)                  (* **************** lift and split All ************* *)
66                    val (einapp1,e2)=L.testLift  bind3
67                    val _ =  testp["\n **** lift Length"^(Int.toString(length(e2)))]
68                    val newbies4=Split.splitEinApp einapp1
69                    in (e2@newbies4) end
70                | (false,true,_) => let
71           val (einapp1,e2)=L.testLift  bind3           val (einapp1,e2)=L.testLift  bind3
72     val _ =  print("\n **** lift Length"^(Int.toString(length(e2))))     val _ =  print("\n **** lift Length"^(Int.toString(length(e2))))
73          val newbies5=  Split.iterAll2(einapp1,e2)                  in (e2@[einapp1]) end
74          val n =length(newbies5)              |  (false,false,_)=>Split.splitEinApp bind3
75          val _ = if (n > 10) then print("\n **** SPLIT Length"^(Int.toString(n))) else print ""          (* end case *))
   
   
76    
77          (* **************** split phase ************* *)          (**************** printing result ***************)
78  (*          val _ =testp["\n\n Returning \n\n =>",
         val (newbies5)= Split.splitEinApp(bind3,9)  
         val _ =test0["\n\n Returning \n\n =>",  
79          String.concatWith",\n\t"(List.map toStringBind newbies5)]          String.concatWith",\n\t"(List.map toStringBind newbies5)]
80  *)          val n =length(newbies5)
81  val _=print"probein\n"          val _ = if (n > 10) then print(String.concat["\n **** SPLIT Length",Int.toString(n)]) else print ""
82           (* ************** ProbeEIN *********** *)           (* ************** ProbeEIN *********** *)
83          (*gives probeEIN the set. Could split into a sepearate step*)          (*gives probeEIN the set. Could split into a sepearate step*)
84          val fieldset= einSet.EinSet.empty          val fieldset= einSet.EinSet.empty
# Line 88  Line 96 
96          val code=iter(newbies5, fieldset)          val code=iter(newbies5, fieldset)
97    
98          val n= List.length(code)          val n= List.length(code)
99            val _ =testp[HighIL.Var.name srcy ," Pieces",Int.toString (n),"\n"]
100    (*
101            val _ = if (n>5)            val _ = if (n>5)
102            then  print(String.concat["\n\n",star,":Name:",HighIL.Var.name srcy ,            then  print(String.concat["\n",star,":Name:",HighIL.Var.name srcy ,
103              ":VarCount(",Int.toString(useCount srcy),")",              ":VarCount(",Int.toString(useCount srcy),")","Pieces now: ",Int.toString (n),
                 "\n\t",star,"Pieces now: ",Int.toString (n),  
104              " Fields:",Int.toString(!isField)," isReplaced:",Int.toString(!isReplaced),              " Fields:",Int.toString(!isField)," isReplaced:",Int.toString(!isReplaced),
105              " Replaced_Fields:",Int.toString(!isFieldR)])              " Replaced_Fields:",Int.toString(!isFieldR)])
106              else print ""              else print ""
107    *)
108      val flatcode= List.foldr op@ [] code      val flatcode= List.foldr op@ [] code
109    
 (*  
     (*added extra step*)  
     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=> getSet(es,done@[(lhs,DstIL.VAR v)], opset,cnt+1)  
             (*end case*))  
         end  
110    
        val (flatcode,cnt)=getSet(flatcode, [],tbl0,0)  
   
        val n=length(flatcode)  
         val _ =print(String.concat["\n Length: ",Int.toString n," Replaced: ", Int.toString cnt,  
                 "\n",DstIL.Var.toString(y),"\n"])  
   
 *)  
111          (*val _=List.map (fn(_,DstIL.EINAPP(e,_))=>checkEin.checkEIN e | _=> 1) flatcode*)          (*val _=List.map (fn(_,DstIL.EINAPP(e,_))=>checkEin.checkEIN e | _=> 1) flatcode*)
112          val _=(star^"end")          val _=(star^"end")
113          in          in

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

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