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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/high-to-mid/probe-ein.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/high-to-mid/probe-ein.sml

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

revision 3585, Thu Jan 14 14:08:46 2016 UTC revision 3586, Thu Jan 14 14:49:31 2016 UTC
# Line 40  Line 40 
40    
41      fun mkEin (params, index, body) = Ein.EIN{params = params, index = index, body = body}      fun mkEin (params, index, body) = Ein.EIN{params = params, index = index, body = body}
42    
43      fun getRHSDst x = (case IR.Var.binding x      fun getRHSDst x = (case IR.Var.getDef x
44             of IR.VB_RHS(IR.OP(rator, args)) => (rator, args)             of IR.OP(rator, args) => (rator, args)
45              | IR.VB_RHS(IR.VAR x') => getRHSDst x'              | rhs => raise Fail(concat[
             | vb => raise Fail(concat[  
46                    "expected rhs operator for ", IR.Var.toString x,                    "expected rhs operator for ", IR.Var.toString x,
47                    " but found ", IR.vbToString vb                    " but found ", IR.RHS.toString rhs
48                  ])                  ])
49            (* end case *))            (* end case *))
50    
51      fun getImageDst (imgArg, args) = (case (getRHSDst imgArg)      fun getImageDst imgArg = (case IR.Var.getDef imgArg
52             of (Op.LoadImage(Ty.ImageTy info, _), _) => info             of IR.OP(Op.LoadImage(Ty.ImageTy info, _), _) => info
53  (* FIXME: also border control! *)  (* FIXME: also border control! *)
54              | (i, _) => raise Fail (String.concat[" Expected Image: ", Op.toString i])              | rhs => raise Fail (String.concat[
55                      "expected image for ", IR.Var.toString imgArg,
56                      " but found ", IR.RHS.toString rhs
57                    ])
58            (* end case *))            (* end case *))
59    
60      fun getKernelDst (hArg, args) = (case (getRHSDst hArg)      fun getKernelDst hArg = (case IR.Var.getDef hArg
61             of (Op.Kernel(h, _), _) => Kernel.support h             of IR.OP(Op.Kernel(h, _), _) => Kernel.support h
62              | (k,_) => raise Fail (String.concat["Expected kernel: ", Op.toString k])              | rhs => raise Fail (String.concat[
63                      "expected kernel for ", IR.Var.toString hArg,
64                      " but found ", IR.RHS.toString rhs
65                    ])
66            (* end case *))            (* end case *))
67    
68      (*handleArgs():int*int*int*Mid IR.Var list      (*handleArgs():int*int*int*Mid IR.Var list
# Line 69  Line 74 
74      *)      *)
75      fun handleArgs (Vid, hid, tid, args) = let      fun handleArgs (Vid, hid, tid, args) = let
76            val imgArg = List.nth (args, Vid)            val imgArg = List.nth (args, Vid)
77            val info = getImageDst (imgArg, args)            val info = getImageDst imgArg
78            val s = getKernelDst (List.nth(args, hid), args)            val s = getKernelDst (List.nth(args, hid))
79            val (argsT, P, code) = T.worldToIndex{info = info, img = imgArg, pos = List.nth(args, tid)}            val (argsT, P, code) = T.worldToIndex{info = info, img = imgArg, pos = List.nth(args, tid)}
80            in            in
81              (ImageInfo.dim info, args@argsT, code, s, P)              (ImageInfo.dim info, args@argsT, code, s, P)

Legend:
Removed from v.3585  
changed lines
  Added in v.3586

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