values may die at every use
[libfirm] / ir / be / becopyopt.c
index c613376..019106a 100644 (file)
 #include "becopystat.h"
 
 
+#ifdef WITH_LIBCORE
+
+/* Insert additional options registration functions here. */
+extern void be_co2_register_options(lc_opt_entry_t *grp);
+
+void co_register_options(lc_opt_entry_t *grp)
+{
+       be_co2_register_options(grp);
+}
+#endif
+
+
 #undef QUICK_AND_DIRTY_HACK
 
 /******************************************************************************
@@ -43,7 +55,7 @@
 
  ******************************************************************************/
 
-static firm_dbg_module_t *dbg = NULL;
+DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;)
 
 void be_copy_opt_init(void) {
 }
@@ -53,7 +65,7 @@ copy_opt_t *new_copy_opt(be_chordal_env_t *chordal_env, int (*get_costs)(ir_node
        int len;
        copy_opt_t *co;
 
-       dbg = firm_dbg_register("ir.be.copyopt");
+       FIRM_DBG_REGISTER(dbg, "ir.be.copyopt");
 
        co = xcalloc(1, sizeof(*co));
        co->cenv      = chordal_env;
@@ -637,3 +649,50 @@ int co_gs_is_optimizable(copy_opt_t *co, ir_node *irn) {
        } else
                return 0;
 }
+
+void co_dump_appel_graph(const copy_opt_t *co, FILE *f)
+{
+       be_ifg_t *ifg = co->cenv->ifg;
+
+       ir_node *irn;
+       void *it, *nit;
+       int n;
+
+       it  = be_ifg_nodes_iter_alloca(ifg);
+       nit = be_ifg_neighbours_iter_alloca(ifg);
+
+       n = 0;
+       be_ifg_foreach_node(ifg, it, irn) {
+               set_irn_link(irn, INT_TO_PTR(n++));
+       }
+
+       fprintf(f, "%d %d\n", n, co->cls->n_regs);
+
+       be_ifg_foreach_node(ifg, it, irn) {
+               int idx            = PTR_TO_INT(get_irn_link(irn));
+               affinity_node_t *a = get_affinity_info(co, irn);
+
+               ir_node *adj;
+
+               be_ifg_foreach_neighbour(ifg, nit, irn, adj) {
+                       int adj_idx = PTR_TO_INT(get_irn_link(adj));
+                       if(idx < adj_idx)
+                               fprintf(f, "%d %d -1\n", idx, adj_idx);
+               }
+
+               if(a) {
+                       neighb_t *n;
+
+                       co_gs_foreach_neighb(a, n) {
+                               int n_idx = PTR_TO_INT(get_irn_link(n->irn));
+                               if(idx < n_idx)
+                                       fprintf(f, "%d %d %d\n", idx, n_idx, n->costs);
+                       }
+               }
+       }
+}
+
+void co_solve_park_moon(copy_opt_t *opt)
+{
+
+}