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

SCM Repository

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

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

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

revision 3997, Sun Jun 19 15:55:49 2016 UTC revision 3998, Sun Jun 19 17:12:03 2016 UTC
# Line 203  Line 203 
203                  fun cvt NONE = NONE                  fun cvt NONE = NONE
204                    | cvt (SOME x) = SOME(lookup env x)                    | cvt (SOME x) = SOME(lookup env x)
205                  val indices = List.mapPartial cvt indices                  val indices = List.mapPartial cvt indices
206                  in                  val sliceop = Op.Slice(IL.Var.ty x, mask)
207                    val sliceargs = x::indices
208                    fun iterArgs [] = []
209                      | iterArgs(e1::es) = let
210                        val IL.VB_RHS(IL.LIT(Literal.Int i)) = IL.Var.binding e1
211                        in (IntInf.toInt i)::iterArgs es end
212                    val const = iterArgs (List.drop(sliceargs,1))
213                    val rator = (case (IL.Var.ty lhs,IL.Var.ty x,ty)
214                        of (DstTy.TensorTy rstTy, DstTy.TensorTy argTy, _) => MkOperators.sliceT (mask, const, rstTy, argTy)
215                        | (_, _, Ty.T_Field{diff, dim, shape}) => MkOperators.sliceF(mask, const, shape, dim)
216                        (*end case*))            in
217                    if List.all (fn b => b) mask                    if List.all (fn b => b) mask
218                      then [IL.ASSGN(lhs, IL.OP(Op.TensorSub(IL.Var.ty x), x::indices))]                      then [IL.ASSGN(lhs, IL.OP(Op.TensorSub(IL.Var.ty x), x::indices))]
219                      else [IL.ASSGN(lhs, IL.OP(Op.Slice(IL.Var.ty x, mask), x::indices))]                      else  [IL.ASSGN(lhs,IL.EINAPP(rator, [x]))]
220                  end                  end
221              | S.E_Coerce{srcTy, dstTy, x} => (case (srcTy, dstTy)              | S.E_Coerce{srcTy, dstTy, x} => (case (srcTy, dstTy)
222                   of (Ty.T_Int, Ty.T_Tensor _) =>                   of (Ty.T_Int, Ty.T_Tensor _) =>

Legend:
Removed from v.3997  
changed lines
  Added in v.3998

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