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

SCM Repository

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

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

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

revision 1902, Fri Jun 1 21:26:53 2012 UTC revision 2356, Sun Apr 7 14:45:25 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))

Legend:
Removed from v.1902  
changed lines
  Added in v.2356

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