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 411, Sat Oct 16 15:03:18 2010 UTC revision 412, Sat Oct 16 15:19:19 2010 UTC
# Line 14  Line 14 
14      type rator = Op.rator      type rator = Op.rator
15      type ty = Ty.ty      type ty = Ty.ty
16    
17      fun sign rator = (case rator      fun sigOf rator = (case rator
18             of Op.Add ty => (ty, [ty, ty])             of Op.Add ty => (ty, [ty, ty])
19              | Op.Sub ty => (ty, [ty, ty])              | Op.Sub ty => (ty, [ty, ty])
20              | Op.Mul ty => (ty, [ty, ty])              | Op.Mul ty => (ty, [ty, ty])
# Line 34  Line 34 
34              | Op.Not => (Ty.BoolTy, [Ty.BoolTy])              | Op.Not => (Ty.BoolTy, [Ty.BoolTy])
35              | Op.Dot ty => (Ty.realTy, [ty, ty])              | Op.Dot ty => (Ty.realTy, [ty, ty])
36              | Op.Cross => (Ty.vec3Ty, [Ty.vec3Ty, Ty.vec3Ty])              | Op.Cross => (Ty.vec3Ty, [Ty.vec3Ty, Ty.vec3Ty])
37              | Op.Norm => (Ty.realTy, [ty])              | Op.Norm ty => (Ty.realTy, [ty])
38              | Op.Scale ty => (ty, [Ty.realTy, ty])              | Op.Scale ty => (ty, [Ty.realTy, ty])
39              | Op.InvScale ty => (ty, [ty, Ty.realTy])              | Op.InvScale ty => (ty, [ty, Ty.realTy])
40              | Op.CL => (Ty.realTy, [Ty.TensorTy[3, 3]])              | Op.CL => (Ty.realTy, [Ty.TensorTy[3, 3]])
# Line 44  Line 44 
44                        fun f (d, false, (rds, ids)) = (d::rds, ids)                        fun f (d, false, (rds, ids)) = (d::rds, ids)
45                          | f (_, true, (rds, ids)) = (rds, Ty.IntTy::ids)                          | f (_, true, (rds, ids)) = (rds, Ty.IntTy::ids)
46                        in                        in
47                          ListPair.foldr f ([], []) (dd, mask)                          ListPair.foldr f ([], []) (dd, m)
48                        end                        end
49                  in                  in
50                    (Ty.Tensor rds, ty::idxDims)                    (Ty.TensorTy resDims, ty::idxDims)
51                  end                  end
52              | Op.Subscript(ty as Ty.TensorTy dd) =>              | Op.Subscript(ty as Ty.TensorTy dd) =>
53                  (Ty.realTy, ty :: List.map (fn _ => Ty.IntTy) dd)                  (Ty.realTy, ty :: List.map (fn _ => Ty.IntTy) dd)
# Line 68  Line 68 
68              | Op.Probe(rngTy, domTy) => (rngTy, [Ty.FieldTy, domTy])              | Op.Probe(rngTy, domTy) => (rngTy, [Ty.FieldTy, domTy])
69              | Op.Input(ty, _) => (ty, [])              | Op.Input(ty, _) => (ty, [])
70              | Op.InputWithDefault(ty, _) => (ty, [ty])              | Op.InputWithDefault(ty, _) => (ty, [ty])
71                | _ => raise Fail("sigOf: invalid operator " ^ Op.toString rator)
72            (* end case *))            (* end case *))
73    
74        fun typeOfCons ((ty1 as Ty.TensorTy dd)::r) =
75              if List.all (fn ty => Ty.same(ty1, ty)) r
76                then SOME(Ty.TensorTy((List.length r + 1) :: dd))
77                else NONE
78          | typeOfCons _ = NONE
79    
80    end    end
81    
82  structure CheckHighIL = CheckILFn (  structure CheckHighIL = CheckILFn (

Legend:
Removed from v.411  
changed lines
  Added in v.412

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