Commit 9c123448 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ir: Change get_irn_in() so it returns the first operand, not the block, at index 0.

Except for two users, all users add 1 immediately anyway.
Of the two exceptions one of them (in kill_unused_stacknodes()) is wrong, so this is now corrected.
The other one is exchange(), which now just uses ->in, which is fine, since it handles node interna anyway.
parent a7320c55
......@@ -1139,7 +1139,7 @@ void be_spill_prepare_for_constraints(ir_graph *irg)
if (be_is_CopyKeep(cp) && get_irn_n_edges(cp) < 1) {
int arity = get_irn_arity(cp);
ir_node *block = get_nodes_block(cp);
ir_node *keep = be_new_Keep(block, arity, get_irn_in(cp) + 1);
ir_node *keep = be_new_Keep(block, arity, get_irn_in(cp));
sched_replace(cp, keep);
/* Set all ins (including the block) of the CopyKeep BAD to keep the verifier happy. */
......
......@@ -61,7 +61,7 @@ ir_node *be_transform_phi(ir_node *node, const arch_register_req_t *req)
/* phi nodes allow loops, so we use the old arguments for now
* and fix this later */
ir_node **ins = get_irn_in(node)+1;
ir_node **ins = get_irn_in(node);
int arity = get_irn_arity(node);
ir_mode *mode = req->cls->mode;
ir_node *phi = new_ir_node(dbgi, irg, block, op_Phi, mode, arity, ins);
......
......@@ -74,7 +74,7 @@ void exchange(ir_node *old, ir_node *nw)
}
if (is_irn_dynamic(old))
DEL_ARR_F(get_irn_in(old));
DEL_ARR_F(old->in);
old->op = op_Id;
old->in = NEW_ARR_D(ir_node*, get_irg_obstack(irg), 2);
......
......@@ -330,12 +330,11 @@ static inline int is_Id_(const ir_node *node);
/**
* Returns the array with the ins. The content of the array must not be
* changed.
* Note that this function returns the whole in array including the
* block predecessor. So, it is NOT symmetric to set_irn_in().
* This is symmetric to set_irn_in().
*/
static inline ir_node **get_irn_in(ir_node const *const node)
{
return node->in;
return node->in + 1;
}
/*-------------------------------------------------------------------*/
......
......@@ -54,7 +54,7 @@ ir_node *irn_copy_into_irg(const ir_node *node, ir_graph *irg)
ir_node *block = op != op_Block ? get_nodes_block(node) : NULL;
dbg_info *dbgi = get_irn_dbg_info(node);
ir_mode *mode = get_irn_mode(node);
ir_node **ins = get_irn_in(node) + 1;
ir_node **ins = get_irn_in(node);
int arity = get_irn_arity(node);
ir_node *res = new_ir_node(dbgi, irg, block, op, mode, arity, ins);
......
......@@ -7771,7 +7771,7 @@ void ir_normalize_node(ir_node *n)
}
if (!ins_sorted) {
ir_node **ins = get_irn_in(n)+1;
ir_node **ins = get_irn_in(n);
ir_node **new_ins = XMALLOCN(ir_node*, arity);
MEMCPY(new_ins, ins, arity);
QSORT(new_ins, arity, cmp_node_nr);
......
......@@ -2093,7 +2093,7 @@ static void combine_memop(ir_node *sync, void *data)
unsigned machine_size = be_get_machine_size();
int n_preds = get_Sync_n_preds(sync);
ir_node **new_in = ALLOCAN(ir_node*, n_preds);
MEMCPY(new_in, get_irn_in(sync) + 1, n_preds);
MEMCPY(new_in, get_irn_in(sync), n_preds);
QSORT(new_in, n_preds, cmp_ptrs);
......
......@@ -153,7 +153,7 @@ static void copy_irn_to_irg(ir_node *n, ir_graph *irg)
get_irn_op(n),
get_irn_mode(n),
get_irn_arity(n),
get_irn_in(n) + 1);
get_irn_in(n));
/* Copy the attributes. These might point to additional data. If this
......
......@@ -77,7 +77,7 @@ static inline void set_{{node.name}}_{{node.input_name}}_(ir_node *node, int pos
static inline ir_node **get_{{node.name}}_{{node.input_name}}_arr_(ir_node *node)
{
assert(is_{{node.name}}(node));
return get_irn_in(node) + 1{% if node.ins %}+ (n_{{node.name}}_max + 1){% endif %};
return get_irn_in(node){% if node.ins %} + (n_{{node.name}}_max + 1){% endif %};
}
{% endif -%}
{% endfor -%}
......
Markdown is supported
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