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

SCM Repository

[diderot] Diff of /branches/staging/src/compiler/cl-target/tree-to-cl.sml
ViewVC logotype

Diff of /branches/staging/src/compiler/cl-target/tree-to-cl.sml

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

revision 2745, Sun Sep 28 12:50:50 2014 UTC revision 2746, Wed Oct 1 21:08:30 2014 UTC
# Line 97  Line 97 
97    (* translate a variable use *)    (* translate a variable use *)
98      fun trVar (env, x) = (case V.kind x      fun trVar (env, x) = (case V.kind x
99             of IL.VK_Local => CL.mkVar(lookup(env, x))             of IL.VK_Local => CL.mkVar(lookup(env, x))
100              | _ => CL.mkIndirect(CL.E_Var RN.globalsVarName, lookup(env, x))              | _ => CL.mkIndirect(CL.mkVar RN.globalsVarName, lookup(env, x))
101            (* end case *))            (* end case *))
102    
103    (* matrix indexing *)    (* matrix indexing *)
# Line 136  Line 136 
136                      "lerp<", Ty.toString ty, "> not supported"                      "lerp<", Ty.toString ty, "> not supported"
137                        ])                        ])
138                  (* end case *))                  (* end case *))
139              | (Op.Dot d, args) => CL.E_Apply(RN.dot, args)              | (Op.Dot d, args) => CL.mkApply(RN.dot, args)
140              | (Op.MulVecMat(m, n), args) =>              | (Op.MulVecMat(m, n), args) =>
141                  if (1 < m) andalso (m < 4) andalso (m = n)                  if (1 < m) andalso (m < 4) andalso (m = n)
142                    then CL.E_Apply(RN.mulVecMat(m,n), args)                    then CL.mkApply(RN.mulVecMat(m,n), args)
143                    else raise Fail "unsupported vector-matrix multiply"                    else raise Fail "unsupported vector-matrix multiply"
144              | (Op.MulMatVec(m, n), args) =>              | (Op.MulMatVec(m, n), args) =>
145                  if (1 < m) andalso (m < 4) andalso (m = n)                  if (1 < m) andalso (m < 4) andalso (m = n)
146                    then CL.E_Apply(RN.mulMatVec(m,n), args)                    then CL.mkApply(RN.mulMatVec(m,n), args)
147                    else raise Fail "unsupported matrix-vector multiply"                    else raise Fail "unsupported matrix-vector multiply"
148              | (Op.MulMatMat(m, n, p), args) =>              | (Op.MulMatMat(m, n, p), args) =>
149                  if (1 < m) andalso (m < 4) andalso (m = n) andalso (n = p)                  if (1 < m) andalso (m < 4) andalso (m = n) andalso (n = p)
150                    then CL.E_Apply(RN.mulMatMat(m,n,p), args)                    then CL.mkApply(RN.mulMatMat(m,n,p), args)
151                    else raise Fail "unsupported matrix-matrix multiply"                    else raise Fail "unsupported matrix-matrix multiply"
152              | (Op.Cross, args) => CL.E_Apply(RN.cross, args)              | (Op.Cross, args) => CL.mkApply(RN.cross, args)
153              | (Op.Norm(Ty.TensorTy[n]), args) => CL.E_Apply(RN.length, args)              | (Op.Norm(Ty.TensorTy[n]), args) => CL.mkApply(RN.length, args)
154              | (Op.Norm(Ty.TensorTy[m,n]), args) => CL.E_Apply(RN.norm(m,n), args)              | (Op.Norm(Ty.TensorTy[m,n]), args) => CL.mkApply(RN.norm(m,n), args)
155              | (Op.Normalize d, args) => CL.E_Apply(RN.normalize, args)              | (Op.Normalize d, args) => CL.mkApply(RN.normalize, args)
156              | (Op.Scale(Ty.TensorTy[n]), [s, v]) => CL.mkBinOp(s, CL.#*, v)              | (Op.Scale(Ty.TensorTy[n]), [s, v]) => CL.mkBinOp(s, CL.#*, v)
157              | (Op.PrincipleEvec ty, _) => raise Fail "PrincipleEvec unimplemented"              | (Op.PrincipleEvec ty, _) => raise Fail "PrincipleEvec unimplemented"
158              | (Op.Select(Ty.TupleTy tys, i), [a]) => raise Fail "Select unimplemented"              | (Op.Select(Ty.TupleTy tys, i), [a]) => raise Fail "Select unimplemented"
# Line 199  Line 199 
199                  end                  end
200              | (Op.LoadVoxels(info, 1), [a]) => let              | (Op.LoadVoxels(info, 1), [a]) => let
201                  val realTy as CL.T_Num rTy = !RN.gRealTy                  val realTy as CL.T_Num rTy = !RN.gRealTy
202                  val a = CL.E_UnOp(CL.%*, a)                  val a = CL.mkUnOp(CL.%*, a)
203                  in                  in
204                    if (rTy = ImageInfo.sampleTy info)                    if (rTy = ImageInfo.sampleTy info)
205                      then a                      then a
206                      else CL.E_Cast(realTy, a)                      else CL.mkCast(realTy, a)
207                  end                  end
208              | (Op.LoadVoxels _, [a]) =>              | (Op.LoadVoxels _, [a]) =>
209                  raise Fail("impossible " ^ Op.toString rator)                  raise Fail("impossible " ^ Op.toString rator)

Legend:
Removed from v.2745  
changed lines
  Added in v.2746

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