Added support for SymConst(ofs_ent)
[libfirm] / ir / be / bechordal_main.c
index d82603b..7041706 100644 (file)
@@ -387,8 +387,10 @@ static INLINE void check_for_memory_operands(be_chordal_env_t *chordal_env) {
 typedef struct _node_stat_t {
        unsigned int n_phis;      /**< Phis of the current register class. */
        unsigned int n_mem_phis;  /**< Memory Phis (Phis with spill operands). */
+       unsigned int n_copies;    /**< Copies */
+       unsigned int n_perms;     /**< Perms */
        unsigned int n_spills;    /**< Spill nodes */
-       unsigned int n_reloads;   /**< Reloads. */
+       unsigned int n_reloads;   /**< Reloads */
 } node_stat_t;
 
 struct node_stat_walker {
@@ -414,6 +416,11 @@ static void node_stat_walker(ir_node *irn, void *data)
                else if(arch_irn_classify(aenv, irn) & arch_irn_class_reload)
                        ++env->stat->n_reloads;
 
+               else if(arch_irn_classify(aenv, irn) & arch_irn_class_copy)
+                       ++env->stat->n_copies;
+
+               else if(arch_irn_classify(aenv, irn) & arch_irn_class_perm)
+                       ++env->stat->n_perms;
        }
 
        /* a mem phi is a PhiM with a mem phi operand or a Spill operand */
@@ -555,7 +562,6 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
        char time_str[32];
        char irg_name[128];
        int j, m, line;
-       char *filename;
        be_chordal_env_t chordal_env;
        const char *stat_tags[STAT_TAG_LAST];
 
@@ -584,7 +590,8 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
        chordal_env.irg       = irg;
        chordal_env.birg      = bi;
        chordal_env.dom_front = be_compute_dominance_frontiers(irg);
-       chordal_env.exec_freq = compute_execfreq(irg, be_loop_weight);
+       chordal_env.exec_freq = bi->execfreqs;
+               /*compute_execfreq(irg, be_loop_weight);*/
        chordal_env.lv        = be_liveness(irg);
        FIRM_DBG_REGISTER(chordal_env.dbg, "firm.be.chordal");
 
@@ -603,9 +610,10 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
                chordal_env.ignore_colors = bitset_malloc(chordal_env.cls->n_regs);
 
                stat_tags[STAT_TAG_CLS] = chordal_env.cls->name;
-               be_stat_ev_push(stat_tags, STAT_TAG_LAST, stat_file);
 
                if(stat_file) {
+                       be_stat_ev_push(stat_tags, STAT_TAG_LAST, stat_file);
+
                        /* perform some node statistics. */
                        node_stats(&chordal_env, &node_stat);
                        be_stat_ev("phis_before_spill", node_stat.n_phis);
@@ -715,27 +723,37 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
 
                if(stat_file) {
                        be_ifg_stat_t stat;
-                       be_ifg_stat(chordal_env.ifg, irg, &stat);
+                       be_ifg_stat(&chordal_env, &stat);
                        be_stat_ev("ifg_nodes", stat.n_nodes);
                        be_stat_ev("ifg_edges", stat.n_edges);
+                       be_stat_ev("ifg_comps", stat.n_comps);
                }
 
                BE_TIMER_PUSH(ra_timer.t_verify);
-               if (options.vrfy_option != BE_CH_VRFY_OFF)
-                       be_ra_chordal_check(&chordal_env);
+               if (options.vrfy_option != BE_CH_VRFY_OFF) {
+                       //be_ra_chordal_check(&chordal_env);
+               }
 
                BE_TIMER_POP(ra_timer.t_verify);
 
+               if(stat_file) {
+                       node_stats(&chordal_env, &node_stat);
+                       be_stat_ev("perms_before_coal", node_stat.n_perms);
+                       be_stat_ev("copies_before_coal", node_stat.n_copies);
+               }
+
                /* copy minimization */
                BE_TIMER_PUSH(ra_timer.t_copymin);
                co_driver(&chordal_env);
                BE_TIMER_POP(ra_timer.t_copymin);
+
                dump(BE_CH_DUMP_COPYMIN, irg, chordal_env.cls, "-copymin", dump_ir_block_graph_sched);
 
                BE_TIMER_PUSH(ra_timer.t_verify);
 
-               if (options.vrfy_option != BE_CH_VRFY_OFF)
-                       be_ra_chordal_check(&chordal_env);
+               if (options.vrfy_option != BE_CH_VRFY_OFF) {
+                       //be_ra_chordal_check(&chordal_env);
+               }
 
                BE_TIMER_POP(ra_timer.t_verify);
                BE_TIMER_PUSH(ra_timer.t_ssa);
@@ -750,7 +768,7 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
                BE_TIMER_PUSH(ra_timer.t_verify);
                if (options.vrfy_option != BE_CH_VRFY_OFF) {
                        be_ssa_destruction_check(&chordal_env);
-                       be_ra_chordal_check(&chordal_env);
+                       //be_ra_chordal_check(&chordal_env);
                }
                BE_TIMER_POP(ra_timer.t_verify);
 
@@ -758,13 +776,18 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
                pmap_destroy(chordal_env.border_heads);
                bitset_free(chordal_env.ignore_colors);
 
+               if(stat_file) {
+                       node_stats(&chordal_env, &node_stat);
+                       be_stat_ev("perms_after_coal", node_stat.n_perms);
+                       be_stat_ev("copies_after_coal", node_stat.n_copies);
+               }
+
                be_stat_ev_pop();
        }
 
        BE_TIMER_PUSH(ra_timer.t_spillslots);
 
-       if(coalesce_spill_slots)
-       be_coalesce_spillslots(&chordal_env);
+       be_coalesce_spillslots(&chordal_env, coalesce_spill_slots);
        dump(BE_CH_DUMP_SPILLSLOTS, irg, NULL, "-spillslots", dump_ir_block_graph_sched);
 
        BE_TIMER_POP(ra_timer.t_spillslots);
@@ -790,7 +813,7 @@ static be_ra_timer_t *be_ra_chordal_main(const be_irg_t *bi)
        obstack_free(&chordal_env.obst, NULL);
        be_free_dominance_frontiers(chordal_env.dom_front);
        be_liveness_free(chordal_env.lv);
-       free_execfreq(chordal_env.exec_freq);
+       //free_execfreq(chordal_env.exec_freq);
 
        BE_TIMER_POP(ra_timer.t_epilog);
        BE_TIMER_POP(ra_timer.t_other);