Project

General

Profile

Revision 812c0369

View differences:

src/causality.ml
526 526
    IdentDepGraph.iter_edges (fun s t -> IdentDepGraph.add_edge g1 s t) g2
527 527
  end
528 528

  
529
let world = "!!_world"
530

  
529 531
let add_external_dependency outputs mems g =
530
  let caller ="!!_world" in
531 532
  begin
532
    IdentDepGraph.add_vertex g caller;
533
    ISet.iter (fun o -> IdentDepGraph.add_edge g caller o) outputs;
534
    ISet.iter (fun m -> IdentDepGraph.add_edge g caller m) mems;
533
    IdentDepGraph.add_vertex g world;
534
    ISet.iter (fun o -> IdentDepGraph.add_edge g world o) outputs;
535
    ISet.iter (fun m -> IdentDepGraph.add_edge g world m) mems;
535 536
  end
536 537

  
537 538
let global_dependency node =
src/liveness.ml
81 81
    Disjunction.CISet.empty
82 82
    node.node_locals
83 83

  
84
let kill_instance_variables ctx inst =
85
  IdentDepGraph.remove_vertex ctx.dep_graph inst
86

  
84 87
let kill_root ctx head =
85 88
  IdentDepGraph.iter_succ (IdentDepGraph.remove_edge ctx.dep_graph head.var_id) ctx.dep_graph head.var_id
86 89

  
......
89 92
   - [evaluated] is the set of already evaluated variables,
90 93
     wrt the scheduling
91 94
   - does only remove edges, not variables themselves
95
   - yet, instance variables are removed
92 96
*)
93 97
let remove_roots ctx =
94 98
  let rem = ref true in
......
97 101
  do
98 102
    rem := false;
99 103
    let all_roots = graph_roots ctx.dep_graph in
100
    let frontier_roots = Disjunction.CISet.filter (fun v -> List.mem v.var_id all_roots) !remaining in
101
    if not (Disjunction.CISet.is_empty frontier_roots) then
104
    let inst_roots, var_roots = List.partition (fun v -> ExprDep.is_instance_var v && v <> Causality.world) all_roots in
105
    let frontier_roots = Disjunction.CISet.filter (fun v -> List.mem v.var_id var_roots) !remaining in
106
    if not (Disjunction.CISet.is_empty frontier_roots && inst_roots = []) then
102 107
      begin
103 108
	rem := true;
109
	List.iter (kill_instance_variables ctx) inst_roots;
104 110
	Disjunction.CISet.iter (kill_root ctx) frontier_roots;
105 111
	remaining := Disjunction.CISet.diff !remaining frontier_roots
106 112
      end

Also available in: Unified diff