X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fir%2Firnode.c;h=5b71b6386f4c36d9104b5930d55c41a5cef6afa7;hb=c86cca5071eb546f462a6d21c3088892526f460c;hp=53bed2eb6596fedb127f9b02eedf19e0b184085f;hpb=99f23ed8dfa68ab6d96a4080e1d83fc8d4d68dd2;p=libfirm diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 53bed2eb6..5b71b6386 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 [] = { @@ -253,8 +253,7 @@ void set_irn_in(ir_node *node, int arity, ir_node **in) memcpy((*pOld_in) + 1, in, sizeof(ir_node *) * arity); /* update irg flags */ - set_irg_outs_inconsistent(irg); - set_irg_loopinfo_inconsistent(irg); + clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS | IR_GRAPH_STATE_CONSISTENT_LOOPINFO); } ir_node *(get_irn_n)(const ir_node *node, int n) @@ -279,8 +278,7 @@ void set_irn_n(ir_node *node, int n, ir_node *in) node->in[n + 1] = in; /* update irg flags */ - set_irg_outs_inconsistent(irg); - set_irg_loopinfo_inconsistent(irg); + clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS | IR_GRAPH_STATE_CONSISTENT_LOOPINFO); } int add_irn_n(ir_node *node, ir_node *in) @@ -727,7 +725,7 @@ void set_End_keepalives(ir_node *end, int n, ir_node *in[]) } /* update irg flags */ - set_irg_outs_inconsistent(irg); + clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS); } /* Set new keep-alives from old keep-alives, skipping irn */ @@ -765,7 +763,7 @@ found: ARR_RESIZE(ir_node *, end->in, (n - 1) + 1 + END_KEEPALIVE_OFFSET); /* update irg flags */ - set_irg_outs_inconsistent(irg); + clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS); } /* remove Bads, NoMems and doublets from the keep-alive set */ @@ -808,7 +806,7 @@ void remove_End_Bads_and_doublets(ir_node *end) pset_new_destroy(&keeps); if (changed) { - set_irg_outs_inconsistent(irg); + clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_OUTS); } } @@ -989,25 +987,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 +1069,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 +1306,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 +1519,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)); } @@ -1711,18 +1709,6 @@ dbg_info *(get_irn_dbg_info)(const ir_node *n) return _get_irn_dbg_info(n); } -/* checks whether a node represents a global address */ -int is_Global(const ir_node *node) -{ - return is_SymConst_addr_ent(node); -} - -/* returns the entity of a global address */ -ir_entity *get_Global_entity(const ir_node *node) -{ - return get_SymConst_entity(node); -} - /* * Calculate a hash value of a node. */ @@ -1749,7 +1735,7 @@ unsigned firm_default_hash(const ir_node *node) h = 9*h + HASH_PTR(get_irn_op(node)); return h; -} /* firm_default_hash */ +} /* include generated code */ #include "gen_irnode.c.inl"