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

SCM Repository

[diderot] Annotation of /trunk/src/compiler/high-il/check-ops.sml
ViewVC logotype

Annotation of /trunk/src/compiler/high-il/check-ops.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 404 - (view) (download)

1 : jhr 404 (* check-ops.sml
2 :     *
3 :     * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *)
6 :    
7 :     structure CheckOps : sig
8 :    
9 :     val sign : HighOps.rator -> HighILTypes.ty * HighILTypes.ty list
10 :    
11 :     end = struct
12 :    
13 :     structure Op = HighOps
14 :     structure Ty = HighILTypes
15 :    
16 :     fun sign rator = (case rator
17 :     of Op.Add ty => (ty, [ty, ty])
18 :     | Op.Sub ty => (ty, [ty, ty])
19 :     | Op.Mul ty => (ty, [ty, ty])
20 :     | Op.Div ty => (ty, [ty, ty])
21 :     | Op.Neg ty => (ty, [ty])
22 :     | Op.LT ty => (Ty.BoolTy, [ty, ty])
23 :     | Op.LTE ty => (Ty.BoolTy, [ty, ty])
24 :     | Op.EQ ty => (Ty.BoolTy, [ty, ty])
25 :     | Op.NEQ ty => (Ty.BoolTy, [ty, ty])
26 :     | Op.GT ty => (Ty.BoolTy, [ty, ty])
27 :     | Op.GTE ty => (Ty.BoolTy, [ty, ty])
28 :     | Op.Max => (Ty.realTy, [Ty.realTy, Ty.realTy])
29 :     | Op.Min => (Ty.realTy, [Ty.realTy, Ty.realTy])
30 :     | Op.Sin => (Ty.realTy, [Ty.realTy])
31 :     | Op.Cos => (Ty.realTy, [Ty.realTy])
32 :     | Op.Pow => (Ty.realTy, [Ty.realTy, Ty.realTy])
33 :     | Op.Not => (Ty.BoolTy, [Ty.BoolTy])
34 :     | Op.Dot ty => (Ty.realTy, [ty, ty])
35 :     | Op.Cross => (Ty.vec3Ty, [Ty.vec3Ty, Ty.vec3Ty])
36 :     | Op.Norm => (Ty.realTy, [ty])
37 :     | Op.Scale ty => (ty, [Ty.realTy, ty])
38 :     | Op.InvScale ty => (ty, [ty, Ty.realTy])
39 :     | Op.CL =>
40 :     | Op.PrincipleEvec ty => (Ty.realTy, [ty])
41 :     | Op.Slice(ty as Ty.Tensor dd, m) => let
42 :     val (resDims, idxDims) = let
43 :     fun f (d, false, (rds, ids)) = (d::rds, ids)
44 :     | f (_, true, (rds, ids)) = (rds, Ty.IntTy::ids)
45 :     in
46 :     ListPair.foldr f ([], []) (dd, mask)
47 :     end
48 :     in
49 :     (Ty.Tensor rds, ty::idxDims)
50 :     end
51 :     | Op.Subscript(ty as Ty.Tensor dd) =>
52 :     (Ty.realTy, ty :: List.map (fn _ => Ty.IntTy) dd)
53 :     | Op.IntToReal => (Ty.realTy, [Ty.IntTy])
54 :     | Op.TruncToInt => (Ty.IntTy, [Ty.realTy])
55 :     | Op.RoundToInt => (Ty.IntTy, [Ty.realTy])
56 :     | Op.CeilToInt => (Ty.IntTy, [Ty.realTy])
57 :     | Op.FloorToInt => (Ty.IntTy, [Ty.realTy])
58 :     | Op.Kernel _ => (Ty.KernelTy, [])
59 :     | Op.LoadImage _ => (Ty.ImageTy, [])
60 :     | Op.Convolve =>
61 :     | Op.Inside =>
62 :     | Op.Field _ => (Ty.FieldTy, [])
63 :     | Op.AddField => (Ty.FieldTy, [Ty.FieldTy, Ty.FieldTy])
64 :     | Op.ScaleField => (Ty.FieldTy, [Ty.realTy, Ty.FieldTy])
65 :     | Op.NegField => (Ty.FieldTy, [Ty.FieldTy])
66 :     | Op.DiffField => (Ty.FieldTy, [Ty.FieldTy])
67 :     | Op.Probe => ??
68 :     | Op.Input of string
69 :     | Op.InputWithDefault of string
70 :     (* end case *))
71 :    
72 :     end

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