Commit 7cd2dbf3 authored by Michael Beck's avatar Michael Beck
Browse files

- get_Block_cfgpred_arr() IS supported, but should not be in the official

  interface
- get_Block_cfgpred_pos() added and used
- more doxygen docu

[r25718]
parent 6f9ad780
......@@ -334,11 +334,28 @@ ir_type *is_frame_pointer(const ir_node *n);
* from Start. If so returns tls type, else Null. */
ir_type *is_tls_pointer(const ir_node *n);
/* @@@ no more supported */
ir_node **get_Block_cfgpred_arr(ir_node *node);
int get_Block_n_cfgpreds(const ir_node *node);
ir_node *get_Block_cfgpred(const ir_node *node, int pos);
void set_Block_cfgpred(ir_node *node, int pos, ir_node *pred);
/** Return the number of control flow predecessors of a block. */
int get_Block_n_cfgpreds(const ir_node *block);
/** Return the control flow predecessor of a block at a given position. */
ir_node *get_Block_cfgpred(const ir_node *block, int pos);
/** Set the control flow predecessor of a block at a given position. */
void set_Block_cfgpred(ir_node *block, int pos, ir_node *pred);
/**
* Return 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
*
* @note When using the old extended basic block form for blocks
* with exception exists, a predecessor block might have more
* than one position. In that case it is not specified, with is returned.
*/
int get_Block_cfgpred_pos(const ir_node *block, const ir_node *pred);
/** Get the predecessor block.
*
* Returns the block corresponding to the predecessor pos of block.
......@@ -351,13 +368,16 @@ void set_Block_cfgpred(ir_node *node, int pos, ir_node *pred);
* Start block, but the Bad node.
*/
ir_node *get_Block_cfgpred_block(const ir_node *node, int pos);
int get_Block_matured(const ir_node *node);
void set_Block_matured(ir_node *node, int matured);
/** Return the matured flag of a block */
int get_Block_matured(const ir_node *block);
/** set the matured flag of a block. */
void set_Block_matured(ir_node *block, int matured);
/** A visited flag only for block nodes.
* @see also: get_irn_visited() inc_irg_visited() inc_irg_block_visited()*/
ir_visited_t get_Block_block_visited(const ir_node *node);
void set_Block_block_visited(ir_node *node, ir_visited_t visit);
ir_visited_t get_Block_block_visited(const ir_node *block);
void set_Block_block_visited(ir_node *block, ir_visited_t visit);
/**
* Marks a block as dead but do not replace it with a Bad node.
......
......@@ -636,10 +636,6 @@ ir_type *is_tls_pointer(const ir_node *n) {
return NULL;
}
/* Returns an array with the predecessors of the Block. Depending on
the implementation of the graph data structure this can be a copy of
the internal representation of predecessors as well as the internal
array itself. Therefore writing to this array might obstruct the ir. */
ir_node **get_Block_cfgpred_arr(ir_node *node) {
assert(is_Block(node));
return (ir_node **)&(get_irn_in(node)[1]);
......@@ -658,6 +654,16 @@ void set_Block_cfgpred(ir_node *node, int pos, ir_node *pred) {
set_irn_n(node, pos, pred);
}
int get_Block_cfgpred_pos(const ir_node *block, const ir_node *pred) {
int i;
for (i = get_Block_n_cfgpreds(block) - 1; i >= 0; --i) {
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);
}
......
......@@ -99,6 +99,14 @@ ir_op_ops *firm_set_default_get_type_attr(ir_opcode code, ir_op_ops *ops);
*/
ir_op_ops *firm_set_default_get_entity_attr(ir_opcode code, ir_op_ops *ops);
/**
* Returns an array with the predecessors of the Block. Depending on
* the implementation of the graph data structure this can be a copy of
* the internal representation of predecessors as well as the internal
* array itself. Therefore writing to this array might obstruct the IR.
*/
ir_node **get_Block_cfgpred_arr(ir_node *node);
/*-------------------------------------------------------------------*/
/* These function are most used in libfirm. Give them as static */
/* functions so they can be inlined. */
......
......@@ -454,16 +454,11 @@ static void compute_antic(ir_node *block, void *ctx) {
n_succ = get_Block_n_cfg_outs(block);
if (n_succ == 1) {
int i, pos = -1;
int pos = -1;
/* find blocks position in succ's block predecessors */
succ = get_Block_cfg_out(block, 0);
for (i = get_Block_n_cfgpreds(succ) - 1; i >= 0; --i) {
if (get_Block_cfgpred_block(succ, i) == block) {
pos = i;
break;
}
}
pos = get_Block_cfgpred_pos(succ, block);
assert(pos >= 0);
succ_info = get_block_info(succ);
......
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