Commit 59d977a8 authored by Matthias Braun's avatar Matthias Braun
Browse files

add remove_End_n, rename del_Sync_n to remove_Sync_n

parent b49d4ae9
......@@ -302,6 +302,9 @@ FIRM_API void set_End_keepalives(ir_node *end, int n, ir_node *in[]);
/** Removes irn from the keep-alive set. */
FIRM_API void remove_End_keepalive(ir_node *end, ir_node *irn);
/** Removes predecessor (a keepalive) at index @p idx from End node @p end. */
FIRM_API void remove_End_n(ir_node *end, int idx);
/** Removes Bads, NoMem and doublets from the keep-alive set. */
FIRM_API void remove_End_Bads_and_doublets(ir_node *end);
......@@ -497,8 +500,8 @@ FIRM_API void set_memop_mem(ir_node *node, ir_node *mem);
/** Adds @p pred to predecessor list of Sync node @p node. */
FIRM_API void add_Sync_pred(ir_node *node, ir_node *pred);
/** Removes predecessor i from Sync n */
FIRM_API void del_Sync_n(ir_node *n, int i);
/** Removes predecessor @p i from Sync @p n */
FIRM_API void remove_Sync_n(ir_node *n, int i);
/** @} */
......
......@@ -227,7 +227,7 @@ int add_irn_n(ir_node *node, ir_node *in)
return pos;
}
static void del_irn_n(ir_node *node, int n)
static void remove_irn_n(ir_node *node, int n)
{
ir_graph *irg = get_irn_irg(node);
......@@ -249,9 +249,9 @@ static void del_irn_n(ir_node *node, int n)
clear_irg_properties(irg, IR_GRAPH_PROPERTY_CONSISTENT_OUTS);
}
void del_Sync_n(ir_node *n, int i)
void remove_Sync_n(ir_node *n, int i)
{
del_irn_n(n, i);
remove_irn_n(n, i);
}
int (get_irn_deps)(const ir_node *node)
......@@ -576,6 +576,11 @@ void set_End_keepalives(ir_node *end, int n, ir_node *in[])
clear_irg_properties(irg, IR_GRAPH_PROPERTY_CONSISTENT_OUTS);
}
void remove_End_n(ir_node *n, int idx)
{
remove_irn_n(n, idx);
}
void remove_End_keepalive(ir_node *end, ir_node *irn)
{
int n = get_End_n_keepalives(end);
......@@ -593,7 +598,7 @@ void remove_End_keepalive(ir_node *end, ir_node *irn)
}
}
assert(idx != -1);
del_irn_n(end, idx);
remove_irn_n(end, idx);
}
void remove_End_Bads_and_doublets(ir_node *end)
......@@ -614,7 +619,7 @@ void remove_End_Bads_and_doublets(ir_node *end)
if (is_Bad(ka) || is_NoMem(ka) || pset_new_contains(&keeps, ka)) {
changed = true;
del_irn_n(end, idx - END_KEEPALIVE_OFFSET);
remove_irn_n(end, idx - END_KEEPALIVE_OFFSET);
--n;
} else {
pset_new_insert(&keeps, ka);
......
......@@ -5759,7 +5759,7 @@ static ir_node *transform_node_Sync(ir_node *n)
/* Remove Bad predecessors */
if (is_Bad(pred)) {
del_Sync_n(n, i);
remove_Sync_n(n, i);
--arity;
continue;
}
......@@ -5767,7 +5767,7 @@ static ir_node *transform_node_Sync(ir_node *n)
/* Remove duplicate predecessors */
for (j = 0; j < i; ++j) {
if (get_Sync_pred(n, j) == pred) {
del_Sync_n(n, i);
remove_Sync_n(n, i);
--arity;
break;
}
......@@ -5780,7 +5780,7 @@ static ir_node *transform_node_Sync(ir_node *n)
continue;
}
del_Sync_n(n, i);
remove_Sync_n(n, i);
--arity;
pred_arity = get_Sync_n_preds(pred);
......
......@@ -22,35 +22,29 @@
*/
static void exchange_tuple_projs(ir_node *node, void *env)
{
ir_node *pred;
int proj;
(void)env;
if (!is_Proj(node))
return;
if (!is_Proj(node)) return;
ir_node *pred = get_Proj_pred(node);
if (!is_Tuple(pred))
return;
pred = get_Proj_pred(node);
proj = get_Proj_proj(node);
if (!is_Tuple(pred)) return;
pred = get_Tuple_pred(pred, proj);
exchange(node, pred);
int pn = get_Proj_proj(node);
ir_node *tuple_pred = get_Tuple_pred(pred, pn);
exchange(node, tuple_pred);
}
void remove_tuples(ir_graph *irg)
{
irg_walk_graph(irg, exchange_tuple_projs, NULL, NULL);
ir_node *end = get_irg_end(irg);
int n_keepalives = get_End_n_keepalives(end);
int i;
for (i = n_keepalives - 1; i >= 0; --i) {
/* remove Tuples only held by keep-alive edges */
ir_node *end = get_irg_end(irg);
for (int i = get_End_n_keepalives(end); i-- > 0; ) {
ir_node *irn = get_End_keepalive(end, i);
if (is_Tuple(irn)) {
remove_End_keepalive(end, irn);
}
if (is_Tuple(irn))
remove_End_n(end, i);
}
add_irg_properties(irg, IR_GRAPH_PROPERTY_NO_TUPLES);
......
Markdown is supported
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