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

SCM Repository

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

Diff of /trunk/src/compiler/mid-to-low/mid-to-low.sml

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

revision 458, Wed Oct 27 12:29:00 2010 UTC revision 459, Wed Oct 27 12:54:03 2010 UTC
# Line 8  Line 8 
8    
9  structure MidToLow : sig  structure MidToLow : sig
10    
11      val translate : HighIL.program -> MidIL.program      val translate : MidIL.program -> LowIL.program
12    
13    end = struct    end = struct
14    
# Line 32  Line 32 
32            (* end case *))            (* end case *))
33      fun renameList (env, xs) = List.map (fn x => rename(env, x)) xs      fun renameList (env, xs) = List.map (fn x => rename(env, x)) xs
34    
35    (* expand the EvalKernel operations into vector operations *)    (* expand the EvalKernel operations into vector operations.  The parameters are
36      fun expandKernel (dimSize, kern, k, vec) = ??     *    result  -- the lhs variable to store the result
37       *    d       -- the vector width of the operation, which should be equal to twice the
38       *               support of the kernel
39       *    h       -- the kernel
40       *    k       -- the derivative of the kernel to evaluate
41       *)
42        fun expandKernel (result, d, h, k) = let
43              val {isCont, segs} = Kernel.curve (h, k)
44              in
45              end
46    
47    (* compute the load address for a given set of voxels indices *)    (* compute the load address for a given set of voxels indices *)
48      fun computeVoxelAddress (info, vec) = ??      fun expandVoxelAddress (result, info) = ??
49    
50      fun expandOp (env, y, rator, args) = let      fun expandOp (env, y, rator, args) = let
51            fun assign rator' =            fun assign rator' =
52                  [(y, DstIL.OP(rator', renameList(env, args)))]                  [(y, DstIL.OP(rator', renameList(env, args)))]
53            in            in
54              case rator              case rator
55               of SrcOp.Add ty =>               of SrcOp.Add ty => assign (DstOp.Add ty)
56                | SrcOp.Sub ty =>                | SrcOp.Sub ty => assign (DstOp.Sub ty)
57                | SrcOp.Mul ty =>                | SrcOp.Mul ty => assign (DstOp.Mul ty)
58                | SrcOp.Div ty =>                | SrcOp.Div ty => assign (DstOp.Div ty)
59                | SrcOp.Neg ty =>                | SrcOp.Neg ty => assign (DstOp.Neg ty)
60                | SrcOp.LT ty =>                | SrcOp.LT ty => assign (DstOp.LT ty)
61                | SrcOp.LTE ty =>                | SrcOp.LTE ty => assign (DstOp.LTE ty)
62                | SrcOp.EQ ty =>                | SrcOp.EQ ty => assign (DstOp.EQ ty)
63                | SrcOp.NEQ ty =>                | SrcOp.NEQ ty => assign (DstOp.NEQ ty)
64                | SrcOp.GT ty =>                | SrcOp.GT ty => assign (DstOp.GT ty)
65                | SrcOp.GTE ty =>                | SrcOp.GTE ty => assign (DstOp.GTE ty)
66                | SrcOp.Not =>                | SrcOp.Not => assign (DstOp.Not)
67                | SrcOp.Max =>                | SrcOp.Max => assign (DstOp.Max)
68                | SrcOp.Min =>                | SrcOp.Min => assign (DstOp.Min)
69                | SrcOp.Sin =>                | SrcOp.Sin => assign (DstOp.Sin)
70                | SrcOp.Cos =>                | SrcOp.Cos => assign (DstOp.Cos)
71                | SrcOp.Pow =>                | SrcOp.Pow => assign (DstOp.Pow)
72                | SrcOp.Dot d =>                | SrcOp.Dot d => assign (DstOp.Dot d)
73                | SrcOp.Cross =>                | SrcOp.Cross => assign (DstOp.Cross)
74                | SrcOp.Select ty =>  * int                | SrcOp.Select ty => assign (DstOp.Select ty) * int
75                | SrcOp.Norm d =>                | SrcOp.Norm d => assign (DstOp.Norm d)
76                | SrcOp.Scale d =>                | SrcOp.Scale d => assign (DstOp.Scale d)
77                | SrcOp.InvScale d =>                | SrcOp.InvScale d => assign (DstOp.InvScale d)
78                | SrcOp.CL =>                | SrcOp.CL => assign (DstOp.CL)
79                | SrcOp.PrincipleEvec ty =>                | SrcOp.PrincipleEvec ty => assign (DstOp.PrincipleEvec ty)
80                | SrcOp.Subscript ty =>                | SrcOp.Subscript ty => assign (DstOp.Subscript ty)
81                | SrcOp.Floor d =>                | SrcOp.Floor d => assign (DstOp.Floor d)
82                | SrcOp.IntToReal =>                | SrcOp.IntToReal => assign (DstOp.IntToReal)
83                | SrcOp.TruncToInt d =>                | SrcOp.TruncToInt d => assign (DstOp.TruncToInt d)
84                | SrcOp.RoundToInt d =>                | SrcOp.RoundToInt d => assign (DstOp.RoundToInt d)
85                | SrcOp.CeilToInt d =>                | SrcOp.CeilToInt d => assign (DstOp.CeilToInt d)
86                | SrcOp.FloorToInt d =>                | SrcOp.FloorToInt d => assign (DstOp.FloorToInt d)
87                | SrcOp.VoxelAddress info =>                | SrcOp.VoxelAddress info => expandVoxelAddress (y, info)
88                | SrcOp.LoadVoxels(rty, d) =>                | SrcOp.LoadVoxels(rty, d) => assign (DstOp.LoadVoxels(rty, d))
89                | SrcOp.Transform info =>                | SrcOp.Transform info => assign (DstOp.Transform info)
90                | SrcOp.EvalKernel(d, h, k) =>                | SrcOp.EvalKernel(d, h, k) => expandEvalKernel(y, d, h, k)
91                | SrcOp.LoadImage info =>                | SrcOp.LoadImage info => assign (DstOp.LoadImage info)
92                | SrcOp.Inside info =>                | SrcOp.Inside info => assign (DstOp.Inside info)
93                | SrcOp.Input(ty, name) =>                | SrcOp.Input(ty, name) => assign (DstOp.Input(ty, name))
94                | SrcOp.InputWithDefault(ty, name) =>                | SrcOp.InputWithDefault(ty, name) => assign (DstOp.InputWithDefault(ty, name))
95                | _ => raise Fail("unexpected " ^ SrcOp.toString rator)                | _ => raise Fail("unexpected " ^ SrcOp.toString rator)
96              (* end case *)              (* end case *)
97            end            end

Legend:
Removed from v.458  
changed lines
  Added in v.459

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