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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3190 - (download) (annotate)
Sat Apr 4 00:18:24 2015 UTC (4 years, 10 months ago) by cchiw
File size: 2195 byte(s)
attempt at evecs 3x3
(* Expands probe ein
 *
 * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *)

structure lowSet = struct

    local
   

    structure DstIL =LowIL
    structure DstOp = LowOps
    structure DstV  = DstIL.Var

    in

(*
 previous2654replaced47
 previous71198replaced1295
 previous23396replaced431

 previous2654replaced606
 previous7880replaced1818
 previous23396replaced5416
 
  count
  previous
 2654,7880,71198,23396,635198
 3*3*3*3*3*6*6*6
 3^5 * 6^3
 tensor[3,3]-sumprod_l_6_7235D78=-EIN-0:IMG(3)< 3>, 1:KRN 2:TEN <>, 3:TEN <3>, 4:TEN <3>, 5:TEN <3,3>,  < Σ_2[0-2],3[0-2]⋐(ϵ_023*  Σ_4[0-2],5[0-2]⋐( Σ_6[~2-3],7[~2-3],8[~2-3]⋐( V0_3[( T3_'0'+_6_),( T3_'1'+_7_),( T3_'2'+_8_)]*  H1^{δ_('0',4)δ_('0',5)} [( T4_'0'---- _6_]*  H1^{δ_('1',4)δ_('1',5)} [( T4_'1'---- _7_]*  H1^{δ_('2',4)δ_('2',5)} [( T4_'2'---- _8_])⋑*  T5_2,4*  T5_1,5)⋑)⋑> _{(0 DIM:3)(1 DIM:3)} _t14C0,_t14BE,x1881,n18CA,f18C6,P18A8,
    previous635198
    
*)

    fun hash (_,DstIL.OP(op1,_))=DstOp.hash op1
    | hash(_,DstIL.LIT m)=Literal.hash m


   fun cmp(e1,e2)=Word.compare(hash e1, hash e2)


   structure OprKey =
        struct
        type ord_key =DstIL.var*LowIL.rhs
        val compare = cmp
    end;
    structure  LowSet= RedBlackSetFn(OprKey);



    fun allEq([], []) = true
      | allEq(x::xs, y::ys) = DstIL.Var.same(x,y) andalso allEq (xs,ys)
      | allEq _ = false

    fun setFind (tbl,DstIL.OP(op0,arg0))= (
        LowSet.find(
            (fn (_,DstIL.OP(op1,arg1))=>(DstOp.same(op0,op1) andalso allEq(arg0,arg1)) | _ => false)
        )) tbl
    | setFind (tbl,DstIL.LIT n)= (
        LowSet.find(
            (fn (_,DstIL.LIT m)=> Literal.same(n,m)
            | _ => false))) tbl
    | setFind (tbl, e)= NONE 

    fun rtnVar (tbl,(lhs,rhs))=(case setFind(tbl,rhs)
        of NONE     => (LowSet.add(tbl,(lhs,rhs)), NONE)
        | SOME(v1,e1) =>(tbl,SOME v1)
        (*end case*))

    fun filter(tbl,(lhs,rhs))=(case rhs
        of DstIL.OP _ => rtnVar(tbl,(lhs,rhs))
        | DstIL.LIT _ => rtnVar(tbl,(lhs,rhs))
        | _ =>          (tbl, NONE)
        (*end case*))


  end; (* local *)

end (* local *)

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