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

SCM Repository

[diderot] Diff of /branches/charisee/src/compiler/IL/value-numbering-fn.sml
ViewVC logotype

Diff of /branches/charisee/src/compiler/IL/value-numbering-fn.sml

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

trunk/src/compiler/IL/value-numbering-fn.sml revision 1788, Tue Apr 3 13:25:57 2012 UTC branches/charisee/src/compiler/IL/value-numbering-fn.sml revision 2377, Mon Jun 3 19:41:56 2013 UTC
# Line 73  Line 73 
73                  decUse x; incUse x';                  decUse x; incUse x';
74                  x')                  x')
75            end            end
76    (* does a variable change? *)    (* does a variable change; i.e., get replaced by another variable? *)
77      fun changed x = not(IL.Var.same(x, getVN x))      fun changed x = not(IL.Var.same(x, getVN x))
78    (* clear the properties of a variable *)    (* clear the properties of a variable *)
79      fun clearVar x = (clrVN x; clrExp x)      fun clearVar x = (clrVN x; clrExp x)
# Line 102  Line 102 
102                          else ()                          else ()
103                    | IL.ASSIGN{stm=(y, rhs), succ, ...} =>                    | IL.ASSIGN{stm=(y, rhs), succ, ...} =>
104                        if changed y                        if changed y
105                          then IL.CFG.deleteNode nd (* deleting redundant assignment *)                          then (
106                            (* deleting redundant assignment *)
107                              IL.RHS.app decUse rhs;
108                              IL.CFG.deleteNode nd)
109                        else if (List.exists changed (IL.RHS.vars rhs))                        else if (List.exists changed (IL.RHS.vars rhs))
110                        (* rewrite node to rename variables *)                        (* rewrite node to rename variables *)
111                          then IL.CFG.replaceNode(nd, IL.Node.mkASSIGN(y, IL.RHS.map rename rhs))                          then IL.CFG.replaceNode(nd, IL.Node.mkASSIGN(y, IL.RHS.map rename rhs))
# Line 114  Line 117 
117                          else ()                          else ()
118                    | IL.MASSIGN{stm=(ys, rator, xs), succ, ...} =>                    | IL.MASSIGN{stm=(ys, rator, xs), succ, ...} =>
119                        if List.all changed ys                        if List.all changed ys
120                          then IL.CFG.deleteNode nd (* deleting redundant assignment *)                          then (
121                            (* deleting redundant assignment *)
122                              List.app decUse xs;
123                              IL.CFG.deleteNode nd)
124                        else if (List.exists changed xs)                        else if (List.exists changed xs)
125                        (* rewrite node to rename variables *)                        (* rewrite node to rename variables *)
126                          then IL.CFG.replaceNode(nd, IL.Node.mkMASSIGN(ys, rator, List.map rename xs))                          then IL.CFG.replaceNode(nd, IL.Node.mkMASSIGN(ys, rator, List.map rename xs))
# Line 314  Line 320 
320                          in                          in
321                            List.map (fn (x, lo, hi) => (x, renameVar lo, renameVar hi)) iters                            List.map (fn (x, lo, hi) => (x, renameVar lo, renameVar hi)) iters
322                          end                          end
323                    (* add the iteration variables to the live list *)
324                      val live = List.foldl (fn ((x, _, _), lv) => x::lv) live iters
325                  (* process the body *)                  (* process the body *)
326                    val (cfg, strand, args) = create                    val (cfg, strand, args) = create
327                    val {cfg, rename} = transformCFG' (live, rename, cfg)                    val {cfg, rename} = transformCFG' (live, rename, cfg)

Legend:
Removed from v.1788  
changed lines
  Added in v.2377

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