From 9a1c04e0bdc66d8fce339bc81408728b9459d033 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Tue, 27 Nov 2012 18:01:39 +0100 Subject: [PATCH] make schedule dumper more robust/cleanup --- ir/be/beinfo.c | 23 +++++++++++++---------- ir/be/bemain.c | 1 - ir/be/benode.c | 11 +++++------ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/ir/be/beinfo.c b/ir/be/beinfo.c index cada5c5f2..fbda0b7a0 100644 --- a/ir/be/beinfo.c +++ b/ir/be/beinfo.c @@ -176,23 +176,26 @@ void be_info_init(void) */ static void sched_edge_hook(FILE *F, const ir_node *irn) { - if (get_irn_irg(irn)->be_data == NULL) + ir_graph *irg = get_irn_irg(irn); + if (!irg_is_constrained(irg, IR_GRAPH_CONSTRAINT_BACKEND)) + return; + + if (is_Proj(irn) || is_Block(irn) || !sched_is_scheduled(irn)) return; - if (!is_Proj(irn) && sched_is_scheduled(irn) && !is_Block(irn)) { - ir_node *const prev = sched_prev(irn); - if (!sched_is_begin(prev)) { - fprintf(F, "edge:{sourcename: "); - print_nodeid(F, irn); - fprintf(F, " targetname: "); - print_nodeid(F, prev); - fprintf(F, " color:magenta}\n"); - } + ir_node *const prev = sched_prev(irn); + if (!sched_is_begin(prev)) { + fprintf(F, "edge:{sourcename: "); + print_nodeid(F, irn); + fprintf(F, " targetname: "); + print_nodeid(F, prev); + fprintf(F, " color:magenta}\n"); } } void be_info_init_irg(ir_graph *irg) { + add_irg_constraints(irg, IR_GRAPH_CONSTRAINT_BACKEND); irg_walk_anchors(irg, init_walker, NULL, NULL); set_dump_node_edge_hook(sched_edge_hook); diff --git a/ir/be/bemain.c b/ir/be/bemain.c index e55f1efae..74f8294e3 100644 --- a/ir/be/bemain.c +++ b/ir/be/bemain.c @@ -480,7 +480,6 @@ static void initialize_birg(be_irg_t *birg, ir_graph *irg, be_main_env_t *env) /* Ensure, that the ir_edges are computed. */ assure_edges(irg); - add_irg_constraints(irg, IR_GRAPH_CONSTRAINT_BACKEND); be_info_init_irg(irg); dump(DUMP_INITIAL, irg, "prepared"); diff --git a/ir/be/benode.c b/ir/be/benode.c index cd6a7946d..55713d104 100644 --- a/ir/be/benode.c +++ b/ir/be/benode.c @@ -1076,6 +1076,10 @@ void be_set_phi_reg_req(ir_node *node, const arch_register_req_t *req) void be_dump_phi_reg_reqs(FILE *F, const ir_node *node, dump_reason_t reason) { + ir_graph *irg = get_irn_irg(node); + if (!irg_is_constrained(irg, IR_GRAPH_CONSTRAINT_BACKEND)) + return; + switch (reason) { case dump_node_opcode_txt: fputs(get_op_name(get_irn_op(node)), F); @@ -1086,13 +1090,8 @@ void be_dump_phi_reg_reqs(FILE *F, const ir_node *node, dump_reason_t reason) case dump_node_nodeattr_txt: break; case dump_node_info_txt: - { - backend_info_t *info = be_get_info(node); - if (info != NULL && info->out_infos[0].req != NULL) { - arch_dump_reqs_and_registers(F, node); - } + arch_dump_reqs_and_registers(F, node); break; - } default: break; -- 2.20.1