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

SCM Repository

[diderot] View of /branches/vis15/src/compiler/high-to-mid/handle-ein.sml
ViewVC logotype

View of /branches/vis15/src/compiler/high-to-mid/handle-ein.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3777 - (download) (annotate)
Tue Apr 26 22:49:35 2016 UTC (3 years, 8 months ago) by cchiw
File size: 1889 byte(s)
 created mkLdVoxel
(* handle-ein.sml
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2016 The University of Chicago
 * All rights reserved.
 *)

structure HandleEin : sig

    val expand : MidIR.var * Ein.ein * MidIR.var list -> MidIR.assignment list

  end = struct
   
    structure E = Ein
    structure SrcIR = HighIR
    structure DstIR = MidIR

    fun useCount (SrcIR.V{useCnt, ...}) = !useCnt

    fun expand (lhs, ein, args) = let
        (* ************** distribute and push Summation*********** *)
          val ein' = EinSums.transform ein
        (* **************** split phase ************* *)
          val newbies5 = FloatEin.transform (lhs, ein', args)
        (* ************** ProbeEIN *********** *)
          val avail = AvailRHS.new()
            fun n (y, DstIR.OP(_, args)) =  print(String.concat["\nvar: ", MidIR.Var.name(y), " =  OP(_, ",
                String.concatWith","(List.map (fn e=> MidIR.Var.name e) args), ")"])
            | n (y, DstIR.EINAPP(ein, args)) =  print(String.concat["\nvar: ", MidIR.Var.name(y), " = EINAPP(",EinPP.toString(ein),", ",
                String.concatWith","(List.map (fn e=> MidIR.Var.name e) args), ")"])
            | n (y, DstIR.CONS(args, _)) =  print(String.concat["\nvar: ", MidIR.Var.name(y), " = CONS(_,",
                    String.concatWith","(List.map (fn e=> MidIR.Var.name e) args), ")"])
            |  n ((y,_)) =  print(String.concat["\nvar: ", MidIR.Var.name y])
          fun iter(str, es)  = (print str ; List.map n es)
          (*val _ = iter("\n\n \t New EIN op \n Pieces after splitting ", newbies5)*)
          val _ = List.app (ProbeEin.expand avail) (newbies5);
          val stmts = List.rev (AvailRHS.getAssignments avail)
          val _ = iter("\nfinal stmts", stmts);
        in List.map (fn i=> DstIR.ASSGN i) stmts
	  end

  end (* HandleEin *)

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