Commit 0cef5937 authored by Michael Beck's avatar Michael Beck
Browse files

is_Return, is_Call and is_Sel implemented

[r7389]
parent 9e5fa4a2
......@@ -226,6 +226,7 @@ void
set_irn_in (ir_node *node, int arity, ir_node **in) {
int i;
ir_node *** arr;
ir_graph *irg = current_ir_graph;
assert(node);
if (get_interprocedural_view()) { /* handle Filter and Block specially */
if (get_irn_opcode(node) == iro_Filter) {
......@@ -242,20 +243,20 @@ set_irn_in (ir_node *node, int arity, ir_node **in) {
for (i = 0; i < arity; i++) {
if (i < ARR_LEN(*arr)-1)
edges_notify_edge(node, i, in[i], (*arr)[i+1], current_ir_graph);
edges_notify_edge(node, i, in[i], (*arr)[i+1], irg);
else
edges_notify_edge(node, i, in[i], NULL, current_ir_graph);
edges_notify_edge(node, i, in[i], NULL, irg);
}
for(;i < ARR_LEN(*arr)-1; i++) {
edges_notify_edge(node, i, NULL, (*arr)[i+1], current_ir_graph);
edges_notify_edge(node, i, NULL, (*arr)[i+1], irg);
}
if (arity != ARR_LEN(*arr) - 1) {
ir_node * block = (*arr)[0];
*arr = NEW_ARR_D(ir_node *, current_ir_graph->obst, arity + 1);
*arr = NEW_ARR_D(ir_node *, irg->obst, arity + 1);
(*arr)[0] = block;
}
fix_backedges(current_ir_graph->obst, node);
fix_backedges(irg->obst, node);
memcpy((*arr) + 1, in, sizeof(ir_node *) * arity);
}
......@@ -1788,7 +1789,7 @@ ir_type *get_Proj_type(ir_node *n)
case iro_Call: break;
case iro_Load: {
ir_node *a = get_Load_ptr(pred);
if (get_irn_op(a) == op_Sel)
if (is_Sel(a))
tp = get_entity_type(get_Sel_entity(a));
} break;
default:
......@@ -2313,12 +2314,30 @@ int
return _is_Block(node);
}
/* returns true if node is a Unknown node. */
/* returns true if node is an Unknown node. */
int
(is_Unknown)(const ir_node *node) {
return _is_Unknown(node);
}
/* returns true if node is a Return node. */
int
(is_Return)(const ir_node *node) {
return _is_Return(node);
}
/* returns true if node is a Call node. */
int
(is_Call)(const ir_node *node) {
return _is_Call(node);
}
/* returns true if node is a Sel node. */
int
(is_Sel)(const ir_node *node) {
return _is_Sel(node);
}
int
is_Proj (const ir_node *node) {
assert(node);
......
......@@ -1029,8 +1029,14 @@ int is_Bad (const ir_node *node);
int is_no_Block (const ir_node *node);
/** returns true if the node is a Block */
int is_Block (const ir_node *node);
/** returns true if node is a Unknown node. */
/** returns true if node is an Unknown node. */
int is_Unknown (const ir_node *node);
/** returns true if node is a Return node. */
int is_Return (const ir_node *node);
/** returns true if node is a Call node. */
int is_Call (const ir_node *node);
/** returns true if node is a Sel node. */
int is_Sel (const ir_node *node);
/** returns true if node is a Proj node or a Filter node in
* intraprocedural view */
int is_Proj (const ir_node *node);
......
......@@ -268,8 +268,12 @@ struct ir_node {
};
/** Returns the array with the ins. The content of the array may not be
changed. */
/**
* Returns the array with the ins. The content of the array may not be
* changed.
* Note that this function returns the whole in array including the
* block predecessor. So, it is NOT symmetric with set_irn_in().
*/
ir_node **get_irn_in (const ir_node *node);
/** @{ */
......@@ -600,6 +604,24 @@ _is_Unknown (const ir_node *node) {
return (node && _get_irn_op(node) == op_Unknown);
}
static INLINE int
_is_Return (const ir_node *node) {
assert(node);
return (node && _get_irn_op(node) == op_Return);
}
static INLINE int
_is_Call (const ir_node *node) {
assert(node);
return (node && _get_irn_op(node) == op_Call);
}
static INLINE int
_is_Sel (const ir_node *node) {
assert(node);
return (node && _get_irn_op(node) == op_Sel);
}
static INLINE int
_is_no_Block(const ir_node *node) {
assert(node && _is_ir_node(node));
......@@ -766,6 +788,9 @@ static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) {
#define is_binop(node) _is_binop(node)
#define is_Const(node) _is_Const(node)
#define is_Unknown(node) _is_Unknown(node)
#define is_Return(node) _is_Return(node)
#define is_Call(node) _is_Call(node)
#define is_Sel(node) _is_Sel(node)
#define is_Bad(node) _is_Bad(node)
#define is_no_Block(node) _is_no_Block(node)
#define is_Block(node) _is_Block(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