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 2135, Mon Feb 11 12:33:24 2013 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            funcs : func list,
23          strands : strand list,          strands : strand list,
24          init : init                     (* block evaluates any vars used in init *)          init : init                     (* block evaluates any vars used in init *)
25        }        }
26    
27        and func = Func of {
28            f : var,
29            params : var list,
30            body : block
31          }
32    
33      and init = Initially of {      and init = Initially of {
34          isArray : bool,          isArray : bool,
35          rangeInit : block,          rangeInit : block,
# Line 63  Line 71 
71        | S_New of Atom.atom * var list        | S_New of Atom.atom * var list
72        | S_Die        | S_Die
73        | S_Stabilize        | S_Stabilize
74          | S_Return of var
75        | S_Print of var list        | S_Print of var list
76    
77      and exp      and exp
# Line 71  Line 80 
80        | E_Tuple of var list        | E_Tuple of var list
81        | E_Apply of var * Types.meta_var list * var list * Types.ty        | E_Apply of var * Types.meta_var list * var list * Types.ty
82        | E_Cons of var list        | E_Cons of var list
83          | E_Seq of var list
84        | E_Slice of var * var option list * Types.ty     (* tensor slicing *)        | E_Slice of var * var option list * Types.ty     (* tensor slicing *)
85        | E_Input of Types.ty * string * string * var option        | E_Coerce of {srcTy : Types.ty, dstTy : Types.ty, x : var}
86        | E_LoadImage of ImageInfo.info * var        | E_LoadSeq of Types.ty * string
87          | E_LoadImage of Types.ty * string * ImageInfo.info
88    
89      fun typeOf (E_Var x) = Var.monoTypeOf x      fun typeOf (E_Var x) = Var.monoTypeOf x
90        | typeOf (E_Lit lit) = (case lit        | typeOf (E_Lit lit) = (case lit
# Line 84  Line 95 
95            (* end case *))            (* end case *))
96        | typeOf (E_Tuple _) = raise Fail "E_Tuple"        | typeOf (E_Tuple _) = raise Fail "E_Tuple"
97        | typeOf (E_Apply(_, _, _, ty)) = ty        | typeOf (E_Apply(_, _, _, ty)) = ty
98          | typeOf (E_Cons[]) = raise Fail "impossible empty E_Cons"
99        | typeOf (E_Cons(x::xs)) = let        | typeOf (E_Cons(x::xs)) = let
100            val d = List.length xs + 1            val d = List.length xs + 1
101            val ty = Var.monoTypeOf x            val ty = Var.monoTypeOf x
# Line 93  Line 105 
105                | _ => raise Fail "element of tensor construction not tensor"                | _ => raise Fail "element of tensor construction not tensor"
106              (* end case *)              (* end case *)
107            end            end
108        | typeOf (E_Cons[]) = raise Fail "impossible empty E_Cons"        | typeOf (E_Seq[]) = raise Fail "empty sequence not supported yet"
109          | typeOf (E_Seq(x::xs)) = let
110              val d = List.length xs + 1
111              val ty = Var.monoTypeOf x
112              in
113                Types.T_Sequence(ty, Types.DimConst d)
114              end
115        | typeOf (E_Slice(_, _, ty)) = ty        | typeOf (E_Slice(_, _, ty)) = ty
116        | typeOf (E_Input(ty, _, _, _)) = ty        | typeOf (E_Coerce{dstTy, ...}) = dstTy
117        | typeOf (E_LoadImage(ImageInfo.ImgInfo{dim, ty=(dd, _), ...}, _)) =        | typeOf (E_LoadSeq(ty, _)) = ty
118            Types.T_Image{        | typeOf (E_LoadImage(ty, _, _)) = ty
               dim = Types.DimConst dim,  
               shape = Types.Shape(List.map Types.DimConst dd)  
             }  
119    
120    end    end

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

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