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 2604, Fri Apr 25 18:23:44 2014 UTC revision 2605, Wed Apr 30 01:46:09 2014 UTC
# Line 242  Line 242 
242            end            end
243    
244    
245           val testing=0
246    
247         fun printgetRHS x  = (case DstIL.Var.binding x            fun expandEinOp (env, y, e, args) = let
248         of DstIL.VB_RHS(DstIL.OP(rator, args)) => print "Got Dstop"          val einargs=Env.renameList(env, args)
249         | DstIL.VB_RHS(DstIL.VAR x') => printgetRHS x'          val _ =(case testing
250         | DstIL.VB_RHS(DstIL.EINAPP(rator, args)) => print "got ein"              of 0 => 1
251         | DstIL.VB_RHS(DstIL.CONS (ty,args))=>print "cons"              | _  => (print(String.concat(["\n\n new ein \n", DstIL.Var.toString(y),"=",P.printerE(e)]@(List.map (fn e=> (DstIL.Var.toString(e)^",")) einargs)@["\n ** pre gen**"]));1)
        | DstIL.VB_NONE=>print "\nnone"  
             | vb => (print (String.concat["\n -- ", DstIL.Var.toString x,"but found ", DstIL.vbToString vb,"\n"]))  
252              (* end case *))              (* end case *))
253    
254    
   
   
        fun printX(DstIL.ASSGN (x, _))=printgetRHS x  
   
   
           fun expandEinOp (env, y, e, args) = let  
             val einargs=Env.renameList(env, args)  
             val f=print(String.concat(["\n\n new ein \n", DstIL.Var.toString(y),"=",P.printerE(e)]@(List.map (fn e=> (DstIL.Var.toString(e)^",")) einargs)))  
             val _=print "\n ** pre gen**"  
255              val (_,code)=genEin.genfn(y,e,args,einargs)              val (_,code)=genEin.genfn(y,e,args,einargs)
             val _=print "**\n post gen"  
              val _=print(Int.toString(length(code)))  
256              val DstIL.ASSGN (a1,DstIL.OP(opss1,args1))=List.hd(List.rev(code))              val DstIL.ASSGN (a1,DstIL.OP(opss1,args1))=List.hd(List.rev(code))
257              val c=DstIL.ASSGN (y,DstIL.OP(opss1,args1))              val c=DstIL.ASSGN (y,DstIL.OP(opss1,args1))
258            val _ =(case testing
259              val m=print (String.concat(["\n NEW-- ", DstIL.Var.toString y,"===", DstOp.toString opss1,"-"]@(List.map (fn e=> (DstIL.Var.toString(e)^",")) args1)))              of 0 => 1
260                | _  => (print(String.concat(["**\n post gen",Int.toString(length(code)), "\n NEW-- ", DstIL.Var.toString y,"===", DstOp.toString opss1,"-"]@(List.map (fn e=> (DstIL.Var.toString(e)^",")) args1)@ ["\n made it post code"]));1)
261              val g=print "\n made it post code"              (*end case*))
   
262                in code@[c]                in code@[c]
   
263              end              end
264    
265    
266          handle ex => (print(concat["error converting  \n"]); raise ex)          handle ex => (print(concat["error converting  \n"]); raise ex)
267    
268    
   
269    (* expand a SrcIL assignment to a DstIL CFG *)    (* expand a SrcIL assignment to a DstIL CFG *)
270      fun expand (env, (y, rhs)) = let      fun expand (env, (y, rhs)) = let
271            val y' = Env.rename (env, y)            val y' = Env.rename (env, y)
# Line 294  Line 279 
279            | SrcIL.OP(rator, args) => (List.map DstIL.ASSGN (expandOp (env, y', rator, args)))            | SrcIL.OP(rator, args) => (List.map DstIL.ASSGN (expandOp (env, y', rator, args)))
280                | SrcIL.APPLY(f, args) => assign (DstIL.APPLY(f, Env.renameList(env, args)))                | SrcIL.APPLY(f, args) => assign (DstIL.APPLY(f, Env.renameList(env, args)))
281                | SrcIL.CONS(ty, args) => assign (DstIL.CONS(ty, Env.renameList(env, args)))                | SrcIL.CONS(ty, args) => assign (DstIL.CONS(ty, Env.renameList(env, args)))
282            | SrcIL.EINAPP(rator, args) => (*(print "\n Got one";List.map DstIL.ASSGN (expandEinOp (env, Env.rename (env, y), rator, args)))*)            | SrcIL.EINAPP(rator, args) => let
283         (print "\n ------------------------last name";print(SrcIL.Var.toString(y));print "---";expandEinOp (env, Env.rename (env, y), rator, args))               val _  = (case testing
284                    of 0  => 1
285                    | _  => (print(String.concat["\n ------------------------last name",SrcIL.Var.toString(y)]);1)
286                    (*end case *))
287                in
288                    expandEinOp (env, Env.rename (env, y), rator, args)
289                end
290                   (* end case *)                   (* end case *)
291          end          end
292    

Legend:
Removed from v.2604  
changed lines
  Added in v.2605

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