- FILE *f;
- /* if a filter is set, dump only the irg's that match the filter */
- if (!is_filtered_dump_name(get_entity_ident(get_irg_entity(irg))))
- return;
-
- f = vcg_open(irg, suffix, "-cfg");
- if (f != NULL) {
- ir_graph *rem = current_ir_graph;
-#ifdef INTERPROCEDURAL_VIEW
- int ipv = get_interprocedural_view();
-#endif
-
- current_ir_graph = irg;
- dump_vcg_header(f, get_irg_dump_name(irg), NULL, NULL);
-
-#ifdef INTERPROCEDURAL_VIEW
- if (ipv) {
- printf("Warning: dumping cfg not in interprocedural view!\n");
- set_interprocedural_view(0);
- }
-#endif
-
- /* walk over the blocks in the graph */
- irg_block_walk(get_irg_end(irg), dump_block_to_cfg, NULL, f);
- dump_node(f, get_irg_bad(irg));
-
-#ifdef INTERPROCEDURAL_VIEW
- set_interprocedural_view(ipv);
-#endif
- dump_vcg_footer(f);
- fclose(f);
- current_ir_graph = rem;
- }
-}
-
-
-static void descend_and_dump(FILE *F, ir_node *n, int depth, pset *mark_set)
-{
- if (pset_find_ptr(mark_set, n))
- return;
-
- pset_insert_ptr(mark_set, n);
-
- if (depth > 0) {
- int i, start = is_Block(n) ? 0 : -1;
- dump_whole_node(n, F);
- for (i = start; i < get_irn_arity(n); ++i)
- descend_and_dump(F, get_irn_n(n, i), depth-1, mark_set);
- } else {
- dump_node(F, n);
- /* Don't dump edges to nodes further out. These might be edges to
- nodes we already dumped, if there is a shorter path to these. */
- }
-}
-
-static int subgraph_counter = 0;
-void dump_subgraph(ir_node *root, int depth, const char *suffix)
-{
- FILE *F;
- char buf[32];
-
- sprintf(buf, "-subg_%03d", subgraph_counter++);
- F = vcg_open(get_irn_irg(root), suffix, buf);
- if (F != NULL) {
- pset *mark_set = pset_new_ptr(1);
- dump_vcg_header(F, get_irg_dump_name(get_irn_irg(root)), NULL, NULL);
- descend_and_dump(F, root, depth, mark_set);
- dump_vcg_footer(F);
- fclose(F);
- del_pset(mark_set);
- }
-}
-
-void dump_callgraph(const char *suffix)
-{
- FILE *F = vcg_open_name("Callgraph", suffix);
-
- if (F != NULL) {
- int i, rem = edge_label;
- //int colorize;
- edge_label = 1;
- dump_vcg_header(F, "Callgraph", "Hierarchiv", NULL);