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

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/compiler/tree-il/low-to-tree-fn.sml
ViewVC logotype

Diff of /branches/pure-cfg/src/compiler/tree-il/low-to-tree-fn.sml

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

revision 1047, Mon May 2 18:42:13 2011 UTC revision 1048, Mon May 2 20:00:02 2011 UTC
# Line 79  Line 79 
79      in      in
80      fun newEnv () = E{tbl = VT.mkTable (512, Fail "tbl"), locals=[]}      fun newEnv () = E{tbl = VT.mkTable (512, Fail "tbl"), locals=[]}
81    
     fun newScope (E{tbl, ...}) = E{tbl=tbl, locals=[]}  
   
82    (* use a variable.  If it is a pending expression, we remove it from the table *)    (* use a variable.  If it is a pending expression, we remove it from the table *)
83      fun useVar (E{tbl, ...}) x = (case VT.find tbl x      fun useVar (E{tbl, ...}) x = (case VT.find tbl x
84             of SOME(GLOB x') => T.E_Var x'             of SOME(GLOB x') => T.E_Var x'
# Line 134  Line 132 
132            (* end case *))            (* end case *))
133    
134    (* set the definition of a variable, where the RHS is either a literal constant or a variable *)    (* set the definition of a variable, where the RHS is either a literal constant or a variable *)
135      fun setDef (env as E{tbl, ...}, lhs, rhs) = (      fun bindSimple (env as E{tbl, ...}, lhs, rhs) = (
136            case peekGlobal (env, lhs)            case peekGlobal (env, lhs)
137             of SOME x => (env, [T.S_Assign(x, rhs)])             of SOME x => (env, [T.S_Assign(x, rhs)])
138              | NONE => (VT.insert tbl (lhs, DEF rhs); (env, []))              | NONE => (VT.insert tbl (lhs, DEF rhs); (env, []))
# Line 216  Line 214 
214                  end                  end
215            in            in
216              case rhs              case rhs
217               of IL.VAR x => setDef (env, lhs, useVar env x)               of IL.VAR x => bindSimple (env, lhs, useVar env x)
218                | IL.LIT lit => setDef (env, lhs, T.E_Lit lit)                | IL.LIT lit => bindSimple (env, lhs, T.E_Lit lit)
219                | IL.OP(Op.LoadImage info, [a]) => let                | IL.OP(Op.LoadImage info, [a]) => let
220                    val (env, t) = doLHS()                    val (env, t) = doLHS()
221                    in                    in

Legend:
Removed from v.1047  
changed lines
  Added in v.1048

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