Commit 574d27a8 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ir: Use get_block().

parent f0679e61
......@@ -174,8 +174,8 @@ int block_strictly_dominates(const ir_node *a, const ir_node *b)
ir_node *node_smallest_common_dominator(ir_node *a, ir_node *b)
{
ir_node *bl_a = is_Block(a) ? a : get_nodes_block(a);
ir_node *bl_b = is_Block(b) ? b : get_nodes_block(b);
ir_node *bl_a = get_block(a);
ir_node *bl_b = get_block(b);
ir_node *dom_bl = NULL;
/* Check if block of a dominates block of b */
......
......@@ -715,7 +715,7 @@ static bool is_loop_variant(ir_loop *l, ir_loop *b)
int is_loop_invariant(const ir_node *n, const ir_node *block)
{
ir_loop *l = get_irn_loop(block);
const ir_node *b = is_Block(n) ? n : get_nodes_block(n);
ir_loop *const l = get_irn_loop(block);
ir_node const *const b = get_block_const(n);
return !is_loop_variant(l, get_irn_loop(b));
}
......@@ -47,8 +47,8 @@ static bool changed;
static ir_node *default_remat(ir_node *node, ir_node *after)
{
ir_node *block = is_Block(after) ? after : get_nodes_block(after);
ir_node *copy = exact_copy(node);
ir_node *const block = get_block(after);
ir_node *const copy = exact_copy(node);
set_nodes_block(copy, block);
sched_add_after(after, copy);
return copy;
......
......@@ -574,12 +574,7 @@ ir_node *ia32_turn_back_am(ir_node *node)
static ir_node *flags_remat(ir_node *node, ir_node *after)
{
/* we should turn back address modes when rematerializing nodes */
ir_node *block;
if (is_Block(after)) {
block = after;
} else {
block = get_nodes_block(after);
}
ir_node *const block = get_block(after);
ia32_op_type_t type = get_ia32_op_type(node);
switch (type) {
......
......@@ -143,7 +143,7 @@ static int firm_emit(lc_appendable_t *app, const lc_arg_occ_t *occ,
ir_node *node = (ir_node*)X;
switch (occ->conversion) {
case 'B': {
ir_node *block = !is_Block(node) ? get_nodes_block(node) : node;
ir_node *const block = get_block(node);
snprintf(buf, sizeof(buf), "%s%s %s", A("irn"),
get_irn_opname(block), get_mode_name(get_irn_mode(block)));
snprintf(add, sizeof(add), "[%ld]", get_irn_node_nr(block));
......
......@@ -69,8 +69,7 @@ void exchange(ir_node *old, ir_node *nw)
ir_node *block = old->in[0];
if (block == NULL) {
block = is_Block(nw) ? nw : get_nodes_block(nw);
block = get_block(nw);
if (block == NULL) {
panic("cannot find legal block for id");
}
......
......@@ -287,8 +287,8 @@ static void irg_block_walk_2(ir_node *node, irg_walk_func *pre,
void irg_block_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post,
void *env)
{
ir_graph *irg = get_irn_irg(node);
ir_node *block = is_Block(node) ? node : get_nodes_block(node);
ir_graph *const irg = get_irn_irg(node);
ir_node *const block = get_block(node);
hook_irg_block_walk(irg, node, (generic_func *)pre, (generic_func *)post);
......
......@@ -6349,12 +6349,11 @@ static ir_node *transform_node_End(ir_node *n)
for (int i = j = 0; i < n_keepalives; ++i) {
ir_node *ka = get_End_keepalive(n, i);
ir_node *block;
/* no need to keep Bad */
if (is_Bad(ka))
continue;
/* do not keep unreachable code */
block = is_Block(ka) ? ka : get_nodes_block(ka);
ir_node *const block = get_block(ka);
if (is_block_unreachable(block))
continue;
in[j++] = ka;
......
......@@ -77,8 +77,8 @@ static bool remove_unreachable_keeps(ir_graph *irg)
ir_node **new_in = XMALLOCN(ir_node*, arity);
int new_arity = 0;
for (int i = 0; i < arity; ++i) {
ir_node *ka = get_End_keepalive(end, i);
ir_node *block = is_Block(ka) ? ka : get_nodes_block(ka);
ir_node *const ka = get_End_keepalive(end, i);
ir_node *const block = get_block(ka);
if (is_block_unreachable(block))
continue;
new_in[new_arity++] = ka;
......
......@@ -3163,16 +3163,8 @@ static void apply_end(ir_node *end, environment_t *env)
if (is_Bad(ka))
continue;
ir_node *block;
if (!is_Block(ka)) {
block = get_nodes_block(ka);
if (is_Bad(block))
continue;
} else {
block = ka;
}
node_t *node = get_irn_node(block);
ir_node *const block = get_block(ka);
node_t *const node = get_irn_node(block);
if (is_reachable(node))
in[j++] = ka;
}
......
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