*/
/**
- * @file irprinf.c
+ * @file irprintf.c
*
* A little printf helper unterstanding firm types.
* @author Sebastian Hack
#include "pset.h"
#include "iterator.h"
#include "bitset.h"
+#include "dbginfo_t.h"
#define STRNIL "(nil)"
snprintf(buf, sizeof(buf), "%p", va_arg(args, void *));
break;
+ case 'i':
case 'd':
+ case 'u':
case 'x':
case 'X':
case 'o':
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));
}
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);
}