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

SCM Repository

[diderot] Diff of /trunk/src/compiler/high-to-mid/high-to-mid.sml
ViewVC logotype

Diff of /trunk/src/compiler/high-to-mid/high-to-mid.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2355, Sun Apr 7 11:35:08 2013 UTC revision 2356, Sun Apr 7 14:45:25 2013 UTC
# Line 226  Line 226 
226                | SrcOp.MulMatVec(SrcTy.TensorTy[d1, d2]) => assign (DstOp.MulMatVec(d1, d2))                | SrcOp.MulMatVec(SrcTy.TensorTy[d1, d2]) => assign (DstOp.MulMatVec(d1, d2))
227                | SrcOp.MulMatMat(SrcTy.TensorTy[d1, d2], SrcTy.TensorTy[d2', d3]) =>                | SrcOp.MulMatMat(SrcTy.TensorTy[d1, d2], SrcTy.TensorTy[d2', d3]) =>
228                    assign (DstOp.MulMatMat(d1, d2, d3))                    assign (DstOp.MulMatMat(d1, d2, d3))
229                  | SrcOp.MulVecTen3(SrcTy.TensorTy[d1, d2, d3]) => assign(DstOp.MulVecTen3(d1, d2, d3))
230                  | SrcOp.MulTen3Vec(SrcTy.TensorTy[d1, d2, d3]) => assign(DstOp.MulTen3Vec(d1, d2, d3))
231                  | SrcOp.ColonMul(ty1, ty2) => assign(DstOp.ColonMul(cvtTy ty1, cvtTy ty2))
232                | SrcOp.Cross => assign DstOp.Cross                | SrcOp.Cross => assign DstOp.Cross
233                | SrcOp.Outer(SrcTy.TensorTy[d1, d2]) => let                | SrcOp.Outer(SrcTy.TensorTy[d1, d2]) => let
234                    val [v1, v2] = Env.renameList(env, args)                    val [v1, v2] = Env.renameList(env, args)
# Line 239  Line 242 
242                | SrcOp.Identity n => assign (DstOp.Identity n)                | SrcOp.Identity n => assign (DstOp.Identity n)
243                | SrcOp.Zero ty => assign (DstOp.Zero(cvtTy ty))                | SrcOp.Zero ty => assign (DstOp.Zero(cvtTy ty))
244                | SrcOp.Trace(SrcTy.TensorTy[d, _]) => assign (DstOp.Trace d)                | SrcOp.Trace(SrcTy.TensorTy[d, _]) => assign (DstOp.Trace d)
245                  | SrcOp.Transpose(d1, d2) => assign (DstOp.Transpose(d1, d2))
246                | SrcOp.Slice(ty, mask) => raise Fail "FIXME: Slice"                | SrcOp.Slice(ty, mask) => raise Fail "FIXME: Slice"
247                | SrcOp.TensorSub(ty as SrcTy.TensorTy _) => assign (DstOp.Subscript(cvtTy ty))                | SrcOp.TensorSub(ty as SrcTy.TensorTy _) => assign (DstOp.Subscript(cvtTy ty))
248                | SrcOp.Select(ty as SrcTy.TupleTy _, i) => assign (DstOp.Select(cvtTy ty, i))                | SrcOp.Select(ty as SrcTy.TupleTy _, i) => assign (DstOp.Select(cvtTy ty, i))
# Line 270  Line 274 
274                | rator => raise Fail("bogus operator " ^ SrcOp.toString rator)                | rator => raise Fail("bogus operator " ^ SrcOp.toString rator)
275              (* end case *)              (* end case *)
276            end            end
277    handle ex => (print(concat["error converting ", SrcOp.toString rator, "\n"]); raise ex)
278    
279    (* expand a SrcIL assignment to a list of DstIL assignments *)    (* expand a SrcIL assignment to a list of DstIL assignments *)
280      fun expand (env, (y, rhs)) = let      fun expand (env, (y, rhs)) = let
# Line 279  Line 284 
284               of SrcIL.STATE x => assign (DstIL.STATE(Env.renameSV(env, x)))               of SrcIL.STATE x => assign (DstIL.STATE(Env.renameSV(env, x)))
285                | SrcIL.VAR x => assign (DstIL.VAR(Env.rename(env, x)))                | SrcIL.VAR x => assign (DstIL.VAR(Env.rename(env, x)))
286                | SrcIL.LIT lit => assign (DstIL.LIT lit)                | SrcIL.LIT lit => assign (DstIL.LIT lit)
               | SrcIL.OP(SrcOp.Field _, args) => []  
287                | SrcIL.OP(rator, args) =>                | SrcIL.OP(rator, args) =>
288                    List.map DstIL.ASSGN (expandOp (env, Env.rename (env, y), rator, args))                    List.map DstIL.ASSGN (expandOp (env, Env.rename (env, y), rator, args))
289                | SrcIL.APPLY(f, args) => assign(DstIL.APPLY(f, Env.renameList(env, args)))                | SrcIL.APPLY(f, args) => assign(DstIL.APPLY(f, Env.renameList(env, args)))

Legend:
Removed from v.2355  
changed lines
  Added in v.2356

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