Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/high-opt/eps-util.sml
 [diderot] / branches / vis15 / src / compiler / high-opt / eps-util.sml

# Diff of /branches/vis15/src/compiler/high-opt/eps-util.sml

revision 4137, Fri Jul 1 14:43:45 2016 UTC revision 4138, Fri Jul 1 14:46:08 2016 UTC
# Line 27  Line 27
27
28    (* check to see if a pair of Epsilon expressions can be converted to deltas *)    (* check to see if a pair of Epsilon expressions can be converted to deltas *)
29      fun doubleEps (E.Epsilon(a,b,c), E.Epsilon(d,e,f)) = let      fun doubleEps (E.Epsilon(a,b,c), E.Epsilon(d,e,f)) = let
30
31            fun createDeltas (s, t, u, v) =            fun createDeltas (s, t, u, v) =
32  (* FIXME: what does the following comment mean? *)  (* FIXME: what does the following comment mean? *)
33              (*If multiple summation ids are the same, it might not remove from the summation queue*)              (*If multiple summation ids are the same, it might not remove from the summation queue*)
# Line 88  Line 89
89              distEps (epsAll, [])              distEps (epsAll, [])
90            end            end
91

92      (*epsToDels:ein_exp list      (*epsToDels:ein_exp list
93          -> int*ein_exp * sum_index_id*ein_exp list *ein_exp list          -> int*ein_exp * sum_index_id*ein_exp list *ein_exp list
94      *Looks at ein_exp list and searches for epsilons      *Looks at ein_exp list and searches for epsilons
# Line 101  Line 101
101              case distributeEps(epsAll, sumexp)              case distributeEps(epsAll, sumexp)
102               of NONE => (false, E.Const 0, [], epsAll, rest@sumexp)               of NONE => (false, E.Const 0, [], epsAll, rest@sumexp)
103                | SOME(epsUnused, d1, d2, sx, ps) => let                | SOME(epsUnused, d1, d2, sx, ps) => let
104                    val a = E.Opn(E.Prod, epsUnused@d1@rest@ps)                    (*d1, d2 are rewritten delta expressions*)
105                    val b = E.Opn(E.Prod, epsUnused@d2@rest@ps)                    (* in some cases there are embedded expressions of the form E.Sum(sx, ...ps)*)
106                      (* sx does not apply to the rest of the expression ("rest")*)
107                      (* return expression in pieces in order to preserve structure*)
108                      val a = E.Opn(E.Prod, epsUnused@d1@ps)
109                      val b = E.Opn(E.Prod, epsUnused@d2@ps)
110                    in                    in
111                      (true, E.Op2(E.Sub, a, b), sx, [], [])                      (true, E.Op2(E.Sub, a, b), sx, [], rest)
112                    end                    end
113              (*end case *)              (*end case *)
114            end            end
# Line 130  Line 134
134
135  (* FIXME: instead of appending singletons, build results in reverse order! *)  (* FIXME: instead of appending singletons, build results in reverse order! *)
136            fun distribute (changed, [], rest, mu) = (changed, E.Opn(E.Prod, eps@mu@rest))            fun distribute (changed, [], rest, mu) = (changed, E.Opn(E.Prod, eps@mu@rest))
137              | distribute (changed, p1::ps, rest, mu) = (case p1              | distribute (changed, p1::ps, rest, mu) = case p1
138                   of E.Tensor(id, alpha) => let                   of E.Tensor(id, alpha) => let
139                        val (changed, alpha_betas, nu) = appDel(changed, alpha, [], mu, [])                        val (changed, alpha_betas, nu) = appDel(changed, alpha, [], mu, [])
140                        in                        in

Legend:
 Removed from v.4137 changed lines Added in v.4138