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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/translate/translate.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/translate/translate.sml

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

revision 3718, Sat Apr 2 17:53:43 2016 UTC revision 3719, Mon Apr 4 16:53:00 2016 UTC
# Line 294  Line 294 
294                  end                  end
295              | S.E_Tensor(args, _) => [IR.ASSGN(lhs, IR.CONS(List.map (lookup env) args, IR.Var.ty lhs))]              | S.E_Tensor(args, _) => [IR.ASSGN(lhs, IR.CONS(List.map (lookup env) args, IR.Var.ty lhs))]
296              | S.E_Seq(args, _) => [IR.ASSGN(lhs, IR.SEQ(List.map (lookup env) args, IR.Var.ty lhs))]              | S.E_Seq(args, _) => [IR.ASSGN(lhs, IR.SEQ(List.map (lookup env) args, IR.Var.ty lhs))]
297    (* FIXME: use Ein operators to implement tensor (and field!) indexing and slicing *)
298              | S.E_Slice(x, indices, ty) => let              | S.E_Slice(x, indices, ty) => let
299                  val x = lookup env x                  val x = lookup env x
300                  val mask = List.map isSome indices                  val mask = List.map isSome indices
# Line 303  Line 304 
304                  in                  in
305                    if List.all (fn b => b) mask                    if List.all (fn b => b) mask
306                      then [IR.ASSGN(lhs, IR.OP(Op.TensorIndex(IR.Var.ty x), x::indices))]                      then [IR.ASSGN(lhs, IR.OP(Op.TensorIndex(IR.Var.ty x), x::indices))]
307                      else [IR.ASSGN(lhs, IR.OP(Op.TensorSlice(IR.Var.ty x, mask), x::indices))]                    else if List.exists (fn b => b) mask
308                        then [IR.ASSGN(lhs, IR.OP(Op.TensorSlice(IR.Var.ty x, mask), x::indices))]
309                        else [IR.ASSGN(lhs, IR.VAR x)] (* all axes *)
310                  end                  end
311              | S.E_Coerce{srcTy, dstTy, x} => (case (srcTy, dstTy)              | S.E_Coerce{srcTy, dstTy, x} => (case (srcTy, dstTy)
312                   of (Ty.T_Int, Ty.T_Tensor _) =>                   of (Ty.T_Int, Ty.T_Tensor _) =>

Legend:
Removed from v.3718  
changed lines
  Added in v.3719

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