optimize next_use calculation (quadratic in number of outs not number of nodes in...
[libfirm] / ir / be / beutil.c
index ef9ce6d..8b66eef 100644 (file)
@@ -191,7 +191,9 @@ static void collect_phis(ir_node *irn, void *data)
 
 void be_clear_links(ir_graph *irg)
 {
+       set_using_irn_link(irg);
        irg_walk_graph(irg, firm_clear_link, NULL, NULL);
+       clear_using_irn_link(irg);
 }
 
 void be_collect_phis(ir_graph *irg)
@@ -269,3 +271,16 @@ ir_node *be_get_Proj_for_pn(const ir_node *irn, long pn) {
 
        return NULL;
 }
+
+FILE *be_ffopen(const char *base, const char *ext, const char *mode) {
+       FILE *out;
+       char buf[1024];
+
+       snprintf(buf, sizeof(buf), "%s.%s", base, ext);
+       buf[sizeof(buf) - 1] = '\0';
+       if (! (out = fopen(buf, mode))) {
+               fprintf(stderr, "Cannot open file %s in mode %s\n", buf, mode);
+               return NULL;
+       }
+       return out;
+}