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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/high-il/check-high-il.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/high-il/check-high-il.sml

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

revision 1115, Thu May 5 04:42:18 2011 UTC revision 1116, Thu May 5 04:49:02 2011 UTC
# Line 19  Line 19 
19              | Op.Mul ty => (ty, [ty, ty])              | Op.Mul ty => (ty, [ty, ty])
20              | Op.Div ty => (ty, [ty, ty])              | Op.Div ty => (ty, [ty, ty])
21              | Op.Neg ty => (ty, [ty])              | Op.Neg ty => (ty, [ty])
22                | Op.Abs ty => (ty, [ty])
23              | Op.LT ty => (Ty.BoolTy, [ty, ty])              | Op.LT ty => (Ty.BoolTy, [ty, ty])
24              | Op.LTE ty => (Ty.BoolTy, [ty, ty])              | Op.LTE ty => (Ty.BoolTy, [ty, ty])
25              | Op.EQ ty => (Ty.BoolTy, [ty, ty])              | Op.EQ ty => (Ty.BoolTy, [ty, ty])
26              | Op.NEQ ty => (Ty.BoolTy, [ty, ty])              | Op.NEQ ty => (Ty.BoolTy, [ty, ty])
27              | Op.GT ty => (Ty.BoolTy, [ty, ty])              | Op.GT ty => (Ty.BoolTy, [ty, ty])
28              | Op.GTE ty => (Ty.BoolTy, [ty, ty])              | Op.GTE ty => (Ty.BoolTy, [ty, ty])
29                | Op.Power => (Ty.realTy, [Ty.realTy, Ty.IntTy])
30                | Op.Not => (Ty.BoolTy, [Ty.BoolTy])
31              | Op.Max => (Ty.realTy, [Ty.realTy, Ty.realTy])              | Op.Max => (Ty.realTy, [Ty.realTy, Ty.realTy])
32              | Op.Min => (Ty.realTy, [Ty.realTy, Ty.realTy])              | Op.Min => (Ty.realTy, [Ty.realTy, Ty.realTy])
33              | Op.Sin => (Ty.realTy, [Ty.realTy])              | Op.Lerp ty => (ty, [ty, ty, Ty.realTy])
             | Op.Cos => (Ty.realTy, [Ty.realTy])  
             | Op.Pow => (Ty.realTy, [Ty.realTy, Ty.realTy])  
             | Op.Not => (Ty.BoolTy, [Ty.BoolTy])  
