Commit eb3a4961 authored by Christian Würdig's avatar Christian Würdig
Browse files

fixed endless loop

added cbc verifier
parent cb01034a
...@@ -365,11 +365,13 @@ static void debug_vcg_dump_kill(rss_t *rss) { ...@@ -365,11 +365,13 @@ static void debug_vcg_dump_kill(rss_t *rss) {
fprintf(f, "layoutalgorithm: mindepth\n"); fprintf(f, "layoutalgorithm: mindepth\n");
fprintf(f, "manhattan_edges: yes\n\n"); fprintf(f, "manhattan_edges: yes\n\n");
/* first: reset dumped flag of all nodes */ {
foreach_plist(rss->nodes, el) { /* reset dump_flag */
ir_node *irn = plist_element_get_value(el); ir_node *irn;
rss_irn_t *rirn = get_rss_irn(rss, irn); foreach_phase_irn(&rss->ph, irn) {
rirn->dumped = 0; rss_irn_t *node = get_rss_irn(rss, irn);
node->dumped = 0;
}
} }
/* dump all nodes and their killers */ /* dump all nodes and their killers */
...@@ -420,6 +422,15 @@ static void debug_vcg_dump_pkg(rss_t *rss, nodeset *max_ac, int iteration) { ...@@ -420,6 +422,15 @@ static void debug_vcg_dump_pkg(rss_t *rss, nodeset *max_ac, int iteration) {
fprintf(f, "layoutalgorithm: mindepth\n"); fprintf(f, "layoutalgorithm: mindepth\n");
fprintf(f, "manhattan_edges: yes\n\n"); fprintf(f, "manhattan_edges: yes\n\n");
{
/* reset dump_flag */
ir_node *irn;
foreach_phase_irn(&rss->ph, irn) {
rss_irn_t *node = get_rss_irn(rss, irn);
node->dumped = 0;
}
}
foreach_plist(rss->nodes, el) { foreach_plist(rss->nodes, el) {
ir_node *irn = plist_element_get_value(el); ir_node *irn = plist_element_get_value(el);
rss_irn_t *rirn = get_rss_irn(rss, irn); rss_irn_t *rirn = get_rss_irn(rss, irn);
...@@ -430,11 +441,13 @@ static void debug_vcg_dump_pkg(rss_t *rss, nodeset *max_ac, int iteration) { ...@@ -430,11 +441,13 @@ static void debug_vcg_dump_pkg(rss_t *rss, nodeset *max_ac, int iteration) {
if (max_ac && nodeset_find(max_ac, irn)) if (max_ac && nodeset_find(max_ac, irn))
c1 = "color:yellow"; c1 = "color:yellow";
if (rirn->chain) if (! rirn->dumped) {
ir_fprintf(f, "node: { title: \"n%d\" label: \"%+F c%d\" %s }\n", get_irn_node_nr(irn), irn, rirn->chain->nr, c1); if (rirn->chain)
else ir_fprintf(f, "node: { title: \"n%d\" label: \"%+F c%d\" %s }\n", get_irn_node_nr(irn), irn, rirn->chain->nr, c1);
ir_fprintf(f, "node: { title: \"n%d\" label: \"%+F\" %s }\n", get_irn_node_nr(irn), irn, c1); else
rirn->dumped = 1; ir_fprintf(f, "node: { title: \"n%d\" label: \"%+F\" %s }\n", get_irn_node_nr(irn), irn, c1);
rirn->dumped = 1;
}
foreach_plist(rirn->pkiller_list, k_el) { foreach_plist(rirn->pkiller_list, k_el) {
ir_node *pkiller = plist_element_get_value(k_el); ir_node *pkiller = plist_element_get_value(k_el);
...@@ -876,6 +889,7 @@ static void compute_bipartite_decomposition(rss_t *rss) { ...@@ -876,6 +889,7 @@ static void compute_bipartite_decomposition(rss_t *rss) {
rss_irn_t *u = get_rss_irn(rss, u_irn); rss_irn_t *u = get_rss_irn(rss, u_irn);
int p_change = 1; int p_change = 1;
int c_change = 1; int c_change = 1;
int vrfy_ok = 1;
cbc_t *cbc; cbc_t *cbc;
plist_element_t *el2; plist_element_t *el2;
...@@ -924,7 +938,7 @@ static void compute_bipartite_decomposition(rss_t *rss) { ...@@ -924,7 +938,7 @@ static void compute_bipartite_decomposition(rss_t *rss) {
if (k_edge->tgt == t_irn && ! nodeset_find(cbc->parents, val)) { if (k_edge->tgt == t_irn && ! nodeset_find(cbc->parents, val)) {
nodeset_insert(cbc->parents, val); nodeset_insert(cbc->parents, val);
p_change = 1; p_change = 1;
DBG((rss->dbg, LEVEL_3, "\t\t\t%+F added to parents\n", val)); DBG((rss->dbg, LEVEL_3, "\t\t\t%+F added to parents (killed by %+F)\n", val, t_irn));
} }
} }
} }
...@@ -937,7 +951,7 @@ static void compute_bipartite_decomposition(rss_t *rss) { ...@@ -937,7 +951,7 @@ static void compute_bipartite_decomposition(rss_t *rss) {
if (k_edge->src == s_irn && ! nodeset_find(cbc->children, val)) { if (k_edge->src == s_irn && ! nodeset_find(cbc->children, val)) {
nodeset_insert(cbc->children, val); nodeset_insert(cbc->children, val);
c_change = 1; c_change = 1;
DBG((rss->dbg, LEVEL_3, "\t\t\t%+F added to children\n", val)); DBG((rss->dbg, LEVEL_3, "\t\t\t%+F added to children (kills %+F)\n", val, s_irn));
} }
} }
} }
...@@ -948,10 +962,12 @@ static void compute_bipartite_decomposition(rss_t *rss) { ...@@ -948,10 +962,12 @@ static void compute_bipartite_decomposition(rss_t *rss) {
rss_irn_t *s = get_rss_irn(rss, s_irn); rss_irn_t *s = get_rss_irn(rss, s_irn);
s->visited = 1; s->visited = 1;
/* assure bipartite property */ /* assure bipartite property */
#if 0
if (nodeset_find(cbc->children, s_irn)) { if (nodeset_find(cbc->children, s_irn)) {
nodeset_remove(cbc->children, s_irn); nodeset_remove(cbc->children, s_irn);
DBG((rss->dbg, LEVEL_3, "\t\t\t%+F removed from to children\n", s_irn)); DBG((rss->dbg, LEVEL_3, "\t\t\t%+F removed from to children\n", s_irn));
} }
#endif
} }
/* update edges */ /* update edges */
...@@ -972,6 +988,25 @@ static void compute_bipartite_decomposition(rss_t *rss) { ...@@ -972,6 +988,25 @@ static void compute_bipartite_decomposition(rss_t *rss) {
pset_remove(epk, kedge_root, HASH_RSS_EDGE(kedge_root)); pset_remove(epk, kedge_root, HASH_RSS_EDGE(kedge_root));
} }
/* verify the cbc */
foreach_nodeset(cbc->parents, s_irn) {
int is_killed = 0;
foreach_pset(cbc->kill_edges, k_edge) {
if (k_edge->src == s_irn) {
is_killed = 1;
pset_break(cbc->kill_edges);
break;
}
}
if (! is_killed) {
vrfy_ok = 0;
ir_fprintf(stderr, "Warning: parent %+F is not killed in current cbc\n", s_irn);
}
}
assert(vrfy_ok && "Verification of CBC failed");
/* add the connected bipartite component */ /* add the connected bipartite component */
if (nodeset_count(cbc->parents) > 0 && nodeset_count(cbc->children) > 0 && pset_count(cbc->kill_edges) > 0) if (nodeset_count(cbc->parents) > 0 && nodeset_count(cbc->children) > 0 && pset_count(cbc->kill_edges) > 0)
pset_insert(rss->cbc_set, cbc, (unsigned)cbc->nr); pset_insert(rss->cbc_set, cbc, (unsigned)cbc->nr);
......
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