** irdump.h: dumping of an intermediate representation graph
*/
-# include <assert.h>
+# include "irnode_t.h"
+# include "irgraph_t.h"
# include "irdump.h"
# include "panic.h"
# include <string.h>
int len;
/** open file for vcg graph */
- id = get_entity_ld_name (irg->ent);
-
+ id = get_entity_ld_name (get_irg_ent(irg));
len = id_to_strlen (id);
cp = id_to_str (id);
fname = malloc (len + 5 + strlen(suffix));
strcpy (fname, cp); /* copy the filename */
strcat (fname, suffix); /* append file suffix */
strcat (fname, ".vcg"); /* append the .vcg suffix */
-
F = fopen (fname, "w"); /* open file for writing */
if (!F) {
panic ("cannot open %s for writing (%m)", fname); /* not reached */
xfprintf (F, "\n"); /* a separator */
}
+void vcg_open_name (const char *name) {
+ char *fname; /* filename to put the vcg information in */
+ int len;
+
+ /** open file for vcg graph */
+ len = strlen(name);
+ fname = malloc (len + 5);
+ strcpy (fname, name); /* copy the filename */
+ strcat (fname, ".vcg"); /* append the .vcg suffix */
+ F = fopen (fname, "w"); /* open file for writing */
+ if (!F) {
+ panic ("cannot open %s for writing (%m)", fname); /* not reached */
+ }
+
+ /* print header */
+ xfprintf (F,
+ "graph: { title: \"ir graph of %s\"\n"
+ "display_edge_labels: yes\n"
+ "layoutalgorithm: mindepth\n"
+ "manhattan_edges: yes\n"
+ "port_sharing: no\n"
+ "orientation: bottom_to_top\n"
+ "classname 1: \"Data\"\n"
+ "classname 2: \"Block\"\n", name);
+
+ xfprintf (F, "\n"); /* a separator */
+}
+
void
vcg_close () {
xfprintf (F, "}\n"); /* print footer */
ir_graph *irg = (ir_graph *)env;
if (get_irn_opcode(block) == iro_Block) {
+
/* This is a block. So dump the vcg information to make a block. */
xfprintf(F, "graph: { title: \"%p\" label: \"", block);
#ifdef DEBUG_libfirm
xfprintf (F, "%ld", get_irn_node_nr(block));
-#elif
+#else
xfprintf (F, "%I", block->op->name);
#endif
xfprintf(F, "\" status:clustered color:lightyellow \n");
/***********************************************************************/
-/* the following routine dumps all type information */
+/* the following routine dumps all type information reachable from an */
+/* irg */
/***********************************************************************/
vcg_open (irg, "-type");
/* walk over the blocks in the graph */
- type_walk(irg, dump_type_info, NULL, NULL);
+ type_walk_irg(irg, dump_type_info, NULL, NULL);
vcg_close();
current_ir_graph = rem;
}
+/***********************************************************************/
+/* the following routine dumps all type information */
+/***********************************************************************/
+
+
+void
+dump_all_types (void)
+{
+ vcg_open_name ("All_types");
+ type_walk(dump_type_info, NULL, NULL);
+ vcg_close();
+}
/***********************************************************************/
/* dumps a graph with type information */
/* irg_block_walk(irg->end, dump_ir_block, NULL, irg); */
irg_walk(irg->end, dump_whole_node, NULL, NULL);
/* dump type info */
- type_walk(irg, dump_type_info, NULL, NULL);
+ type_walk_irg(irg, dump_type_info, NULL, NULL);
/* dump edges from graph to type info */
irg_walk(irg->end, dump_node2type_edges, NULL, NULL);