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

trunk/src/compiler/simplify/simple.sml revision 1640, Wed Nov 16 02:19:51 2011 UTC branches/vis12/src/compiler/simplify/simple.sml revision 2141, Fri Feb 15 13:13:46 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 35  Line 43 
43          args : var list          args : var list
44        }        }
45    
46    (* do we use this?
47      and iter = I_Range of {      and iter = I_Range of {
48          rangeInit : block,          rangeInit : block,
49          param : var,          param : var,
50          lo : var,          lo : var,
51          hi : var          hi : var
52        }        }
53    *)
54    
55      and strand = Strand of {      and strand = Strand of {
56          name : Atom.atom,          name : Atom.atom,
# Line 63  Line 73 
73        | S_New of Atom.atom * var list        | S_New of Atom.atom * var list
74        | S_Die        | S_Die
75        | S_Stabilize        | S_Stabilize
76          | S_Return of var
77        | S_Print of var list        | S_Print of var list
78    
79      and exp      and exp
# Line 71  Line 82 
82        | E_Tuple of var list        | E_Tuple of var list
83        | E_Apply of var * Types.meta_var list * var list * Types.ty        | E_Apply of var * Types.meta_var list * var list * Types.ty
84        | E_Cons of var list        | E_Cons of var list
85          | E_Seq of var list
86        | E_Slice of var * var option list * Types.ty     (* tensor slicing *)        | E_Slice of var * var option list * Types.ty     (* tensor slicing *)
87        | E_Input of Types.ty * string * string * var option        | E_Coerce of {srcTy : Types.ty, dstTy : Types.ty, x : var}
88        | E_LoadImage of ImageInfo.info * var        | E_LoadSeq of Types.ty * string
89          | E_LoadImage of Types.ty * string * ImageInfo.info
90    
91      fun typeOf (E_Var x) = Var.monoTypeOf x      fun typeOf (E_Var x) = Var.monoTypeOf x
92        | typeOf (E_Lit lit) = (case lit        | typeOf (E_Lit lit) = (case lit
# Line 84  Line 97 
97            (* end case *))            (* end case *))
98        | typeOf (E_Tuple _) = raise Fail "E_Tuple"        | typeOf (E_Tuple _) = raise Fail "E_Tuple"
99        | typeOf (E_Apply(_, _, _, ty)) = ty        | typeOf (E_Apply(_, _, _, ty)) = ty
100          | typeOf (E_Cons[]) = raise Fail "impossible empty E_Cons"
101        | typeOf (E_Cons(x::xs)) = let        | typeOf (E_Cons(x::xs)) = let
102            val d = List.length xs + 1            val d = List.length xs + 1
103            val ty = Var.monoTypeOf x            val ty = Var.monoTypeOf x
# Line 93  Line 107 
107                | _ => raise Fail "element of tensor construction not tensor"                | _ => raise Fail "element of tensor construction not tensor"
108              (* end case *)              (* end case *)
109            end            end
110        | typeOf (E_Cons[]) = raise Fail "impossible empty E_Cons"        | typeOf (E_Seq[]) = raise Fail "empty sequence not supported yet"
111          | typeOf (E_Seq(x::xs)) = let
112              val d = List.length xs + 1
113              val ty = Var.monoTypeOf x
114              in
115                Types.T_Sequence(ty, Types.DimConst d)
116              end
117        | typeOf (E_Slice(_, _, ty)) = ty        | typeOf (E_Slice(_, _, ty)) = ty
118        | typeOf (E_Input(ty, _, _, _)) = ty        | typeOf (E_Coerce{dstTy, ...}) = dstTy
119        | typeOf (E_LoadImage(ImageInfo.ImgInfo{dim, ty=(dd, _), ...}, _)) =        | typeOf (E_LoadSeq(ty, _)) = ty
120            Types.T_Image{        | typeOf (E_LoadImage(ty, _, _)) = ty
               dim = Types.DimConst dim,  
               shape = Types.Shape(List.map Types.DimConst dd)  
             }  
121    
122    end    end

Legend:
Removed from v.1640  
changed lines
  Added in v.2141

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