34              | Op.Dot ty => (Ty.realTy, [ty, ty])              | Op.Dot ty => (Ty.realTy, [ty, ty])
35                | Op.MulVecMat(ty as Ty.TensorTy[d1, d2]) => (Ty.TensorTy[d2], [Ty.TensorTy[d1], ty])
36                | Op.MulMatVec(ty as Ty.TensorTy[d1, d2]) => (Ty.TensorTy[d1], [ty, Ty.TensorTy[d2]])
37                | Op.MulMatMat(ty1 as Ty.TensorTy[d1, d2], ty2 as Ty.TensorTy[d2', d3]) =>
38                    (Ty.TensorTy[d1, d3], [ty1, ty2])
39              | Op.Cross => (Ty.vec3Ty, [Ty.vec3Ty, Ty.vec3Ty])              | Op.Cross => (Ty.vec3Ty, [Ty.vec3Ty, Ty.vec3Ty])
40                | Op.Outer(ty as Ty.TensorTy[d1, d2]) => (ty, [Ty.TensorTy[d1], Ty.TensorTy[d2]])
41              | Op.Norm ty => (Ty.realTy, [ty])              | Op.Norm ty => (Ty.realTy, [ty])
42                | Op.Normalize ty => (ty, [ty])
43              | Op.Scale ty => (ty, [Ty.realTy, ty])              | Op.Scale ty => (ty, [Ty.realTy, ty])
             | Op.InvScale ty => (ty, [ty, Ty.realTy])  
44              | Op.CL => (Ty.realTy, [Ty.TensorTy[3, 3]])              | Op.CL => (Ty.realTy, [Ty.TensorTy[3, 3]])
45              | Op.PrincipleEvec(resTy as Ty.TensorTy[d]) => (resTy, [Ty.TensorTy[d,d]])              | Op.PrincipleEvec(resTy as Ty.TensorTy[d]) => (resTy, [Ty.TensorTy[d,d]])
46                | Op.Identity d => (Ty.TensorTy[d,d], [])
47                | Op.Zero ty => (ty, [])
48                | Op.Trace ty => (Ty.realTy, [ty])
49              | Op.Slice(ty as Ty.TensorTy dd, m) => let              | Op.Slice(ty as Ty.TensorTy dd, m) => let
50                  val (resDims, idxDims) = let                  val (resDims, idxDims) = let
51                        fun f (d, false, (rds, ids)) = (d::rds, ids)                        fun f (d, false, (rds, ids)) = (d::rds, ids)
# Line 56  Line 64 
64              | Op.CeilToInt => (Ty.IntTy, [Ty.realTy])              | Op.CeilToInt => (Ty.IntTy, [Ty.realTy])
65              | Op.FloorToInt => (Ty.IntTy, [Ty.realTy])              | Op.FloorToInt => (Ty.IntTy, [Ty.realTy])
66              | Op.Kernel _ => (Ty.KernelTy, [])              | Op.Kernel _ => (Ty.KernelTy, [])
67              | Op.LoadImage _ => (Ty.ImageTy, [])              | Op.LoadImage info => (Ty.ImageTy(ImageInfo.dim info), [Ty.StringTy])
68              | Op.Convolve => (Ty.FieldTy, [Ty.ImageTy, Ty.KernelTy])              | Op.Field dim => (Ty.FieldTy, [Ty.ImageTy dim, Ty.KernelTy])
69              | Op.Inside domTy => (Ty.BoolTy, [domTy, Ty.FieldTy])              | Op.Inside dim => (Ty.BoolTy, [Ty.TensorTy[dim], Ty.FieldTy])
             | Op.Field _ => (Ty.FieldTy, [])  
70              | Op.AddField =>  (Ty.FieldTy, [Ty.FieldTy, Ty.FieldTy])              | Op.AddField =>  (Ty.FieldTy, [Ty.FieldTy, Ty.FieldTy])
71                | Op.SubField =>  (Ty.FieldTy, [Ty.FieldTy, Ty.FieldTy])
72              | Op.ScaleField => (Ty.FieldTy, [Ty.realTy, Ty.FieldTy])              | Op.ScaleField => (Ty.FieldTy, [Ty.realTy, Ty.FieldTy])
73              | Op.NegField => (Ty.FieldTy, [Ty.FieldTy])              | Op.NegField => (Ty.FieldTy, [Ty.FieldTy])
74              | Op.DiffField => (Ty.FieldTy, [Ty.FieldTy])              | Op.DiffField => (Ty.FieldTy, [Ty.FieldTy])
75              | Op.Probe(rngTy, domTy) => (rngTy, [Ty.FieldTy, domTy])              | Op.Probe(domTy, rngTy) => (rngTy, [Ty.FieldTy, domTy])
76              | Op.Input(ty, _) => (ty, [])              | Op.Input(ty, _) => (ty, [])
77              | Op.InputWithDefault(ty, _) => (ty, [ty])              | Op.InputWithDefault(ty, _) => (ty, [ty])
78              | _ => raise Fail("sigOf: invalid operator " ^ Op.toString rator)              | _ => raise Fail("sigOf: invalid operator " ^ Op.toString rator)
79            (* end case *))            (* end case *))
80    
81      fun typeOfCons ((ty1 as Ty.TensorTy dd)::r) =      fun typeOfCons (Ty.TensorTy dd', (ty1 as Ty.TensorTy dd)::r) =
82            if List.all (fn ty => Ty.same(ty1, ty)) r            if List.all (fn ty => Ty.same(ty1, ty)) r
83              then SOME(Ty.TensorTy((List.length r + 1) :: dd))              then (dd' = (List.length r + 1)::dd)
84              else NONE              else false
85        | typeOfCons _ = NONE        | typeOfCons _ = false
86    
87    end    end
88    
89  structure CheckHighIL = CheckILFn (  structure CheckHighIL = CheckILFn (
90      structure IL = HighIL      structure IL = HighIL
91      structure OpTy = CheckOps)      structure OpTy = CheckOps)
92    
93    structure HighPP = SSAPPFn (HighIL)
94    

Legend:
Removed from v.1115  
changed lines
  Added in v.1116

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