+ int my_rec_color = compute_color(rec_depth, max_rec_depth);
+ int my_loop_color = compute_color(loop_depth, max_loop_depth);
+ int my_overall_color = compute_color(overall_depth, max_overall_depth);;
+
+ return my_overall_color;
+}
+
+void dump_callgraph(const char *suffix) {
+ FILE *F;
+ int i, n_irgs = get_irp_n_irgs();
+ int rem = edge_label;
+ edge_label = 1;
+ //ident *prefix = new_id_from_str("java/");
+
+ F = vcg_open_name("Callgraph", suffix);
+ dump_vcg_header(F, "Callgraph", NULL);
+
+ for (i = 0; i < n_irgs; ++i) {
+ ir_graph *irg = get_irp_irg(i);
+ entity *ent = get_irg_entity(irg);
+ int j, n_callees = get_irg_n_callees(irg);
+
+ /* Do not dump runtime system. */
+ //if (id_is_prefix(prefix, get_entity_ld_ident(ent))) continue;
+
+ dump_entity_node(F, ent, get_entity_color(ent));
+ for (j = 0; j < n_callees; ++j) {
+ entity *c = get_irg_entity(get_irg_callee(irg, j));
+ //if (id_is_prefix(prefix, get_entity_ld_ident(c))) continue;
+ int be = is_irg_callee_backedge(irg, j);
+ char *attr;
+ attr = (be) ?
+ "label:\"recursion %d\" color: %d" :
+ "label:\"calls %d\" color: %d";
+ print_ent_ent_edge(F, ent, c, be, attr, get_irg_callee_loop_depth(irg, j), get_entity_color(ent));
+ }
+ }
+
+ edge_label = rem;
+ vcg_close(F);
+}