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

SCM Repository

[diderot] View of /branches/charisee_dev/src/compiler/high-il/handleEin-high.sml
ViewVC logotype

View of /branches/charisee_dev/src/compiler/high-il/handleEin-high.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3415 - (download) (annotate)
Thu Nov 12 20:59:23 2015 UTC (3 years, 10 months ago) by cchiw
File size: 2175 byte(s)
lift in high-il
(* Expands probe ein
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * All rights reserved.
 *)

structure handleEinHigh = struct

    local
   
    structure E = Ein
    structure DstIL = HighIL
    structure P=Printer
    structure V = DstIL.Var
    structure L=LiftEinHigh
    in

    val testing=0
    fun testp e=(case testing
        of 1=> print(String.concat e)
        | _ => print""
        (*end case*))


    fun useCount (HighIL.V{useCnt, ...}) = !useCnt
    fun expandEinOp bind00 =let
        val _=print"stop using dev branch =D"
        val (y,einapp as DstIL.EINAPP(ein1,args))=bind00
        val _=testp["\n Ein --",P.printbody(Ein.body ein1)]


        (* ************** distribute and push Summation*********** *)
        val bind3 = (y,DstIL.EINAPP(SummationEin.main ein1,args))

        val (y,einapp as DstIL.EINAPP(ein2,args))=bind3
        val _=testp["\n PostSummation --",P.printbody(Ein.body ein2)]


        (* **************** lift no split ************* *)

        val (einapp1,e2)=L.testLift  bind3
        val newbies5=e2@[einapp1]
(*

        (* **************** split phase ************* *)
        val newbies5= SplitHigh.splitEinApp bind3
        val n =length(newbies5)
*)
           (* **************** split nothing ************* *)
(*
        val newbies5= [bind3]
*)
       fun einchange(e,params') =Ein.EIN{params=params', index=E.index e, body=E.body e}
       fun f e = let
            val p= List.map (fn E.TEN(_,alpha) => E.TEN(0,alpha) | e1 => e1) (E.params e)
            in
                einchange(e,p)
            end
       val newbies5 = List.map (fn (lhs,DstIL.EINAPP(ein2,args))=>(lhs,DstIL.EINAPP(f ein2,args))) newbies5

        val n =length(newbies5)
        val codestr=List.map (fn (lhs,DstIL.EINAPP(ein2,_))=> String.concat[V.toString lhs," = ",P.printbody(Ein.body ein2)]) newbies5
        val _ = (case n
            of 1=> print""
            |_ => print (String.concat["Newbies:", String.concatWith",\n"  codestr] )
            (*end case*))
        in newbies5
        end


  end; (* local *)

end (* local *)

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