additional graph properties added
[libfirm] / ir / ir / irdump.c
index 7c3be78..5ed8a48 100644 (file)
@@ -426,10 +426,10 @@ static void clear_link(ir_node * node, void * env) {
 }
 
 /**
- * If the entity has a ld_name, returns it if the option dump_ld_name is set,
+ * If the entity has a ld_name, returns it if the dump_ld_name is set,
  * else returns the name of the entity.
  */
-const char *get_ent_dump_name(entity *ent) {
+static const char *_get_ent_dump_name(entity *ent, int dump_ld_name) {
   if (!ent)
     return "<NULL entity>";
   if (dump_ld_name) {
@@ -439,11 +439,18 @@ const char *get_ent_dump_name(entity *ent) {
   return get_id_str(ent->name);
 }
 
+/**
+ * If the entity has a ld_name, returns it if the option dump_ld_name is set,
+ * else returns the name of the entity.
+ */
+const char *get_ent_dump_name(entity *ent) {
+  return _get_ent_dump_name(ent, dump_ld_name);
+}
+
 /* Returns the name of an IRG. */
 const char *get_irg_dump_name(ir_graph *irg) {
   /* Don't use get_entity_ld_ident (ent) as it computes the mangled name! */
-  entity *ent = get_irg_entity(irg);
-  return get_ent_dump_name(ent);
+  return _get_ent_dump_name(get_irg_entity(irg), 1);
 }
 
 /**
@@ -2276,12 +2283,16 @@ dump_ir_graph_w_types (ir_graph *irg, const char *suffix)
   FILE *f;
   ir_graph *rem = current_ir_graph;
   char *suffix1;
+  int rem_dump_const_local;
 
   /* 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;
 
   current_ir_graph = irg;
+  rem_dump_const_local = dump_const_local;
+  /* dumping types does not work with local nodes */
+  dump_const_local = 0;
 
   if (get_interprocedural_view()) suffix1 = "-pure-wtypes-ip";
   else                            suffix1 = "-pure-wtypes";
@@ -2297,6 +2308,7 @@ dump_ir_graph_w_types (ir_graph *irg, const char *suffix)
   irg_walk(get_irg_end(irg), dump_node2type_edges, NULL, f);
 
   vcg_close(f);
+  dump_const_local = rem_dump_const_local;
   current_ir_graph = rem;
 }
 
@@ -2307,11 +2319,16 @@ dump_ir_block_graph_w_types (ir_graph *irg, const char *suffix)
   int i;
   char *suffix1;
   ir_graph *rem = current_ir_graph;
+  int rem_dump_const_local;
 
   /* 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;
 
+  rem_dump_const_local = dump_const_local;
+  /* dumping types does not work with local nodes */
+  dump_const_local = 0;
+
   if (get_interprocedural_view()) suffix1 = "-wtypes-ip";
   else                            suffix1 = "-wtypes";
   f = vcg_open(irg, suffix, suffix1);
@@ -2336,8 +2353,9 @@ dump_ir_block_graph_w_types (ir_graph *irg, const char *suffix)
   /* dump edges from graph to type info */
   irg_walk(get_irg_end(irg), dump_node2type_edges, NULL, f);
 
-  current_ir_graph = rem;
   vcg_close(f);
+  dump_const_local = rem_dump_const_local;
+  current_ir_graph = rem;
 }
 
 /*---------------------------------------------------------------------*/
@@ -2347,7 +2365,7 @@ dump_ir_block_graph_w_types (ir_graph *irg, const char *suffix)
 static void
 dump_block_to_cfg(ir_node *block, void *env) {
   FILE *F = env;
-  int i, fl;
+  int i, fl = 0;
   ir_node *pred;
 
   if (is_Block(block)) {