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

added new function to determine the predecessor position of node for a given predecessor

[r7715]
parent 07a53d99
......@@ -564,6 +564,15 @@ unsigned (get_irn_idx)(const ir_node *node) {
return _get_irn_idx(node);
}
int get_irn_pred_pos(ir_node *node, ir_node *arg) {
int i;
for (i = get_irn_arity(node) - 1; i >= 0; i--) {
if (get_irn_n(node, i) == arg)
return i;
}
return -1;
}
/** manipulate fields of individual nodes **/
/* this works for all except Block */
......
......@@ -132,6 +132,8 @@ opcode get_irn_opcode (const ir_node *node);
const char *get_irn_opname (const ir_node *node);
/** Get the ident for a string representation of the opcode. */
ident *get_irn_opident (const ir_node *node);
/** If arg is an argument of the node, returns it's position, -1 otherwise */
int get_irn_pred_pos (ir_node *node, ir_node *arg);
/** Gets the visited counter of a node. */
unsigned long get_irn_visited (const ir_node *node);
/** Sets the visited counter of a node. */
......
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