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

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/simplify/simple.sml
ViewVC logotype

Diff of /branches/vis12/src/compiler/simplify/simple.sml

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

revision 1685, Sun Jan 22 15:23:36 2012 UTC revision 2016, Tue Oct 9 03:22:30 2012 UTC
# Line 16  Line 16 
16      datatype var = datatype AST.var      datatype var = datatype AST.var
17    
18      datatype program = Program of {      datatype program = Program of {
19            inputs : (var * Types.ty Inputs.input) list,
20          globals : var list,          globals : var list,
21          globalInit : block,          globalInit : block,
22          strands : strand list,          strands : strand list,
# Line 71  Line 72 
72        | E_Tuple of var list        | E_Tuple of var list
73        | E_Apply of var * Types.meta_var list * var list * Types.ty        | E_Apply of var * Types.meta_var list * var list * Types.ty
74        | E_Cons of var list        | E_Cons of var list
75          | E_Seq of var list
76        | E_Slice of var * var option list * Types.ty     (* tensor slicing *)        | E_Slice of var * var option list * Types.ty     (* tensor slicing *)
77        | E_Input of Types.ty * string * string * var option        | E_Coerce of {srcTy : Types.ty, dstTy : Types.ty, x : var}
       | E_LoadImage of ImageInfo.info * var  
78    
79      fun typeOf (E_Var x) = Var.monoTypeOf x      fun typeOf (E_Var x) = Var.monoTypeOf x
80        | typeOf (E_Lit lit) = (case lit        | typeOf (E_Lit lit) = (case lit
# Line 84  Line 85 
85            (* end case *))            (* end case *))
86        | typeOf (E_Tuple _) = raise Fail "E_Tuple"        | typeOf (E_Tuple _) = raise Fail "E_Tuple"
87        | typeOf (E_Apply(_, _, _, ty)) = ty        | typeOf (E_Apply(_, _, _, ty)) = ty
88          | typeOf (E_Cons[]) = raise Fail "impossible empty E_Cons"
89        | typeOf (E_Cons(x::xs)) = let        | typeOf (E_Cons(x::xs)) = let
90            val d = List.length xs + 1            val d = List.length xs + 1
91            val ty = Var.monoTypeOf x            val ty = Var.monoTypeOf x
# Line 93  Line 95 
95                | _ => raise Fail "element of tensor construction not tensor"                | _ => raise Fail "element of tensor construction not tensor"
96              (* end case *)              (* end case *)
97            end            end
98        | typeOf (E_Cons[]) = raise Fail "impossible empty E_Cons"        | typeOf (E_Seq[]) = raise Fail "empty sequence not supported yet"
99          | typeOf (E_Seq(x::xs)) = let
100              val d = List.length xs + 1
101              val ty = Var.monoTypeOf x
102              in
103                Types.T_Sequence(ty, Types.DimConst d)
104              end
105        | typeOf (E_Slice(_, _, ty)) = ty        | typeOf (E_Slice(_, _, ty)) = ty
106        | typeOf (E_Input(ty, _, _, _)) = ty        | typeOf (E_Coerce{dstTy, ...}) = dstTy
       | typeOf (E_LoadImage(ImageInfo.ImgInfo{dim, ty=(dd, _), ...}, _)) =  
           Types.T_Image{  
               dim = Types.DimConst dim,  
               shape = Types.Shape(List.map Types.DimConst dd)  
             }  
107    
108    end    end

Legend:
Removed from v.1685  
changed lines
  Added in v.2016

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