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

SCM Repository

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

Diff of /branches/pure-cfg/src/compiler/IL/ssa-fn.sml

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

revision 1010, Fri Apr 29 03:45:50 2011 UTC revision 1011, Fri Apr 29 14:28:17 2011 UTC
# Line 122  Line 122 
122          body : cfg              (* method body *)          body : cfg              (* method body *)
123        }        }
124    
   
125    (* operations on CFGs *)    (* operations on CFGs *)
126      structure CFG : sig      structure CFG : sig
127        (* the empty CFG *)        (* the empty CFG *)
# Line 168  Line 167 
167          val hash : node -> word          val hash : node -> word
168          val toString : node -> string          val toString : node -> string
169          val isNULL : node -> bool          val isNULL : node -> bool
170          (* variable defs and uses; may include duplicates *)
171            val uses : node -> var list
172            val defs : node -> var list
173        (* dummy node *)        (* dummy node *)
174          val dummy : node          val dummy : node
175        (* CFG edges *)        (* CFG edges *)
# Line 436  Line 438 
438                  tag ^ Stamp.toString id                  tag ^ Stamp.toString id
439                end                end
440          fun new kind = ND{id = Stamp.new(), props = PropList.newHolder(), kind = kind}          fun new kind = ND{id = Stamp.new(), props = PropList.newHolder(), kind = kind}
441          (* variable defs and uses *)
442            fun uses (ND{kind, ...}) = (case kind
443                   of JOIN{phis, ...} => List.foldr (fn ((_, xs), ys) => xs@ys) [] (!phis)
444                    | COND{cond, ...} => [cond]
445                    | ASSIGN{stm=(y, rhs), ...} => (case rhs
446                         of VAR x => [x]
447                          | LIT _ => []
448                          | OP(_, args) => args
449                          | APPLY(_, args) => args
450                          | CONS(_, args) => args
451                        (* end case *))
452                    | NEW{args, ...} => args
453                    | EXIT{live, ...} => live
454                    | _ => []
455                  (* end case *))
456            fun defs (ND{kind, ...}) = (case kind
457                   of JOIN{phis, ...} => List.map #1 (!phis)
458                    | ASSIGN{stm=(y, _), ...} => [y]
459                    | _ => []
460                  (* end case *))
461          val dummy = new NULL          val dummy = new NULL
462          fun mkENTRY () = new (ENTRY{succ = ref dummy})          fun mkENTRY () = new (ENTRY{succ = ref dummy})
463          fun mkJOIN phis = new (JOIN{preds = ref [], phis = ref phis, succ = ref dummy})          fun mkJOIN phis = new (JOIN{preds = ref [], phis = ref phis, succ = ref dummy})

Legend:
Removed from v.1010  
changed lines
  Added in v.1011

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