Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/mid-to-low/mid-to-low.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/mid-to-low/mid-to-low.sml

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

revision 3188, Tue Mar 31 21:10:27 2015 UTC revision 3189, Thu Apr 2 18:49:21 2015 UTC
# Line 25  Line 25 
25      structure EtLow = EinToLow      structure EtLow = EinToLow
26      structure LowToS = LowToString      structure LowToS = LowToString
27    
28      val testing=0      val testing=1
29    (* instantiate the translation environment *)    (* instantiate the translation environment *)
30      local      local
31        type var_env = DstIL.var VTbl.hash_table        type var_env = DstIL.var VTbl.hash_table
# Line 128  Line 128 
128          (*val _=checkEin.checkEIN e*)          (*val _=checkEin.checkEIN e*)
129          val code=EtLow.scan(y,e,einargs)          val code=EtLow.scan(y,e,einargs)
130    
131    
132            val tbl0= lowSet.LowSet.empty
133                fun getSet([],done,_,cnt)=(done,cnt)
134                | getSet( DstIL.ASSGN(lhs,rhs)::es,done,opset,cnt)=let
135                    val (opset,var) = lowSet.filter(opset,(lhs,rhs))
136                    in  (case var
137                        of NONE => getSet(es,done@[DstIL.ASSGN(lhs,rhs)], opset,cnt)
138                        | SOME v=> getSet(es,done@[DstIL.ASSGN(lhs,DstIL.VAR v)], opset,cnt+1)
139                    (*end case*))
140                    end
141                | getSet (e1::es, done, opset,cnt)=getSet(es,done@[e1],opset,cnt)
142    (*
143            val _ =print(String.concat["\n previous",Int.toString(length(code))])
144            val (code,cnt)=getSet(code, [],tbl0,0)
145            val _ =print(String.concat["replaced", Int.toString cnt])
146    *)
147          in          in
148              code              code
149          end          end

Legend:
Removed from v.3188  
changed lines
  Added in v.3189

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