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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/mid-to-low/mid-to-low.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/mid-to-low/mid-to-low.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 62  Line 62 
62     *)     *)
63      fun ratToFloat r = (case Rational.explode r      fun ratToFloat r = (case Rational.explode r
64             of {sign=0, ...} => FloatLit.zero false             of {sign=0, ...} => FloatLit.zero false
65              | {sign, num, denom=1} => FloatLit.fromInt(sign * IntInf.toInt num)              | {sign, num, denom=1} => FloatLit.fromInt(IntInf.fromInt sign * num)
66              | {sign, num, denom} => let              | {sign, num, denom} => let
67                (* normalize so that num <= denom *)                (* normalize so that num <= denom *)
68                  val (denom, exp) = let                  val (denom, exp) = let
# Line 249  Line 249 
249     *)     *)
250      fun expandVoxelAddress (result, info, offset, [img, ix]) = let      fun expandVoxelAddress (result, info, offset, [img, ix]) = let
251            val dim = ImageInfo.dim info            val dim = ImageInfo.dim info
           val sizes = ImageInfo.sizes info  
252            val stride = ImageInfo.stride info            val stride = ImageInfo.stride info
253            val shape = ImageInfo.voxelShape info            val shape = ImageInfo.voxelShape info
254            val (offp, code) = adjustForStrideAndOffset (stride, offset, ix, [])            val (offp, code) = adjustForStrideAndOffset (stride, offset, ix, [])
# Line 267  Line 266 
266            val stride = ImageInfo.stride info            val stride = ImageInfo.stride info
267            val shape = ImageInfo.voxelShape info            val shape = ImageInfo.voxelShape info
268          (* get N_1 ... N_{d-1} *)          (* get N_1 ... N_{d-1} *)
269    (* FIXME: sizes is [] when the image does not have a proxy *)
270            val sizes = List.take (sizes, List.length sizes - 1)            val sizes = List.take (sizes, List.length sizes - 1)
271          (* generate the address computation code in reverse order *)          (* generate the address computation code in reverse order *)
272            fun gen (d, [n], [ix]) = let            fun gen (d, [n], [ix]) = let
# Line 291  Line 291 
291                  in                  in
292                    (t2, code)                    (t2, code)
293                  end                  end
294    (* FIXME: sizes is [] when the image does not have a proxy *)
295            val (tmp, code) = gen (0, sizes, indices)            val (tmp, code) = gen (0, sizes, indices)
296            val t = DstIL.Var.new ("index", DstTy.intTy)            val t = DstIL.Var.new ("index", DstTy.intTy)
297            val code = iadd(t, ix1, tmp) :: code            val code = iadd(t, ix1, tmp) :: code
# Line 357  Line 358 
358                | SrcOp.MulVecMat(d1, d2) => assign (DstOp.MulVecMat(d1, d2))                | SrcOp.MulVecMat(d1, d2) => assign (DstOp.MulVecMat(d1, d2))
359                | SrcOp.MulMatVec(d1, d2) => assign (DstOp.MulMatVec(d1, d2))                | SrcOp.MulMatVec(d1, d2) => assign (DstOp.MulMatVec(d1, d2))
360                | SrcOp.MulMatMat(d1, d2, d3) => assign (DstOp.MulMatMat(d1, d2, d3))                | SrcOp.MulMatMat(d1, d2, d3) => assign (DstOp.MulMatMat(d1, d2, d3))
361                  | SrcOp.MulVecTen3(d1, d2, d3) => assign(DstOp.MulVecTen3(d1, d2, d3))
362                  | SrcOp.MulTen3Vec(d1, d2, d3) => assign(DstOp.MulTen3Vec(d1, d2, d3))
363                  | SrcOp.ColonMul(ty1, ty2) => assign(DstOp.ColonMul(ty1, ty2))
364                | SrcOp.Cross => assign (DstOp.Cross)                | SrcOp.Cross => assign (DstOp.Cross)
365                | SrcOp.Norm ty => assign (DstOp.Norm ty)                | SrcOp.Norm ty => assign (DstOp.Norm ty)
366                | SrcOp.Normalize d => assign (DstOp.Normalize d)                | SrcOp.Normalize d => assign (DstOp.Normalize d)
# Line 367  Line 371 
371                | SrcOp.EigenVals3x3 => assign (DstOp.EigenVals3x3)                | SrcOp.EigenVals3x3 => assign (DstOp.EigenVals3x3)
372                | SrcOp.Identity n => assign (DstOp.Identity n)                | SrcOp.Identity n => assign (DstOp.Identity n)
373                | SrcOp.Trace d => expandTrace (y, d, args')                | SrcOp.Trace d => expandTrace (y, d, args')
374                  | SrcOp.Transpose(d1, d2) => assign (DstOp.Transpose(d1, d2))
375                | SrcOp.Select(ty as SrcTy.TupleTy tys, i) => assign (DstOp.Select(ty, i))                | SrcOp.Select(ty as SrcTy.TupleTy tys, i) => assign (DstOp.Select(ty, i))
376                | SrcOp.Index(ty, i) => assign (DstOp.Index(ty, i))                | SrcOp.Index(ty, i) => assign (DstOp.Index(ty, i))
377                | SrcOp.Subscript ty => assign (DstOp.Subscript ty)                | SrcOp.Subscript ty => assign (DstOp.Subscript ty)

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