adapt to new firm dumper interface
authorMatthias Braun <matze@braunis.de>
Fri, 25 Jun 2010 07:21:19 +0000 (07:21 +0000)
committerMatthias Braun <matze@braunis.de>
Fri, 25 Jun 2010 07:21:19 +0000 (07:21 +0000)
[r27654]

driver/firm_cmdline.c
driver/firm_cmdline.h
driver/firm_opt.c
driver/firm_opt.h
main.c

index ccc5766..a77ec87 100644 (file)
@@ -65,7 +65,6 @@ struct a_firm_dump firm_dump = {
   /* extbb        = */ FALSE,
   /* ir_graph     = */ FALSE,
   /* all_phases   = */ FALSE,
-  /* edge_labels  = */ FALSE,
   /* statistic    = */ STAT_NONE,
   /* stat_pattern = */ 0,
   /* stat_dag     = */ 0,
@@ -157,7 +156,6 @@ static const struct params {
   { X("dump-no-blocks"),         &firm_dump.no_blocks,       1, "firm: dump non-blocked graph" },
   { X("dump-extbb"),             &firm_dump.extbb,           1, "firm: dump extended basic blocks" },
   { X("dump-all-phases"),        &firm_dump.all_phases,      1, "firm: dump graphs for all optimization phases" },
-  { X("dump-edge-labels"),       &firm_dump.edge_labels,     1, "firm: dump edge labels" },
 
   /* code generation */
   { X("no-codegen"),             &firm_be_opt.selection,     BE_NONE, "cg: disable code generator" },
index 3011316..e7f12e3 100644 (file)
@@ -85,7 +85,6 @@ struct a_firm_dump {
   a_byte extbb;         /**< dumps extended basic blocks */
   a_byte ir_graph;      /**< dump all graphs */
   a_byte all_phases;    /**< dump the IR graph after all phases */
-  a_byte edge_labels;   /**< use edge labels when dumping IR graphs */
   a_byte statistic;     /**< Firm statistic setting */
   a_byte stat_pattern;  /**< enable Firm statistic pattern */
   a_byte stat_dag;      /**< enable Firm DAG statistic */
index 8530d00..0107e42 100644 (file)
@@ -31,16 +31,12 @@ static bool do_irg_opt(ir_graph *irg, const char *name);
 
 static void dump_all(const char *suffix)
 {
-       if (firm_dump.ir_graph) {
-               timer_push(t_vcg_dump);
-               if (firm_dump.no_blocks)
-                       dump_all_ir_graphs(dump_ir_graph, suffix);
-               else if (firm_dump.extbb)
-                       dump_all_ir_graphs(dump_ir_extblock_graph, suffix);
-               else
-                       dump_all_ir_graphs(dump_ir_block_graph, suffix);
-               timer_pop(t_vcg_dump);
-       }
+       if (!firm_dump.ir_graph)
+               return;
+
+       timer_push(t_vcg_dump);
+       dump_all_ir_graphs(suffix);
+       timer_pop(t_vcg_dump);
 }
 
 /* set by the backend parameters */
@@ -179,23 +175,6 @@ static void rts_map(void)
 }
 
 static int *irg_dump_no;
-
-static void dump_graph_count(ir_graph *const irg, const char *const suffix)
-{
-       char name[64];
-       snprintf(name, sizeof(name), "-%02d_%s", irg_dump_no[get_irg_idx(irg)]++,
-                suffix);
-
-       timer_push(t_vcg_dump);
-       if (firm_dump.no_blocks)
-               dump_ir_graph(irg, name);
-       else if (firm_dump.extbb)
-               dump_ir_extblock_graph(irg, name);
-       else
-               dump_ir_block_graph(irg, name);
-       timer_pop(t_vcg_dump);
-}
-
 static int firm_const_exists;
 
 static void do_optimize_funccalls(void)
@@ -404,7 +383,7 @@ static bool do_irg_opt(ir_graph *irg, const char *name)
        timer_pop(timers[n]);
 
        if (firm_dump.all_phases && firm_dump.ir_graph) {
-               dump_graph_count(irg, name);
+               dump_ir_graph(irg, name);
        }
 
        if (firm_opt.check_all) {
@@ -433,7 +412,7 @@ static void do_irp_opt(const char *name)
                int i;
                for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
                        ir_graph *irg = get_irp_irg(i);
-                       dump_graph_count(irg, name);
+                       dump_ir_graph(irg, name);
                }
        }
 
@@ -600,7 +579,7 @@ static void do_firm_optimizations(const char *input_filename)
                        construct_cf_backedges(get_irp_irg(i));
        }
 
-       dump_all("-opt");
+       dump_all("opt");
 
        if (firm_dump.statistic & STAT_AFTER_OPT)
                stat_dump_snapshot(input_filename, "opt");
@@ -622,7 +601,7 @@ static void do_firm_lowering(const char *input_filename)
        if (firm_dump.statistic & STAT_AFTER_LOWER)
                stat_dump_snapshot(input_filename, "low");
 
