Added test case for pbqp construction: There seems to be missing skip patterns, so...
[libfirm] / ir / be / beutil.c
index fe26121..8754f4d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
@@ -128,11 +128,9 @@ void dump_allocated_irg(arch_env_t *arch_env, ir_graph *irg, char *suffix)
  */
 static int sched_edge_hook(FILE *F, ir_node *irn)
 {
-#ifndef SCHEDULE_PROJS
        if (is_Proj(irn))
                return 1;
-#endif
-       if(sched_is_scheduled(irn) && sched_has_prev(irn)) {
+       if (sched_is_scheduled(irn) && sched_has_prev(irn)) {
                ir_node *prev = sched_prev(irn);
                fprintf(F, "edge:{sourcename:\"");
                PRINT_NODEID(irn);
@@ -147,7 +145,8 @@ void dump_ir_block_graph_sched(ir_graph *irg, const char *suffix) {
        DUMP_NODE_EDGE_FUNC old = get_dump_node_edge_hook();
 
        dump_consts_local(0);
-       set_dump_node_edge_hook(sched_edge_hook);
+       if (have_sched_info(irg))
+               set_dump_node_edge_hook(sched_edge_hook);
        dump_ir_block_graph(irg, suffix);
        set_dump_node_edge_hook(old);
 }
@@ -156,7 +155,8 @@ void dump_ir_extblock_graph_sched(ir_graph *irg, const char *suffix) {
        DUMP_NODE_EDGE_FUNC old = get_dump_node_edge_hook();
 
        dump_consts_local(0);
-       set_dump_node_edge_hook(sched_edge_hook);
+       if (have_sched_info(irg))
+               set_dump_node_edge_hook(sched_edge_hook);
        dump_ir_extblock_graph(irg, suffix);
        set_dump_node_edge_hook(old);
 }
@@ -196,9 +196,9 @@ static void collect_phis(ir_node *irn, void *data)
 
 void be_clear_links(ir_graph *irg)
 {
-       set_using_irn_link(irg);
+       ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK);
        irg_walk_graph(irg, firm_clear_link, NULL, NULL);
-       clear_using_irn_link(irg);
+       ir_free_resources(irg, IR_RESOURCE_IRN_LINK);
 }
 
 void be_collect_phis(ir_graph *irg)
@@ -219,28 +219,6 @@ unsigned get_num_reachable_nodes(ir_graph *irg) {
        return num;
 }
 
-/**
- * Sets all node inputs to BAD node.
- */
-void be_kill_node(ir_node *irn) {
-       ir_graph *irg = get_irn_irg(irn);
-
-       assert(!is_Bad(irn));
-
-#ifdef DEBUG_libfirm
-       {
-       int i, first;
-       first = 0 - ! is_Block(irn);
-
-       for (i = get_irn_arity(irn) - 1; i >= first; --i) {
-               set_irn_n(irn, i, get_irg_bad(irg));
-       }
-       }
-#endif
-
-       edges_node_deleted(irn, irg);
-}
-
 /**
  * Gets the Proj with number pn from irn.
  */
@@ -252,7 +230,7 @@ ir_node *be_get_Proj_for_pn(const ir_node *irn, long pn) {
        foreach_out_edge(irn, edge) {
                proj = get_edge_src_irn(edge);
 
-               if (get_Proj_proj(proj) == pn)
+               if (is_Proj(proj) && get_Proj_proj(proj) == pn)
                        return proj;
        }