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

SCM Repository

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

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

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

revision 1397, Mon Jun 27 16:04:43 2011 UTC revision 1398, Wed Jun 29 17:20:05 2011 UTC
# Line 55  Line 55 
55              | Ty.TensorTy[] => !RN.gRealTy              | Ty.TensorTy[] => !RN.gRealTy
56              | Ty.TensorTy[n] => CL.T_Named(RN.vecTy n)              | Ty.TensorTy[n] => CL.T_Named(RN.vecTy n)
57              | Ty.TensorTy[n, m] => CL.T_Named(RN.matTy(n,m))              | Ty.TensorTy[n, m] => CL.T_Named(RN.matTy(n,m))
58              | Ty.AddrTy(ImageInfo.ImgInfo{ty=(_, rTy), ...}) => CL.T_Ptr(CL.T_Num rTy)              | Ty.AddrTy(ImageInfo.ImgInfo{ty=(_, rTy), ...}) => CL.T_Attr("__global",CL.T_Ptr(CL.T_Num rTy))
59  (* FIXME: concatenating "__global" is a hack.  Figure out a better way *)              | Ty.ImageTy(ImageInfo.ImgInfo{dim, ...}) => CL.T_Named(RN.imageTy dim)
             | Ty.ImageTy(ImageInfo.ImgInfo{dim, ...}) => CL.T_Ptr(CL.T_Named("__global " ^ RN.imageTy dim))  
60              | _ => raise Fail(concat["TreeToC.trType(", Ty.toString ty, ")"])              | _ => raise Fail(concat["TreeToC.trType(", Ty.toString ty, ")"])
61            (* end case *))            (* end case *))
62    
# Line 195  Line 194 
194              | (Op.RealToInt d, args) =>              | (Op.RealToInt d, args) =>
195                  CL.mkApply(RN.vecftoi d, args)                  CL.mkApply(RN.vecftoi d, args)
196  (* FIXME: need type info *)  (* FIXME: need type info *)
197              | (Op.ImageAddress(ImageInfo.ImgInfo{ty=(_,rTy), ...}), [a]) => let              | (Op.ImageAddress(ImageInfo.ImgInfo{ty=(_,rTy), ...}), [a as CL.E_Indirect(_,field)]) => let
198                  val cTy = CL.T_Ptr(CL.T_Num rTy)                  val cTy = CL.T_Attr("__global",CL.T_Ptr(CL.T_Num rTy))
199                  in                  in
200                    CL.mkCast(cTy, CL.mkIndirect(a, "data"))                    CL.mkCast(cTy, CL.mkSelect(CL.mkVar(RN.globalImageDataName), RN.imageDataName(field)))
201                  end                  end
202              | (Op.LoadVoxels(info, 1), [a]) => let              | (Op.LoadVoxels(info, 1), [a]) => let
203                  val realTy as CL.T_Num rTy = !RN.gRealTy                  val realTy as CL.T_Num rTy = !RN.gRealTy
# Line 211  Line 210 
210              | (Op.LoadVoxels _, [a]) =>              | (Op.LoadVoxels _, [a]) =>
211                  raise Fail("impossible " ^ Op.toString rator)                  raise Fail("impossible " ^ Op.toString rator)
212              | (Op.PosToImgSpace(ImageInfo.ImgInfo{dim, ...}), [img, pos]) =>              | (Op.PosToImgSpace(ImageInfo.ImgInfo{dim, ...}), [img, pos]) =>
213                  CL.mkApply(RN.toImageSpace dim, [img, pos])                  CL.mkApply(RN.toImageSpace dim, [CL.mkUnOp(CL.%&,img), pos])
214              | (Op.TensorToWorldSpace(info, ty), [v, x]) =>              | (Op.TensorToWorldSpace(info, ty), [v, x]) =>
215                  CL.mkApply(RN.toWorldSpace ty, [v, x])                  CL.mkApply(RN.toWorldSpace ty, [v, x])
216              | (Op.LoadImage info, [a]) =>              | (Op.LoadImage info, [a]) =>
217                  raise Fail("impossible " ^ Op.toString rator)                  raise Fail("impossible " ^ Op.toString rator)
218              | (Op.Inside(ImageInfo.ImgInfo{dim, ...}, s), [pos, img]) =>              | (Op.Inside(ImageInfo.ImgInfo{dim, ...}, s), [pos, img]) =>
219                  CL.mkApply(RN.inside dim, [pos, img, intExp s])                  CL.mkApply(RN.inside dim, [pos, CL.mkUnOp(CL.%&,img), intExp s])
220              | (Op.Input(ty, name, desc), []) =>              | (Op.Input(ty, name, desc), []) =>
221                  raise Fail("impossible " ^ Op.toString rator)                  raise Fail("impossible " ^ Op.toString rator)
222              | (Op.InputWithDefault(ty, name, desc), [a]) =>              | (Op.InputWithDefault(ty, name, desc), [a]) =>

Legend:
Removed from v.1397  
changed lines
  Added in v.1398

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