Commit 621c677f authored by Matthias Braun's avatar Matthias Braun
Browse files

Remove get_Block_cfgpred_pos(), introduce get_Block_cfg_out_ex() instead

parent 38609dc9
......@@ -215,17 +215,6 @@ FIRM_API void set_nodes_block(ir_node *node, ir_node *block);
* @{
*/
/**
* Returns the position of the predecessor block pred in the inputs
* of the block block.
*
* @param block the block
* @param pred a predecessor block of block
*
* @return the position of pred in block or -1
*/
FIRM_API int get_Block_cfgpred_pos(const ir_node *block, const ir_node *pred);
/**
* Returns the predecessor block.
*
......
......@@ -54,6 +54,10 @@ FIRM_API unsigned get_Block_n_cfg_outs_ka(const ir_node *node);
/** Access predecessor n, ignore keep-alives. */
FIRM_API ir_node *get_Block_cfg_out(const ir_node *node, unsigned pos);
/** Access predecessor n, ignore keep-alives also return its input position. */
FIRM_API ir_node *get_Block_cfg_out_ex(const ir_node *node, unsigned pos,
int *in_pos);
/** Access predecessor n, honor keep-alives. */
FIRM_API ir_node *get_Block_cfg_out_ka(const ir_node *node, unsigned pos);
......
......@@ -97,6 +97,24 @@ ir_node *get_Block_cfg_out(const ir_node *bl, unsigned pos)
return NULL;
}
ir_node *get_Block_cfg_out_ex(const ir_node *bl, unsigned pos, int *in_pos)
{
assert(is_Block(bl));
foreach_irn_out(bl, i, succ) {
if (get_irn_mode(succ) != mode_X)
continue;
if (is_End(succ) || is_Bad(succ))
continue;
unsigned n_outs = get_irn_n_outs(succ);
if (pos < n_outs)
return get_irn_out_ex(succ, pos, in_pos);
else
pos -= n_outs;
}
return NULL;
}
ir_node *get_Block_cfg_out_ka(const ir_node *bl, unsigned pos)
{
assert(is_Block(bl));
......
......@@ -422,15 +422,6 @@ void set_nodes_block(ir_node *node, ir_node *block)
set_irn_n(node, -1, block);
}
int get_Block_cfgpred_pos(const ir_node *block, const ir_node *pred)
{
for (int i = get_Block_n_cfgpreds(block); i-- > 0; ) {
if (get_Block_cfgpred_block(block, i) == pred)
return i;
}
return -1;
}
ir_node *(get_Block_cfgpred_block)(const ir_node *node, int pos)
{
return get_Block_cfgpred_block_(node, pos);
......
......@@ -941,8 +941,8 @@ static void compute_antic(ir_node *block, void *ctx)
/* successor might have phi nodes */
if (n_succ == 1 && get_irn_arity(get_Block_cfg_out(block, 0)) > 1) {
succ = get_Block_cfg_out(block, 0);
int pos = get_Block_cfgpred_pos(succ, block);
int pos;
succ = get_Block_cfg_out_ex(block, 0, &pos);
succ_info = get_block_info(succ);
/* initialize translated set */
......
......@@ -1140,11 +1140,11 @@ static int backward_antic(block_t *bl)
int n = get_Block_n_cfg_outs(block);
if (n == 1) {
ir_node *succ = get_Block_cfg_out(block, 0);
block_t *succ_bl = get_block_entry(succ);
int pred_pos = get_Block_cfgpred_pos(succ, block);
size_t end = env.rbs_size - 1;
size_t pos;
int pred_pos;
ir_node *succ = get_Block_cfg_out_ex(block, 0, &pred_pos);
block_t *succ_bl = get_block_entry(succ);
size_t end = env.rbs_size - 1;
size_t pos;
kill_all();
......
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