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

SCM Repository

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

Diff of /branches/pure-cfg/src/compiler/high-to-mid/probe.sml

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

revision 516, Wed Feb 9 23:10:31 2011 UTC revision 517, Thu Feb 10 11:45:00 2011 UTC
# Line 8  Line 8 
8    
9  structure Probe : sig  structure Probe : sig
10    
11      val expand : MidIL.var * FieldDef.field_def * MidIL.var -> MidIL.assign list      val expand : {
12                result : MidIL.var,         (* result variable for probe *)
13                img : MidIL.var,            (* probe image argument *)
14                v : ImageInfo.info,         (* summary info about image *)
15                h : Kernel.kernel,          (* reconstruction kernel *)
16                k : int,                    (* number of levels of differentiation *)
17                pos : MidIL.var             (* probe position argument *)
18              } -> MidIL.assign list
19    
20    end = struct    end = struct
21    
# Line 100  Line 107 
107            end            end
108    
109    (* generate code for probing the field (D^k (v * h)) at pos *)    (* generate code for probing the field (D^k (v * h)) at pos *)
110      fun probe (result, (k, v, h), pos) = let      fun expand {result, img, v, h, k, pos} = let
111            val ImageInfo.ImgInfo{dim, ty=([], ty), ...} = v            val ImageInfo.ImgInfo{dim, ty=([], ty), ...} = v
112            val s = Kernel.support h            val s = Kernel.support h
113            val vecsTy = DstTy.VecTy(2*s) (* vectors of coefficients cover support of kernel *)            val vecsTy = DstTy.VecTy(2*s) (* vectors of coefficients cover support of kernel *)
# Line 111  Line 118 
118            val nd = DstV.new ("nd", vecDimTy)            val nd = DstV.new ("nd", vecDimTy)
119            val n = DstV.new ("n", DstTy.IVecTy dim)            val n = DstV.new ("n", DstTy.IVecTy dim)
120            val transformCode = [            val transformCode = [
121                    assign(x, DstOp.PosToImgSpace v, [pos]),                    assign(x, DstOp.PosToImgSpace dim, [img, pos]),
122                    assign(nd, DstOp.Floor dim, [x]),                    assign(nd, DstOp.Floor dim, [x]),
123                    assign(f, DstOp.Sub vecDimTy, [x, nd]),                    assign(f, DstOp.Sub vecDimTy, [x, nd]),
124                    assign(n, DstOp.TruncToInt dim, [nd])                    assign(n, DstOp.TruncToInt dim, [nd])
# Line 194  Line 201 
201                        val a = DstV.new ("a", DstTy.AddrTy)                        val a = DstV.new ("a", DstTy.AddrTy)
202                        in                        in
203                          indicesCode @ [                          indicesCode @ [
204                              assign(a, DstOp.VoxelAddress v, indices),                              assign(a, DstOp.VoxelAddress dim, img::indices),
205                              assign(vox, DstOp.LoadVoxels(ty, 2*s), [a])                              assign(vox, DstOp.LoadVoxels(ty, 2*s), [a])
206                            ] @ code                            ] @ code
207                        end                        end
# Line 226  Line 233 
233              transformCode @ loadCode @ probeCode              transformCode @ loadCode @ probeCode
234            end            end
235    
     fun expand (result, fld, pos) = let  
           fun expand' (result, FieldDef.CONV(k, v, h)) = probe (result, (k, v, h), pos)  
 (* should push negation down to probe operation  
             | expand' (result, FieldDef.NEG fld) = let  
                 val r = DstV.new "value"  
                 val stms = expand' (r, fld)  
                 val ty = ??  
                 in  
                   expand' (r, fld) @ [assign(r, DstOp.Neg ty, [r])]  
                 end  
 *)  
             | expand' (result, FieldDef.SUM(fld1, dlf2)) = raise Fail "expandInside: SUM"  
           in  
             expand' (result, fld)  
           end  
   
236    end    end

Legend:
Removed from v.516  
changed lines
  Added in v.517

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