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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/low-to-tree/env.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/low-to-tree/env.sml

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

revision 3947, Sat Jun 11 03:16:00 2016 UTC revision 3948, Sat Jun 11 14:34:55 2016 UTC
# Line 9  Line 9 
9  structure Env : sig  structure Env : sig
10    
11    (* the translated bindings of LowIR variables.  If the variable has a vector type,    (* the translated bindings of LowIR variables.  If the variable has a vector type,
12     * then it is bound to a vector of expression trees, otherwise it is bound to a     * then it is bound to a vector of expression trees, otherwise it is bound to
13     * single tree.     * either a RHS (if the expression is not inlinable) or TREE (if the expression can
14       * be a subexpression).
15     *)     *)
16      datatype binding      datatype binding
17        = TREE of TreeIR.exp         (* variable bound to a target expression tree *)        = RHS of TreeTypes.t * TreeIR.exp                 (* non-inlinable tree expression *)
18        | VEC of TreeTypes.vec_layout * TreeIR.exp list        | TREE of TreeIR.exp                              (* inlinable tree expression *)
19          | VEC of TreeTypes.vec_layout * TreeIR.exp list   (* composite of vector expressions *)
20    
21      type t      type t
22    
# Line 34  Line 36 
36    
37    (* set the definition of a variable, where the RHS is a simple expression that can be    (* set the definition of a variable, where the RHS is a simple expression that can be
38     * replicated without code-size or performance hit (e.g., a literal or variable).     * replicated without code-size or performance hit (e.g., a literal or variable).
39       * It will be wrapped in a TREE binding.
40     *)     *)
41      val bindSimple : t * LowIR.var * binding -> unit      val bindSimple : t * LowIR.var * TreeIR.exp -> unit
42    
43    (* at the end of a block, we need to assign any pending expressions to locals.  The    (* at the end of a block, we need to assign any pending expressions to locals.  The
44     * blkStms list and the resulting statement list are in reverse order.     * blkStms list and the resulting statement list are in reverse order.
# Line 47  Line 50 
50      structure VT = LowIR.Var.Tbl      structure VT = LowIR.Var.Tbl
51    
52      datatype binding      datatype binding
53        = TREE of TreeIR.exp        = RHS of TreeTypes.t * TreeIR.exp                 (* non-inlinable tree expression *)
54        | VEC of TreeTypes.vec_layout * TreeIR.exp list        | TREE of TreeIR.exp                              (* inlinable tree expression *)
55          | VEC of TreeTypes.vec_layout * TreeIR.exp list   (* composite of vector expressions *)
56    
57    (*DEBUG*)
58        fun bindingToString (RHS(ty, e)) =
59              concat["RHS(", TreeTypes.toString ty, ", ", TreePP.expToString e, ")"]
60          | bindingToString (TREE e) =
61              concat["TREE(", TreePP.expToString e, ")"]
62          | bindingToString (VEC(layout, _)) = concat["VEC(", TreeTypes.layoutToString layout, ", _)"]
63    (*DEBUG*)
64    
65      datatype t = E of {      datatype t = E of {
66          tbl : (bool * binding) VT.hash_table,          tbl : (bool * binding) VT.hash_table,
# Line 92  Line 104 
104    
105      fun bindVar (E{tbl, ...}, x, b) = VT.insert tbl (x, (false, b))      fun bindVar (E{tbl, ...}, x, b) = VT.insert tbl (x, (false, b))
106    
107      fun bindSimple (E{tbl, ...}, x, b) = VT.insert tbl (x, (true, b))      fun bindSimple (E{tbl, ...}, x, b) = VT.insert tbl (x, (true, TREE b))
108    
109      fun flushPending (E{tbl, ...}, blkStms) = let      fun flushPending (E{tbl, ...}, blkStms) = let
110            fun doVar (x, (false, TREE e), stms) = let            fun doVar (x, (false, TREE e), stms) = let

Legend:
Removed from v.3947  
changed lines
  Added in v.3948

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