removed wrong const
[libfirm] / ir / ir / irprintf.c
index 1a27640..efd2515 100644 (file)
@@ -10,7 +10,7 @@
  */
 
 /**
- * @file irprinf.c
+ * @file irprintf.c
  *
  * A little printf helper unterstanding firm types.
  * @author Sebastian Hack
@@ -46,6 +46,7 @@
 #include "pset.h"
 #include "iterator.h"
 #include "bitset.h"
+#include "dbginfo_t.h"
 
 #define STRNIL "(nil)"
 
@@ -389,7 +390,9 @@ static void ir_common_vprintf(const appender_t *app, void *object,
                                        snprintf(buf, sizeof(buf), "%p", va_arg(args, void *));
                                        break;
 
+                               case 'i':
                                case 'd':
+                               case 'u':
                                case 'x':
                                case 'X':
                                case 'o':
@@ -447,16 +450,17 @@ static void ir_common_vprintf(const appender_t *app, void *object,
                                case 'n':
                                        {
                                                ir_node *irn = va_arg(args, ir_node *);
-                                               if (irn)
+                                               if (irn) {
                                                        if (is_Const(irn)) {
                                                                char tbuf[128];
                                                                tarval_snprintf(tbuf, sizeof(tbuf), get_Const_tarval(irn));
                                                                snprintf(buf, sizeof(buf), "%s%s<%s>:%ld",
                                                                        get_irn_opname(irn), get_mode_name(get_irn_mode(irn)), tbuf, get_irn_node_nr(irn));
-                                                        }
-                                                        else
+                                                       }
+                                                       else
                                                                snprintf(buf, sizeof(buf), "%s%s:%ld",
                                                                        get_irn_opname(irn), get_mode_name(get_irn_mode(irn)), get_irn_node_nr(irn));
+                                               }
                                                else
                                                        strncpy(buf, STRNIL, sizeof(buf));
                                        }
@@ -533,11 +537,43 @@ static void ir_common_vprintf(const appender_t *app, void *object,
                                case '=':
                                        str = get_pnc_string(va_arg(args, int));
                                        break;
+                               case 'G':
+                                       {
+                                               ir_node *irn = va_arg(args, ir_node *);
+                                               dbg_info *dbg = get_irn_dbg_info(irn);
+                                               buf[0] = '\0';
+                                               if (dbg && __dbg_info_snprint) {
+                                                       if (__dbg_info_snprint(buf, sizeof(buf), dbg) <= 0)
+                                                               buf[0] = '\0';
+                                               }
+                                               break;
+                                       }
+        case 'P':
+          {
+            compound_graph_path *path = va_arg(args, compound_graph_path *);
+            int i, l = get_compound_graph_path_length(path);
+            entity *ent;
+
+            for (i = 0; i < l; ++i) {
+              ent = get_compound_graph_path_node(path, i);
+
+              DUMP_STR(".");
+              DUMP_STR(get_entity_name(ent));
+              if (is_Array_type(get_entity_owner(ent))) {
+                snprintf(buf, sizeof(buf), "[%d]",
+                  get_compound_graph_path_array_index(path, i));
+                DUMP_STR(buf);
+              }
+            }
+
+            /* clean the buffer again */
+            buf[0] = '\0';
+            break;
+          }
                        }
 
                        dump_with_settings(app, object, limit, &settings, str);
                }
-
                else
                        DUMP_CH(ch);
        }