/* some constants fixing the positions of nodes predecessors
in the in array */
-#define CALL_PARAM_OFFSET 2
-#define BUILDIN_PARAM_OFFSET 1
-#define SEL_INDEX_OFFSET 2
-#define RETURN_RESULT_OFFSET 1 /* mem is not a result */
+#define CALL_PARAM_OFFSET (n_Call_max+1)
+#define BUILTIN_PARAM_OFFSET (n_Builtin_max+1)
+#define SEL_INDEX_OFFSET (n_Sel_max+1)
+#define RETURN_RESULT_OFFSET (n_Return_max+1)
#define END_KEEPALIVE_OFFSET 0
static const char *relation_names [] = {
ir_node **get_Builtin_param_arr(ir_node *node)
{
assert(is_Builtin(node));
- return &get_irn_in(node)[BUILDIN_PARAM_OFFSET + 1];
+ return &get_irn_in(node)[BUILTIN_PARAM_OFFSET + 1];
}
int get_Builtin_n_params(const ir_node *node)
{
assert(is_Builtin(node));
- return (get_irn_arity(node) - BUILDIN_PARAM_OFFSET);
+ return (get_irn_arity(node) - BUILTIN_PARAM_OFFSET);
}
ir_node *get_Builtin_param(const ir_node *node, int pos)
{
assert(is_Builtin(node));
- return get_irn_n(node, pos + BUILDIN_PARAM_OFFSET);
+ return get_irn_n(node, pos + BUILTIN_PARAM_OFFSET);
}
void set_Builtin_param(ir_node *node, int pos, ir_node *param)
{
assert(is_Builtin(node));
- set_irn_n(node, pos + BUILDIN_PARAM_OFFSET, param);
+ set_irn_n(node, pos + BUILTIN_PARAM_OFFSET, param);
}
/* Returns a human readable string for the ir_builtin_kind. */
node->attr.call.callee_arr = NULL;
}
-/*
- * Returns non-zero if a Call is surely a self-recursive Call.
- * Beware: if this functions returns 0, the call might be self-recursive!
- */
-int is_self_recursive_Call(const ir_node *call)
-{
- const ir_node *callee = get_Call_ptr(call);
-
- if (is_SymConst_addr_ent(callee)) {
- const ir_entity *ent = get_SymConst_entity(callee);
- const ir_graph *irg = get_entity_irg(ent);
- if (irg == get_irn_irg(call))
- return 1;
- }
- return 0;
-}
-
/* Checks for upcast.
*
* Returns true if the Cast node casts a class type to a super type.
return get_Proj_proj(node) == pred->op->pn_x_regular;
}
+void ir_set_throws_exception(ir_node *node, int throws_exception)
+{
+ except_attr *attr = &node->attr.except;
+ assert(is_fragile_op(node));
+ attr->throws_exception = throws_exception;
+}
+
+int ir_throws_exception(const ir_node *node)
+{
+ const except_attr *attr = &node->attr.except;
+ assert(is_fragile_op(node));
+ return attr->throws_exception;
+}
+
ir_node **get_Tuple_preds_arr(ir_node *node)
{
assert(is_Tuple(node));
/* Returns true if the operation manipulates control flow. */
int is_cfop(const ir_node *node)
{
+ if (is_fragile_op(node) && ir_throws_exception(node))
+ return true;
+
return is_op_cfopcode(get_irn_op(node));
}