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 510, Tue Feb 8 16:12:38 2011 UTC revision 511, Tue Feb 8 17:01:43 2011 UTC
# Line 42  Line 42 
42              body : assign list ref,              body : assign list ref,
43              succ : node ref              succ : node ref
44            }            }
45        | NEW of {        | NEW of {                        (* create new strand instance *)
46              pred : node ref,              pred : node ref,
47              actor : Atom.atom,              strand : Atom.atom,
48              args : var list,              args : var list,
49              succ : node ref              succ : node ref
50            }            }
# Line 107  Line 107 
107      datatype program = Program of {      datatype program = Program of {
108          globals : var list,          globals : var list,
109          globalInit : stmt,          globalInit : stmt,
110          actors : actor list          strands : strand list
111          (* initialization *)          (* initialization *)
112        }        }
113    
114      and actor = Actor of {      and strand = Strand of {
115          name : Atom.atom,          name : Atom.atom,
116          params : var list,          params : var list,
117          state : var list,          state : var list,
# Line 127  Line 127 
127        }        }
128    
129      structure Node : sig      structure Node : sig
130            val id : node -> Stamp.stamp
131            val kind : node -> node_kind
132          val same : node * node -> bool          val same : node * node -> bool
133          val compare : node * node -> order          val compare : node * node -> order
134          val hash : node -> word          val hash : node -> word
# Line 134  Line 136 
136        (* dummy node *)        (* dummy node *)
137          val dummy : node          val dummy : node
138        (* CFG edges *)        (* CFG edges *)
139            val hasPred : node -> bool
140          val preds : node -> node list          val preds : node -> node list
141          val setPred : node * node -> unit          val setPred : node * node -> unit
142          val hasSucc : node -> bool          val hasSucc : node -> bool
# Line 147  Line 150 
150          val mkJOIN : (var * var list) list -> node          val mkJOIN : (var * var list) list -> node
151          val mkCOND : {cond : var, trueBranch : node, falseBranch : node} -> node          val mkCOND : {cond : var, trueBranch : node, falseBranch : node} -> node
152          val mkBLOCK : assign list -> node          val mkBLOCK : assign list -> node
153          val mkNEW : {actor : Atom.atom, args : var list} -> node          val mkNEW : {strand : Atom.atom, args : var list} -> node
154          val mkDIE : unit -> node          val mkDIE : unit -> node
155          val mkSTABILIZE : unit -> node          val mkSTABILIZE : unit -> node
156          val mkEXIT : unit -> node          val mkEXIT : unit -> node
# Line 277  Line 280 
280              body : assign list ref,              body : assign list ref,
281              succ : node ref              succ : node ref
282            }            }
283        | NEW of {        | NEW of {                        (* create new strand instance *)
284              pred : node ref,              pred : node ref,
285              actor : Atom.atom,              strand : Atom.atom,
286              args : var list,              args : var list,
287              succ : node ref              succ : node ref
288            }            }
# Line 342  Line 345 
345      datatype program = Program of {      datatype program = Program of {
346          globals : var list,          globals : var list,
347          globalInit : stmt,          globalInit : stmt,
348          actors : actor list          strands : strand list
349          (* initialization *)          (* initialization *)
350        }        }
351    
352      and actor = Actor of {      and strand = Strand of {
353          name : Atom.atom,          name : Atom.atom,
354          params : var list,          params : var list,
355          state : var list,          state : var list,
# Line 363  Line 366 
366    
367      structure Node =      structure Node =
368        struct        struct
369            fun id (ND{id, ...}) = id
370            fun kind (ND{kind, ...}) = kind
371          fun same (ND{id=a, ...}, ND{id=b, ...}) = Stamp.same(a, b)          fun same (ND{id=a, ...}, ND{id=b, ...}) = Stamp.same(a, b)
372          fun compare (ND{id=a, ...}, ND{id=b, ...}) = Stamp.compare(a, b)          fun compare (ND{id=a, ...}, ND{id=b, ...}) = Stamp.compare(a, b)
373          fun hash (ND{id, ...}) = Stamp.hash id          fun hash (ND{id, ...}) = Stamp.hash id
# Line 390  Line 395 
395                  trueBranch = ref trueBranch, falseBranch = ref falseBranch                  trueBranch = ref trueBranch, falseBranch = ref falseBranch
396                })                })
397          fun mkBLOCK body = new (BLOCK{pred = ref dummy, body = ref body, succ = ref dummy})          fun mkBLOCK body = new (BLOCK{pred = ref dummy, body = ref body, succ = ref dummy})
398          fun mkNEW {actor, args} = new (NEW{          fun mkNEW {strand, args} = new (NEW{
399                  pred = ref dummy, actor = actor, args = args, succ = ref dummy                  pred = ref dummy, strand = strand, args = args, succ = ref dummy
400                })                })
401          fun mkDIE () = new (DIE{pred = ref dummy})          fun mkDIE () = new (DIE{pred = ref dummy})
402          fun mkSTABILIZE () = new (STABILIZE{pred = ref dummy})          fun mkSTABILIZE () = new (STABILIZE{pred = ref dummy})
403          fun mkEXIT () = new (EXIT{pred = ref dummy})          fun mkEXIT () = new (EXIT{pred = ref dummy})
404        (* editing node edges *)        (* editing node edges *)
405            fun hasPred (ND{kind, ...}) = (case kind
406                   of NULL => false
407                    | ENTRY _ => false
408                    | _ => true
409                  (* end case *))
410          fun setPred (nd0 as ND{kind, ...}, nd) = (case kind          fun setPred (nd0 as ND{kind, ...}, nd) = (case kind
411                 of NULL => raise Fail("setPred on NULL node "^toString nd0)                 of NULL => raise Fail("setPred on NULL node "^toString nd0)
412                  | ENTRY _ => raise Fail("setPred on ENTRY node "^toString nd0)                  | ENTRY _ => raise Fail("setPred on ENTRY node "^toString nd0)
# Line 532  Line 542 
542                  new (S_IF{cond = cond, thenBranch = thenBranch, elseBranch = elseBranch}, next)                  new (S_IF{cond = cond, thenBranch = thenBranch, elseBranch = elseBranch}, next)
543                end                end
544          fun mkBLOCK (body, next) = new (S_SIMPLE(Node.mkBLOCK body), next)          fun mkBLOCK (body, next) = new (S_SIMPLE(Node.mkBLOCK body), next)
545          fun mkNEW (actor, args, next) = new (S_SIMPLE(Node.mkNEW{actor=actor, args=args}), next)          fun mkNEW (strand, args, next) = new (S_SIMPLE(Node.mkNEW{strand=strand, args=args}), next)
546          fun mkDIE () = new (S_SIMPLE(Node.mkDIE ()), NONE)          fun mkDIE () = new (S_SIMPLE(Node.mkDIE ()), NONE)
547          fun mkSTABILIZE () = new (S_SIMPLE(Node.mkSTABILIZE ()), NONE)          fun mkSTABILIZE () = new (S_SIMPLE(Node.mkSTABILIZE ()), NONE)
548          fun mkEXIT () = new (S_SIMPLE(Node.mkEXIT ()), NONE)          fun mkEXIT () = new (S_SIMPLE(Node.mkEXIT ()), NONE)

Legend:
Removed from v.510  
changed lines
  Added in v.511

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