Project

General

Profile

« Previous | Next » 

Revision d0b1ec56

Added by Xavier Thirioux over 10 years ago

- changed the basic optimization scheme (option -O 2), which unfolds
local variables and global variables that are either cheap to evaluate
or used no more than once.

git-svn-id: https://cavale.enseeiht.fr/svn/lustrec/lustre_compiler/trunk@339 041b043f-8d7c-46b2-b46e-ef0dd855326e

View differences:

src/liveness.ml
27 27
*)
28 28
let compute_fanin n g =
29 29
  let locals = ISet.diff (ExprDep.node_local_variables n) (ExprDep.node_memory_variables n) in
30
  let inputs = ExprDep.node_input_variables n in
30 31
  let fanin = Hashtbl.create 23 in
31 32
  begin
32
    IdentDepGraph.iter_vertex (fun v -> if ISet.mem v locals then Hashtbl.add fanin v (IdentDepGraph.in_degree g v)) g;
33
    IdentDepGraph.iter_vertex
34
      (fun v ->
35
	if ISet.mem v locals
36
	then Hashtbl.add fanin v (IdentDepGraph.in_degree g v) else
37
	if ExprDep.is_read_var v && not (ISet.mem v inputs)
38
	then Hashtbl.add fanin (ExprDep.undo_read_var v) (IdentDepGraph.in_degree g v)) g;
33 39
    fanin
34 40
  end
35 41
 

Also available in: Unified diff