X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firnode.c;h=9086fcfef0dc75269d5c4535dfbe505592d7a6d9;hb=1f66492dac45f1a1cf49ac16ee43894814e2cbf0;hp=53bed2eb6596fedb127f9b02eedf19e0b184085f;hpb=99f23ed8dfa68ab6d96a4080e1d83fc8d4d68dd2;p=libfirm diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 53bed2eb6..9086fcfef 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -49,10 +49,10 @@ /* 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 [] = { @@ -989,25 +989,25 @@ void set_Call_param(ir_node *node, int pos, ir_node *param) 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. */ @@ -1071,23 +1071,6 @@ void remove_Call_callee_arr(ir_node *node) 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. @@ -1325,7 +1308,21 @@ int is_x_regular_Proj(const ir_node *node) pred = get_Proj_pred(node); if (!is_fragile_op(pred)) return false; - return get_Proj_proj(node) == pred->op->pn_x_except; + 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) @@ -1524,6 +1521,9 @@ int (is_SymConst_addr_ent)(const ir_node *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)); }