make schedule dumper more robust/cleanup
authorMatthias Braun <matze@braunis.de>
Tue, 27 Nov 2012 17:01:39 +0000 (18:01 +0100)
committerMatthias Braun <matze@braunis.de>
Wed, 28 Nov 2012 10:27:13 +0000 (11:27 +0100)
ir/be/beinfo.c
ir/be/bemain.c
ir/be/benode.c

index cada5c5..fbda0b7 100644 (file)
@@ -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);
index e55f1ef..74f8294 100644 (file)
@@ -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");
index cd6a794..55713d1 100644 (file)
@@ -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;