Fixed a bug.
[libfirm] / ir / be / bephiopt.c
1 /**
2  * @author Daniel Grund
3  * @date 04.01.2005
4  */
5
6 #include "pset.h"
7 #include "irnode.h"
8 #include "irgwalk.h"
9
10 #include "bephiopt.h"
11 #include "bephicongr_t.h"
12 #include "bephicoal_t.h"
13
14 pset *all_phi_nodes = NULL;
15
16
17 static void phi_node_walker(ir_node *node, void *env) {
18         if (is_Phi(node) && mode_is_datab(get_irn_mode(node)))
19                 pset_insert_ptr(all_phi_nodes, node);
20 }
21
22
23 void be_phi_opt(ir_graph* irg) {
24         all_phi_nodes = pset_new_ptr(64);
25         irg_walk_graph(irg, phi_node_walker, NULL, NULL);
26
27         be_phi_congr_classes(all_phi_nodes);
28         be_phi_coalesce_locals(all_phi_classes);
29 }
30
31
32 void be_phi_opt_init(void) {
33         be_phi_congr_class_init();
34         be_phi_coal_init();
35 }