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 192, Mon Aug 2 16:23:42 2010 UTC branches/vis12/src/compiler/simplify/simple.sml revision 1685, Sun Jan 22 15:23:36 2012 UTC
# Line 1  Line 1 
1  (* simple.sml  (* simple.sml
2   *   *
3   * COPYRIGHT (c) 2010 The Diderot Project (http://diderot.cs.uchicago.edu)   * COPYRIGHT (c) 2010 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4   * All rights reserved.   * All rights reserved.
5   *   *
6   * A simplified AST representation of a Diderot program   * A simplified AST representation of a Diderot program.  This representation has the property
7     * that the arguments to ifs, operators, etc. are variables and that the rhs of assignments
8     * consist of a single operation.  It is not, however, a single-assignment representation.
9   *)   *)
10    
11  structure Simple =  structure Simple =
# Line 16  Line 18 
18      datatype program = Program of {      datatype program = Program of {
19          globals : var list,          globals : var list,
20          globalInit : block,          globalInit : block,
21          actors : actor list          strands : strand list,
22          (* initialization *)          init : init                     (* block evaluates any vars used in init *)
23        }        }
24    
25      and actor = Actor of {      and init = Initially of {
26            isArray : bool,
27            rangeInit : block,
28            iters : {param : var, lo : var, hi : var} list,
29            create : create
30          }
31    
32        and create = C_Create of {
33            argInit : block,
34            name : Atom.atom,
35            args : var list
36          }
37    
38        and iter = I_Range of {
39            rangeInit : block,
40            param : var,
41            lo : var,
42            hi : var
43          }
44    
45        and strand = Strand of {
46          name : Atom.atom,          name : Atom.atom,
47          params : var list,          params : var list,
48          state : var list,          state : var list,
# Line 28  Line 50 
50          methods : method list          methods : method list
51        }        }
52    
53      and method = Method of Atom.atom * block      and method = Method of StrandUtil.method_name * block
54    
55      and block = Block of stmt list      and block = Block of stmt list
56    
57      and stmt      and stmt
58        = S_Assign of var * exp        = S_Var of var                            (* introduce an uninitialized local variable. *)
59                                                    (* These stmts are needed for the results of *)
60                                                    (* conditional expressions *)
61          | S_Assign of var * exp
62        | S_IfThenElse of var * block * block        | S_IfThenElse of var * block * block
63        | S_New of Atom.atom * var list        | S_New of Atom.atom * var list
64        | S_Die        | S_Die
65        | S_Stabilize        | S_Stabilize
66          | S_Print of var list
67    
68      and exp      and exp
69        = E_Var of var        = E_Var of var
# Line 45  Line 71 
71        | E_Tuple of var list        | E_Tuple of var list
72        | E_Apply of var * Types.meta_var list * var list * Types.ty        | E_Apply of var * Types.meta_var list * var list * Types.ty
73        | E_Cons of var list        | E_Cons of var list
74          | E_Slice of var * var option list * Types.ty     (* tensor slicing *)
75      and create = C_Create of {        | E_Input of Types.ty * string * string * var option
76          argInit : block,        | E_LoadImage of ImageInfo.info * var
         name : Atom.atom,  
         args : var list  
       }  
   
     and iter = I_Range of {  
         rangeInit : block,  
         param : var,  
         lo : var,  
         hi : var  
       }  
77    
78      fun typeOf (E_Var x) = Var.monoTypeOf x      fun typeOf (E_Var x) = Var.monoTypeOf x
79        | typeOf (E_Lit lit) = (case lit        | typeOf (E_Lit lit) = (case lit
# Line 78  Line 94 
94              (* end case *)              (* end case *)
95            end            end
96        | typeOf (E_Cons[]) = raise Fail "impossible empty E_Cons"        | typeOf (E_Cons[]) = raise Fail "impossible empty E_Cons"
97          | typeOf (E_Slice(_, _, ty)) = ty
98          | typeOf (E_Input(ty, _, _, _)) = ty
99          | typeOf (E_LoadImage(ImageInfo.ImgInfo{dim, ty=(dd, _), ...}, _)) =
100              Types.T_Image{
101                  dim = Types.DimConst dim,
102                  shape = Types.Shape(List.map Types.DimConst dd)
103                }
104    
105    end    end

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

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