Commit 5505939f authored by Christoph Mallon's avatar Christoph Mallon
Browse files

beifg: Remove be_ifg_connected(), which is just a wrapper for be_values_interfere().

parent 4e0288d4
......@@ -79,12 +79,8 @@ static pset *pinned_global; /**< optimized nodes should not be altered any more
static inline int nodes_interfere(const be_chordal_env_t *env, const ir_node *a, const ir_node *b)
{
if (env->ifg)
return be_ifg_connected(env->ifg, a, b);
else {
be_lv_t *lv = be_get_irg_liveness(env->irg);
return be_values_interfere(lv, a, b);
}
be_lv_t *const lv = be_get_irg_liveness(env->irg);
return be_values_interfere(lv, a, b);
}
static int set_cmp_conflict_t(const void *x, const void *y, size_t size)
......
......@@ -17,6 +17,8 @@
#include <stdlib.h>
#include <limits.h>
#include "beintlive_t.h"
#include "beirg.h"
#include "list.h"
#include "pdeq.h"
#include "bitset.h"
......@@ -749,7 +751,6 @@ static int coalesce_top_down(co2_cloud_irn_t *ci, int child_nr, int depth)
static void populate_cloud(co2_t *env, co2_cloud_t *cloud, affinity_node_t *a, int curr_costs)
{
be_ifg_t *ifg = env->co->cenv->ifg;
co2_cloud_irn_t *ci = get_co2_cloud_irn(env, a->irn);
int costs = 0;
......@@ -763,10 +764,11 @@ static void populate_cloud(co2_t *env, co2_cloud_t *cloud, affinity_node_t *a, i
DB((env->dbg, LEVEL_2, "\t%+F\n", ci->inh.irn));
/* determine the nodes costs */
be_lv_t *const lv = be_get_irg_liveness(env->co->irg);
co_gs_foreach_neighb(a, n) {
costs += n->costs;
DB((env->dbg, LEVEL_3, "\t\tneigh %+F cost %d\n", n->irn, n->costs));
if (be_ifg_connected(ifg, a->irn, n->irn))
if (be_values_interfere(lv, a->irn, n->irn))
cloud->inevit += n->costs;
}
......
......@@ -14,6 +14,8 @@
#include <stdbool.h>
#include "be_t.h"
#include "beintlive_t.h"
#include "beirg.h"
#include "irtools.h"
#include "irprintf.h"
......@@ -106,10 +108,13 @@ static inline bool sr_is_simplicial(size_red_t *sr, const ir_node *ifn)
all[size++] = curr;
/* check if these form a clique */
for (i=0; i<size; ++i)
for (o=i+1; o<size; ++o)
if (!be_ifg_connected(ifg, all[i], all[o]))
be_lv_t *const lv = be_get_irg_liveness(sr->co->irg);
for (i = 0; i < size; ++i) {
for (o = i + 1; o < size; ++o) {
if (!be_values_interfere(lv, all[i], all[o]))
return false;
}
}
/* all edges exist so this is a clique */
return true;
......
......@@ -32,6 +32,8 @@
#include "config.h"
#include "be_t.h"
#include "beintlive_t.h"
#include "beirg.h"
#include "bitset.h"
#include "error.h"
#include "raw_bitset.h"
......@@ -338,6 +340,7 @@ static inline void remove_edge(set *edges, ir_node *n1, ir_node *n2, size_t *cou
static void build_clique_star_cstr(ilp_env_t *ienv)
{
/* for each node with affinity edges */
be_lv_t *const lv = be_get_irg_liveness(ienv->co->irg);
co_gs_foreach_aff_node(ienv->co, aff) {
struct obstack ob;
const ir_node *center = aff->irn;
......@@ -366,7 +369,7 @@ static void build_clique_star_cstr(ilp_env_t *ienv)
n_edges = 0;
for (i=0; i<n_nodes; ++i) {
for (o=0; o<i; ++o) {
if (be_ifg_connected(ienv->co->cenv->ifg, nodes[i], nodes[o]))
if (be_values_interfere(lv, nodes[i], nodes[o]))
add_edge(edges, nodes[i], nodes[o], &n_edges);
}
}
......@@ -449,7 +452,6 @@ static void build_clique_star_cstr(ilp_env_t *ienv)
static void extend_path(ilp_env_t *ienv, pdeq *path, const ir_node *irn)
{
be_ifg_t *ifg = ienv->co->cenv->ifg;
int i, len;
ir_node **curr_path;
affinity_node_t *aff;
......@@ -469,13 +471,14 @@ static void extend_path(ilp_env_t *ienv, pdeq *path, const ir_node *irn)
curr_path = ALLOCAN(ir_node*, len);
pdeq_copyl(path, (const void **)curr_path);
be_lv_t *const lv = be_get_irg_liveness(ienv->co->irg);
for (i=1; i<len; ++i) {
if (be_ifg_connected(ifg, irn, curr_path[i]))
if (be_values_interfere(lv, irn, curr_path[i]))
goto end;
}
/* check for terminating interference */
if (be_ifg_connected(ifg, irn, curr_path[0])) {
if (be_values_interfere(lv, irn, curr_path[0])) {
/* One node is not a path. */
/* And a path of length 2 is covered by a clique star constraint. */
if (len > 2) {
......
......@@ -169,12 +169,8 @@ void be_init_copynone(void)
static int nodes_interfere(const be_chordal_env_t *env, const ir_node *a, const ir_node *b)
{
if (env->ifg)
return be_ifg_connected(env->ifg, a, b);
else {
be_lv_t *lv = be_get_irg_liveness(env->irg);
return be_values_interfere(lv, a, b);
}
be_lv_t *const lv = be_get_irg_liveness(env->irg);
return be_values_interfere(lv, a, b);
}
......@@ -778,7 +774,8 @@ static void add_edge(copy_opt_t *co, ir_node *n1, ir_node *n2, int costs)
static inline void add_edges(copy_opt_t *co, ir_node *n1, ir_node *n2, int costs)
{
if (! be_ifg_connected(co->cenv->ifg, n1, n2)) {
be_lv_t *const lv = be_get_irg_liveness(co->irg);
if (!be_values_interfere(lv, n1, n2)) {
add_edge(co, n1, n2, costs);
add_edge(co, n2, n1, costs);
}
......
......@@ -37,12 +37,6 @@ void be_ifg_free(be_ifg_t *self)
free(self);
}
int be_ifg_connected(const be_ifg_t *ifg, const ir_node *a, const ir_node *b)
{
be_lv_t *lv = be_get_irg_liveness(ifg->env->irg);
return be_values_interfere(lv, a, b);
}
static void nodes_walker(ir_node *bl, void *data)
{
nodes_iter_t *it = (nodes_iter_t*)data;
......
......@@ -48,8 +48,6 @@ typedef struct cliques_iter_t {
} cliques_iter_t;
void be_ifg_free(be_ifg_t *ifg);
int be_ifg_connected(const be_ifg_t *ifg, const ir_node *a,
const ir_node *b);
ir_node *be_ifg_neighbours_begin(const be_ifg_t *ifg, neighbours_iter_t *iter,
const ir_node *irn);
ir_node *be_ifg_neighbours_next(neighbours_iter_t *iter);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment