Commit 2f4d2b16 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Reduce code duplication.

parent 4d2ff733
......@@ -1562,8 +1562,8 @@ void be_gas_emit_entity(const ir_entity *entity)
void be_gas_emit_block_name(const ir_node *block)
{
if (get_Block_entity(block) != NULL) {
ir_entity *entity = get_Block_entity(block);
ir_entity *entity = get_Block_entity(block);
if (entity != NULL) {
be_gas_emit_entity(entity);
} else {
be_emit_irprintf("%s%ld", be_gas_get_private_prefix(), get_irn_node_nr(block));
......
......@@ -145,13 +145,16 @@ static int blocks_removed;
*/
static void remove_empty_block(ir_node *block)
{
const ir_edge_t *edge, *next;
int i, arity;
ir_node *node;
ir_node *pred;
ir_node *succ_block;
ir_node *jump = NULL;
ir_graph *irg = get_irn_irg(block);
const ir_edge_t *edge;
const ir_edge_t *next;
int i;
int arity;
ir_node *node;
ir_node *pred;
ir_node *succ_block;
ir_node *jump = NULL;
ir_graph *irg = get_irn_irg(block);
ir_entity *entity;
if (irn_visited_else_mark(block))
return;
......@@ -173,6 +176,7 @@ static void remove_empty_block(ir_node *block)
if (jump == NULL)
goto check_preds;
entity = get_Block_entity(block);
pred = get_Block_cfgpred(block, 0);
succ_block = NULL;
foreach_out_edge_safe(jump, edge, next) {
......@@ -180,8 +184,7 @@ static void remove_empty_block(ir_node *block)
assert(succ_block == NULL);
succ_block = get_edge_src_irn(edge);
if (get_Block_entity(succ_block) != NULL
&& get_Block_entity(block) != NULL) {
if (get_Block_entity(succ_block) != NULL && entity != NULL) {
/*
* Currently we can add only one label for a block.
* Therefore we cannot combine them if both block already have one.
......@@ -192,9 +195,8 @@ static void remove_empty_block(ir_node *block)
set_irn_n(succ_block, pos, pred);
}
if (get_Block_entity(block) != NULL) {
if (entity != NULL) {
/* move the label to the successor block */
ir_entity *entity = get_Block_entity(block);
set_Block_entity(succ_block, entity);
}
......
......@@ -151,8 +151,9 @@ void dump_irnode_to_file(FILE *F, const ir_node *n)
/* Source types */
switch (get_irn_opcode(n)) {
case iro_Block: {
if (get_Block_entity(n) != NULL)
fprintf(F, " Label: %lu\n", get_entity_label(get_Block_entity(n)));
ir_entity *const entity = get_Block_entity(n);
if (entity != NULL)
fprintf(F, " Label: %lu\n", get_entity_label(entity));
fprintf(F, " block visited: %lu\n", get_Block_block_visited(n));
fprintf(F, " block marked: %u\n", get_Block_mark(n));
if (is_irg_state(get_irn_irg(n), IR_GRAPH_STATE_CONSISTENT_DOMINANCE)) {
......
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