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

SCM Repository

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

Diff of /trunk/src/compiler/IL/ssa-fn.sml

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

revision 319, Wed Aug 18 04:13:08 2010 UTC revision 341, Mon Sep 13 17:14:24 2010 UTC
# Line 201  Line 201 
201     *)     *)
202      val sortNodes : stmt -> node list      val sortNodes : stmt -> node list
203    
204      (* apply a function to all of the nodes in the graph rooted at the entry to the statement *)
205        val applyToNodes : (node -> unit) -> stmt -> unit
206    
207    end    end
208    
209  functor SSAFn (Op : OPERATORS) : SSA =  functor SSAFn (Op : OPERATORS) : SSA =
# Line 544  Line 547 
547              nodes              nodes
548            end            end
549    
550      (* apply a function to all of the nodes in the graph rooted at the entry to the statement *)
551        fun applyToNodes (f : node -> unit) stmt = let
552              val {getFn, setFn} = PropList.newFlag (fn (ND{props, ...}) => props)
553              fun dfs (nd, l) =
554                    if getFn nd
555                      then l
556                      else (
557                        f nd; (* visit *)
558                        setFn (nd, true);
559                        nd :: List.foldl dfs l (Node.succs nd))
560              val nodes = dfs (Stmt.entry stmt, [])
561              in
562                List.app (fn nd => setFn(nd, false)) nodes
563              end
564    
565    end    end

Legend:
Removed from v.319  
changed lines
  Added in v.341

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