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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/cfg-ir/dom-tree-fn.sml
ViewVC logotype

Diff of /branches/vis15/src/compiler/cfg-ir/dom-tree-fn.sml

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

revision 3619, Wed Jan 27 23:06:26 2016 UTC revision 3620, Fri Jan 29 15:22:43 2016 UTC
# Line 23  Line 23 
23    (* cleanup the node properties used to store information about the tree *)    (* cleanup the node properties used to store information about the tree *)
24      val clear : IR.cfg -> unit      val clear : IR.cfg -> unit
25    
26      (* print the tree (for debugging purposes) *)
27        val printTree : TextIO.outstream * IR.cfg -> unit
28    
29    end    end
30    
31  functor DomTreeFn (IR : SSA) : DOMINANCE_TREE = struct  functor DomTreeFn (IR : SSA) : DOMINANCE_TREE = struct
# Line 132  Line 135 
135    (* cleanup the node properties used to store information about the tree *)    (* cleanup the node properties used to store information about the tree *)
136      fun clear cfg = IR.CFG.apply clrJoin cfg      fun clear cfg = IR.CFG.apply clrJoin cfg
137    
138      (* print the tree (for debugging purposes) *)
139        fun printTree (outS, root) = let
140              val {getFn, setFn} = Nd.newFlag()  (* for blackholing *)
141              fun pr s = TextIO.output(outS, s)
142              fun prIndent [] = ()
143                | prIndent (s::r) = (prIndent r; pr s)
144              fun prTree (indent, nd) = if getFn nd
145                    then pr(Nd.toString nd ^ " !!!!! LOOP IN TREE !!!!!\n")
146                    else (
147                      pr(Nd.toString nd ^ "\n");
148                      setFn (nd, true);
149                      prKids (indent, children nd);
150                      setFn (nd, false))
151              and prKids (_, []) = ()
152                | prKids (indent, [kid]) = (
153                    prIndent ("┗>" :: indent);
154                    prTree ("  " :: indent, kid))
155                | prKids (indent, kid::kids) = (
156                    prIndent ("┗>" :: indent);
157                    prTree ("| "  :: indent, kid);
158                    prKids (indent, kids))
159              in
160                prTree ([], IR.CFG.entry root)
161              end
162    
163    end    end

Legend:
Removed from v.3619  
changed lines
  Added in v.3620

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