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 3497, Fri Dec 11 23:54:24 2015 UTC revision 3503, Thu Dec 17 23:13:57 2015 UTC
# Line 17  Line 17 
17      structure L=LiftEin      structure L=LiftEin
18      in      in
19    
20      val liftflag=false      val liftflag=true
21      val splitflag=true      val splitflag=true
22      val splitlimit=NONE      val splitlimit=NONE
23        val testinitial=0
     val testinitial=1  
24      val testing=0      val testing=0
25      fun testp n=(case testing      fun testp n=(case testing
26          of 0=> 1          of 0=> 1
# Line 57  Line 56 
56              of (true,false,NONE) => Split.splitEinApp bind3              of (true,false,NONE) => Split.splitEinApp bind3
57              (* **************** split phase ************* *)              (* **************** split phase ************* *)
58              | (true,false,SOME limit) =>let              | (true,false,SOME limit) =>let
59                  val _ =print (String.concat["\nSPLit with limit",Int.toString(limit)])                  val _ = (String.concat["\nSPLit with limit",Int.toString(limit)])
60                  in Split.limitSplit(bind3,limit) end                  in Split.limitSplit(bind3,limit) end
61              | (true,true,SOME limit) =>  let              | (true,true,SOME limit) =>  let
62                  (* **************** lift and split Limit ************* *)                  (* **************** lift and split Limit ************* *)
63                  val (einapp1,e2)=L.testLift  bind3                  val (einapp1,e2a,fieldset)=L.testLift  bind3
64                  val _ =print (String.concat["\nSPLit with limit",Int.toString(limit),"\n **** lift Length:",Int.toString(length(e2))])                  val _ = (String.concat["\nSPLit with limit",Int.toString(limit),"\n **** lift Length:",Int.toString(length(e2a))])
65                  val newbies4=Split.limitSplit(einapp1,limit)  
66                   (* val t2=List.map (fn t=>Split.splitEinApp t) e2*)
67                    val t2=List.map (fn t =>Split.limitSplit2(t,limit,fieldset)) e2a
68                    val e2= List.foldr op@ [] t2
69                    val newbies4=Split.limitSplit2(einapp1,limit,fieldset)
70                    val _ = print(String.concat["\n split made pieces(",Int.toString(length(e2)-length(e2a)),") orig (", Int.toString(length(newbies4)),")"])
71                  in (e2@newbies4) end                  in (e2@newbies4) end
72              | (true,true, NONE) => let              | (true,true, NONE) => let
73                  (* **************** lift and split All ************* *)                  (* **************** lift and split All ************* *)
74                  val (einapp1,e2)=L.testLift  bind3                  val (einapp1,e2a,_)=L.testLift  bind3
75                  val _ =  testp["\n **** lift Length"^(Int.toString(length(e2)))]                  val _ =  print(String.concat["\n **** lift Length"^(Int.toString(length(e2a)))])
76                    val e2= List.foldr op@ [] (List.map (fn t=>Split.splitEinApp t) e2a)
77                  val newbies4=Split.splitEinApp einapp1                  val newbies4=Split.splitEinApp einapp1
78                    val _ = print(String.concat["\n split made pieces(",Int.toString(length(e2)-length(e2a)),") orig (", Int.toString(length(newbies4)),")"])
79                  in (e2@newbies4) end                  in (e2@newbies4) end
80    
81    (*
82              | (false,true,_) => let              | (false,true,_) => let
83                  val (einapp1,e2)=L.testLift  bind3                  val (einapp1,e2)=L.testLift  bind3
84                  val _ =  print("\n **** lift Length"^(Int.toString(length(e2))))                  val _ = ("\n **** lift Length"^(Int.toString(length(e2))))
85                  in (e2@[einapp1]) end                  in (e2@[einapp1]) end
86              |  (false,false,_)=>Split.splitEinApp bind3              |  (false,false,_)=>Split.splitEinApp bind3
87    *)
88          (* end case *))          (* end case *))
89          val _ =print"************** TASH"          val _ = "************** TASH"
90          (**************** printing result ***************)          (**************** printing result ***************)
91          val _ =testp["\n\n Returning \n\n =>",          val _ =testp["\n\n Returning \n\n =>",
92          String.concatWith",\n\t"(List.map toStringBind newbies5)]          String.concatWith",\n\t"(List.map toStringBind newbies5)]
# Line 85  Line 94 
94          val _ = if (n > 10) then print(String.concat["\n **** SPLIT Length",Int.toString(n)]) else print ""          val _ = if (n > 10) then print(String.concat["\n **** SPLIT Length",Int.toString(n)]) else print ""
95           (* ************** ProbeEIN *********** *)           (* ************** ProbeEIN *********** *)
96          (*gives probeEIN the set. Could split into a sepearate step*)          (*gives probeEIN the set. Could split into a sepearate step*)
97          val fieldset= einSet.EinSet.empty          val fieldset= einVarSet.EinVarSet.empty
98            val varset= einVarSet.VarSet.empty
99          val isField = ref 0          val isField = ref 0
100          val isFieldR = ref 0          val isFieldR = ref 0
101          val isReplaced = ref 0          val isReplaced = ref 0
102          fun iter([],_)=[]          fun iter([],_,_)=[]
103           | iter(e1::es,fieldset)= let           | iter(e1::es,fieldset,varset)= let
104              val (e2,fieldset,isFieldt,isReplacedt) = ProbeEin.expandEinOp(e1,fieldset)              val (e2,fieldset,varset,isFieldt,isReplacedt) = ProbeEin.expandEinOp(e1,fieldset,varset)
105              val rtn=[e2]@(iter(es,fieldset))              val rtn=[e2]@(iter(es,fieldset,varset))
106              val isFieldRt=if ((isFieldt+isReplacedt)=2) then 1 else 0              val isFieldRt=if ((isFieldt+isReplacedt)=2) then 1 else 0
107              in (isField:=(!isField)+isFieldt;isReplaced:=(!isReplaced )+isReplacedt;              in (isField:=(!isField)+isFieldt;isReplaced:=(!isReplaced )+isReplacedt;
108              isFieldR:=(!isFieldR)+isFieldRt;rtn)              isFieldR:=(!isFieldR)+isFieldRt;rtn)
109              end              end
110          val code=iter(newbies5, fieldset)          val code=iter(newbies5, fieldset,varset)
111            val flatcode= List.foldr op@ [] code
112    
113          val n= List.length(code)          val n= List.length(code)
114            val m= List.length(flatcode)
115          val _ =testp[HighIL.Var.name srcy ," Pieces",Int.toString (n),"\n"]          val _ =testp[HighIL.Var.name srcy ," Pieces",Int.toString (n),"\n"]
116  (*  
117            val _ = if (n>5)            val _ = if (n>5)
118            then  print(String.concat["\n",star,":Name:",HighIL.Var.name srcy ,            then  print(String.concat["\n",star,":Name:",HighIL.Var.name srcy ,
119              ":VarCount(",Int.toString(useCount srcy),")","Pieces now: ",Int.toString (n),              ":VarCount(",Int.toString(useCount srcy),")","\n\tPieces now: ",Int.toString (n),"flatcode",Int.toString (m),
120              " Fields:",Int.toString(!isField)," isReplaced:",Int.toString(!isReplaced),              " Fields:",Int.toString(!isField)," isReplaced:",Int.toString(!isReplaced),
121              " Replaced_Fields:",Int.toString(!isFieldR)])              " Replaced_Fields:",Int.toString(!isFieldR)])
122              else print ""              else print ""
123  *)  
124              val flatcode= List.foldr op@ [] code              val flatcode= List.foldr op@ [] code
125    
126    

Legend:
Removed from v.3497  
changed lines
  Added in v.3503

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