-       dump_all("-low");
+       dump_all("low");
 
        if (firm_opt.enabled) {
                timer_start(t_all_opt);
@@ -668,17 +647,17 @@ static void do_firm_lowering(const char *input_filename)
 
                do_irp_opt("remove-unused");
 
-               dump_all("-low-opt");
+               dump_all("low-opt");
        }
 
        if (firm_opt.cc_opt)
                mark_private_methods();
 
        /* set the phase to low */
-       for (i = get_irp_n_irgs() - 1; i >= 0; --i)
-               set_irg_phase_low(get_irp_irg(i));
-
-       /* all graphs are lowered, set the irp phase to low */
+       for (i = get_irp_n_irgs() - 1; i >= 0; --i) {
+               ir_graph *irg = get_irp_irg(i);
+               set_irg_phase_state(irg, phase_low);
+       }
        set_irp_phase_state(phase_low);
 
        if (firm_dump.statistic & STAT_FINAL) {
@@ -743,8 +722,12 @@ void gen_firm_init(void)
        arch_dep_set_opts(arch_dep_none);
 
        do_node_verification((firm_verification_t) firm_opt.vrfy);
-       if (firm_dump.filter)
-               only_dump_method_with_name(new_id_from_str(firm_dump.filter));
+       if (firm_dump.filter != NULL)
+               ir_set_dump_filter(firm_dump.filter);
+       if (firm_dump.extbb)
+               ir_add_dump_flags(ir_dump_flag_group_extbb);
+       if (firm_dump.no_blocks)
+               ir_remove_dump_flags(ir_dump_flag_blocks_as_subgraphs);
 
        if (firm_opt.enabled) {
                set_optimize(1);
@@ -759,9 +742,6 @@ void gen_firm_init(void)
        } else {
                set_optimize(0);
        }
-
-       /* do not dump entity ld names */
-       dump_ld_names(0);
 }
 
 /**
@@ -773,7 +753,7 @@ void gen_firm_init(void)
  * @param c_mode             non-zero if "C" was compiled
  * @param new_firm_const_exists  non-zero, if the const attribute was used on functions
  */
-void gen_firm_finish(FILE *out, const char *input_filename, int c_mode,
+void gen_firm_finish(FILE *out, const char *input_filename,
                      int new_firm_const_exists)
 {
        int i;
@@ -793,23 +773,15 @@ void gen_firm_finish(FILE *out, const char *input_filename, int c_mode,
        firm_dump.ir_graph
                = (a_byte) (firm_dump.ir_graph | firm_dump.all_phases | firm_dump.extbb);
 
-       dump_keepalive_edges(1);
-       dump_consts_local(1);
-       dump_dominator_information(1);
-       dump_loop_information(0);
-
-       if (!firm_dump.edge_labels)
-               turn_off_edge_labels();
+       ir_add_dump_flags(ir_dump_flag_keepalive_edges
+                       | ir_dump_flag_consts_local | ir_dump_flag_dominance);
+       ir_remove_dump_flags(ir_dump_flag_loops | ir_dump_flag_ld_names);
 
        /* FIXME: cloning might ADD new graphs. */
        irg_dump_no = calloc(get_irp_last_idx(), sizeof(*irg_dump_no));
 
        if (firm_dump.all_types) {
-               dump_all_types("");
-               if (! c_mode) {
-                       dump_class_hierarchy(0, "");
-                       dump_class_hierarchy(1, "-with-entities");
-               }
+               dump_ir_prog_ext(dump_typegraph, "types.vcg");
        }
 
        /* finalize all graphs */
index 16a8887..56fdbe6 100644 (file)
@@ -104,7 +104,7 @@ void gen_firm_init(void);
 void disable_all_opts(void);
 
 /** called, after the Firm generation is completed. */
-void gen_firm_finish(FILE *out, const char *input_filename, int c_mode, int firm_const_exists);
+void gen_firm_finish(FILE *out, const char *input_filename, int firm_const_exists);
 
 void gen_Firm_assembler(const char *input_filename);
 
diff --git a/main.c b/main.c
index d9be646..7e3f45e 100644 (file)
--- a/main.c
+++ b/main.c
@@ -172,9 +172,6 @@ static file_list_entry_t *temp_files;
 static void initialize_firm(void)
 {
        firm_early_init();
-
-       dump_consts_local(1);
-       dump_keepalive_edges(1);
 }
 
 static void get_output_name(char *buf, size_t buflen, const char *inputname,
@@ -1463,7 +1460,7 @@ graph_built:
                                        exit(1);
                                }
 
-                               dump_ir_block_graph_file(irg, out);
+                               dump_ir_graph_file(out, irg);
                                fclose(out);
                                exit(0);
                        }
@@ -1474,8 +1471,7 @@ graph_built:
                                exit(0);
                        }
 
-                       gen_firm_finish(asm_out, filename, /*c_mode=*/1,
-                                       have_const_functions);
+                       gen_firm_finish(asm_out, filename, have_const_functions);
                        if (asm_out != out) {
                                fclose(asm_out);
                        }