projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added phi handler
[libfirm]
/
ir
/
be
/
becopyopt.c
diff --git
a/ir/be/becopyopt.c
b/ir/be/becopyopt.c
index
3526c17
..
431743e
100644
(file)
--- a/
ir/be/becopyopt.c
+++ b/
ir/be/becopyopt.c
@@
-76,7
+76,7
@@
void free_copy_opt(copy_opt_t *co) {
int co_is_optimizable_root(const copy_opt_t *co, ir_node *irn) {
arch_register_req_t req;
int co_is_optimizable_root(const copy_opt_t *co, ir_node *irn) {
arch_register_req_t req;
- if (arch_irn_is
_ignore(co->aenv, irn
))
+ if (arch_irn_is
(co->aenv, irn, ignore
))
return 0;
if (is_Reg_Phi(irn) || is_Perm_Proj(co->aenv, irn) || is_2addr_code(co->aenv, irn, &req))
return 0;
if (is_Reg_Phi(irn) || is_Perm_Proj(co->aenv, irn) || is_2addr_code(co->aenv, irn, &req))
@@
-88,7
+88,9
@@
int co_is_optimizable_root(const copy_opt_t *co, ir_node *irn) {
int co_is_optimizable_arg(const copy_opt_t *co, ir_node *irn) {
const ir_edge_t *edge;
int co_is_optimizable_arg(const copy_opt_t *co, ir_node *irn) {
const ir_edge_t *edge;
- if (arch_irn_is_ignore(co->aenv, irn))
+ assert(0 && "Is buggy and obsolete. Do not use");
+
+ if (arch_irn_is(co->aenv, irn, ignore))
return 0;
foreach_out_edge(irn, edge) {
return 0;
foreach_out_edge(irn, edge) {
@@
-419,22
+421,22
@@
int co_get_lower_bound(const copy_opt_t *co) {
|_| |___/
******************************************************************************/
|_| |___/
******************************************************************************/
-static int compare_
node
_t(const void *k1, const void *k2, size_t size) {
- const
node
_t *n1 = k1;
- const
node
_t *n2 = k2;
+static int compare_
affinity
_t(const void *k1, const void *k2, size_t size) {
+ const
affinity
_t *n1 = k1;
+ const
affinity
_t *n2 = k2;
return (n1->irn != n2->irn);
}
static void add_edge(copy_opt_t *co, ir_node *n1, ir_node *n2, int costs) {
return (n1->irn != n2->irn);
}
static void add_edge(copy_opt_t *co, ir_node *n1, ir_node *n2, int costs) {
-
node
_t new_node, *node;
+
affinity
_t new_node, *node;
neighb_t new_nbr, *nbr;
int allocnew;
new_node.irn = n1;
new_node.count = 0;
new_node.neighbours = NULL;
neighb_t new_nbr, *nbr;
int allocnew;
new_node.irn = n1;
new_node.count = 0;
new_node.neighbours = NULL;
- node = set_insert(co->nodes,
new_node.irn
, sizeof(new_node), HASH_PTR(new_node.irn));
+ node = set_insert(co->nodes,
&new_node
, sizeof(new_node), HASH_PTR(new_node.irn));
allocnew = 1;
for (nbr = node->neighbours; nbr; nbr = nbr->next)
allocnew = 1;
for (nbr = node->neighbours; nbr; nbr = nbr->next)
@@
-470,7
+472,7
@@
static void build_graph_walker(ir_node *irn, void *env) {
int pos, max;
arch_register_req_t req;
int pos, max;
arch_register_req_t req;
- if (!is_curr_reg_class(co, irn) || arch_irn_is
_ignore(co->aenv, irn
))
+ if (!is_curr_reg_class(co, irn) || arch_irn_is
(co->aenv, irn, ignore
))
return;
/* Phis */
return;
/* Phis */
@@
-493,7
+495,7
@@
static void build_graph_walker(ir_node *irn, void *env) {
void co_build_graph_structure(copy_opt_t *co) {
obstack_init(&co->obst);
void co_build_graph_structure(copy_opt_t *co) {
obstack_init(&co->obst);
- co->nodes = new_set(compare_
node
_t, 32);
+ co->nodes = new_set(compare_
affinity
_t, 32);
irg_walk_graph(co->irg, build_graph_walker, NULL, co);
}
irg_walk_graph(co->irg, build_graph_walker, NULL, co);
}
@@
-506,8
+508,12
@@
void co_free_graph_structure(copy_opt_t *co) {
/* co_solve_ilp1() co_solve_ilp2() are implemented in becopyilpX.c */
int co_gs_is_optimizable(copy_opt_t *co, ir_node *irn) {
/* co_solve_ilp1() co_solve_ilp2() are implemented in becopyilpX.c */
int co_gs_is_optimizable(copy_opt_t *co, ir_node *irn) {
-
node_t new_node
;
+
affinity_t new_node, *n
;
- new_node.irn = irn;
- return (int)set_find(co->nodes, new_node.irn, sizeof(new_node), HASH_PTR(new_node.irn));
+ new_node.irn = irn;
+ n = set_find(co->nodes, &new_node, sizeof(new_node), HASH_PTR(new_node.irn));
+ if (n) {
+ return (n->count > 0);
+ } else
+ return 0;
}
}