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 3503, Thu Dec 17 23:13:57 2015 UTC revision 3540, Mon Jan 4 18:03:22 2016 UTC
# Line 67  Line 67 
67                  val t2=List.map (fn t =>Split.limitSplit2(t,limit,fieldset)) e2a                  val t2=List.map (fn t =>Split.limitSplit2(t,limit,fieldset)) e2a
68                  val e2= List.foldr op@ [] t2                  val e2= List.foldr op@ [] t2
69                  val newbies4=Split.limitSplit2(einapp1,limit,fieldset)                  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)),")"])                  val _ = testp["\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,e2a,_)=L.testLift  bind3                  val (einapp1,e2a,_)=L.testLift  bind3
75                  val _ =  print(String.concat["\n **** lift Length"^(Int.toString(length(e2a)))])                  val _ =  testp["\n **** lift Length"^(Int.toString(length(e2a)))]
76                  val e2= List.foldr op@ [] (List.map (fn t=>Split.splitEinApp t) e2a)                  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)),")"])                  val _ = testp["\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  (*  (*
# Line 91  Line 91 
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)]
93          val n =length(newbies5)          val n =length(newbies5)
94          val _ = if (n > 10) then print(String.concat["\n **** SPLIT Length",Int.toString(n)]) else print ""          val _ = if (n > 10) then testp["\n **** SPLIT Length",Int.toString(n)] else 1
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= einVarSet.EinVarSet.empty          val fieldset= einVarSet.EinVarSet.empty
# Line 112  Line 112 
112    
113          val n= List.length(code)          val n= List.length(code)
114          val m= List.length(flatcode)          val m= List.length(flatcode)
115          val _ =testp[HighIL.Var.name srcy ," Pieces",Int.toString (n),"\n"]          val _ =(String.concat["\n",HighIL.Var.name srcy ," Pieces",Int.toString (m),"\n"])
116    
117            val _ = if (n>5)            val _ = if (n>5)
118            then  print(String.concat["\n",star,":Name:",HighIL.Var.name srcy ,            then  testp["\n",star,":Name:",HighIL.Var.name srcy ,
119              ":VarCount(",Int.toString(useCount srcy),")","\n\tPieces now: ",Int.toString (n),"flatcode",Int.toString (m),              ":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)] else 1
             else print ""  
   
             val flatcode= List.foldr op@ [] code  
122    
123    
124          (*val _=List.map (fn(_,DstIL.EINAPP(e,_))=>checkEin.checkEIN e | _=> 1) flatcode*)          val flatcode= List.foldr op@ [] code
125          val _=(star^"end")  (*
126            val tbl0= einSet.EinSet.empty
127            fun getSet([],done,_,cnt)=(done,cnt)
128             | getSet((lhs,rhs)::es,done,opset,cnt)=let
129                    val (opset,var) = einSet.rtnVarN(opset,(lhs,rhs))
130                    in  (case var
131                        of NONE => getSet(es,done@[(lhs,rhs)], opset,cnt)
132                        | SOME v=> (("replacing"^DstIL.Var.toString(lhs));getSet(es,done@[(lhs,DstIL.VAR v)], opset,cnt+1))
133                        (*end case*))
134                    end
135            val _="creating set"
136            val (flatcode,cnt)=getSet(flatcode, [],tbl0,0)
137            val _ = " post creating set"
138            val n=length(flatcode)
139            val _ = (String.concat["\n Length: ",Int.toString n," Replaced: ", Int.toString cnt,"\n"])
140    *)
141          in          in
142              List.map (fn (y,rator)=> DstIL.ASSGN(y,rator)) flatcode              List.map (fn (y,rator)=> DstIL.ASSGN(y,rator)) flatcode
143          end          end

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

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