Commit 27ce5101 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ir: Let get_irg_anchor() just return the anchor instead of its operands.

This also renders get_irg_n_anchors() obsolete, so remove it.
parent 91dab317
......@@ -259,8 +259,7 @@ static void count_outs(ir_graph *irg)
{
inc_irg_visited(irg);
count_outs_node(get_irg_end(irg));
for (int i = anchor_first; i <= anchor_last; ++i) {
ir_node *n = get_irg_anchor(irg, i);
foreach_irn_in(get_irg_anchor(irg), i, n) {
if (irn_visited_else_mark(n))
continue;
n->o.n_outs = 0;
......@@ -300,8 +299,7 @@ static void set_out_edges(ir_graph *irg)
inc_irg_visited(irg);
set_out_edges_node(get_irg_end(irg), obst);
for (int i = anchor_first; i <= anchor_last; ++i) {
ir_node *n = get_irg_anchor(irg, i);
foreach_irn_in(get_irg_anchor(irg), i, n) {
if (irn_visited_else_mark(n))
continue;
n->o.out = OALLOCF(obst, ir_def_use_edges, edges, 0);
......
......@@ -314,9 +314,8 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform)
/* Pre-transform all anchors (so they are available in the other transform
* functions) and put them into the worklist. */
for (size_t i = 0, n = get_irg_n_anchors(irg); i != n; ++i) {
ir_node *const old = get_irn_n(old_anchor, i);
ir_node *const nw = be_transform_node(old);
foreach_irn_in(old_anchor, i, old) {
ir_node *const nw = be_transform_node(old);
set_irn_n(new_anchor, i, nw);
}
......@@ -331,9 +330,8 @@ static void transform_nodes(ir_graph *irg, arch_pretrans_nodes *pre_transform)
/* fix loops and set new anchors*/
inc_irg_visited(irg);
for (int i = get_irg_n_anchors(irg) - 1; i >= 0; --i) {
ir_node *anchor = get_irn_n(old_anchor, i);
anchor = (ir_node*)get_irn_link(anchor);
foreach_irn_in_r(old_anchor, i, n) {
ir_node *const anchor = (ir_node*)get_irn_link(n);
fix_loops(anchor);
}
......
......@@ -386,19 +386,11 @@ static inline ir_node *get_idx_irn_(const ir_graph *irg, unsigned idx)
}
/**
* Return the number of anchors in this graph.
* Get the anchor.
*/
static inline int get_irg_n_anchors(const ir_graph *irg)
static inline ir_node *get_irg_anchor(ir_graph const *const irg)
{
return get_irn_arity(irg->anchor);
}
/**
* Return anchor for given index
*/
static inline ir_node *get_irg_anchor(const ir_graph *irg, int idx)
{
return get_irn_n(irg->anchor, idx);
return irg->anchor;
}
#endif
......@@ -2125,10 +2125,8 @@ static void read_graph(read_env_t *env, ir_graph *irg)
}
set_irn_in(dp->node, dp->n_preds, ins);
if (is_Anchor(dp->node)) {
for (irg_anchors a = anchor_first; a <= anchor_last; ++a) {
ir_node *old_anchor = get_irg_anchor(irg, a);
ir_node *new_anchor = ins[a];
exchange(old_anchor, new_anchor);
foreach_irn_in(get_irg_anchor(irg), a, old) {
exchange(old, ins[a]);
}
}
next_delayed_pred: ;
......
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