# include <config.h>
#endif
+# include <string.h>
+# include <stdlib.h>
+
# include "irnode_t.h"
# include "irgraph_t.h"
-# include "irprog.h"
-# include "irdump.h"
-# include "panic.h"
-# include <string.h>
# include "entity_t.h"
-# include <stdlib.h>
-# include "array.h"
# include "irop_t.h"
-# include "tv.h"
-# include "type_or_entity.h"
+# include "firm_common_t.h"
+
+# include "irdump.h"
+
# include "irgwalk.h"
# include "typewalk.h"
+# include "irprog.h"
+# include "tv.h"
+# include "type_or_entity.h"
# include "irouts.h"
# include "irdom.h"
-# include "firm_common_t.h"
-# include "irloop.h"
+# include "irloop.h"
+
+# include "panic.h"
+# include "array.h"
+# include "pmap.h"
# include "exc.h"
-# include "pmap.h"
/* Attributes of nodes */
#define DEFAULT_NODE_ATTR ""
}
xfprintf(F, "\nname: %I\nld_name: %I", get_entity_ident(ent), get_entity_ld_ident(ent));
fprintf(F, "\noffset: %d", get_entity_offset(ent));
- if (is_method_type(get_entity_type(ent)))
- { fprintf (F, "\nirg = "); PRINT_IRGID(get_entity_irg(ent)); }
+ if (is_method_type(get_entity_type(ent))) {
+ if (get_entity_irg(ent)) /* can be null */
+ { fprintf (F, "\nirg = "); PRINT_IRGID(get_entity_irg(ent)); }
+ else
+ { fprintf (F, "\nirg = NULL"); }
+ }
fprintf(F, "\"\n}\n");
}
/* skip this to reduce graph. Member edge of type is parallel to this edge. *
fprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
ENT_OWN_EDGE_ATTR "}\n", ent, get_entity_owner(ent));*/
- PRINT_ENT_TYPE_EDGE(ent,get_entity_type(ent),ENT_TYPE_EDGE_ATTR);
+ PRINT_ENT_TYPE_EDGE(ent, get_entity_type(ent), ENT_TYPE_EDGE_ATTR);
if(is_class_type(get_entity_owner(ent))) {
for(i = 0; i < get_entity_n_overwrites(ent); i++){
- PRINT_ENT_ENT_EDGE(ent,get_entity_overwrites(ent, i), ENT_OVERWRITES_EDGE_ATTR);
+ PRINT_ENT_ENT_EDGE(ent, get_entity_overwrites(ent, i), ENT_OVERWRITES_EDGE_ATTR);
}
}
/* attached subgraphs */
if (is_atomic_entity(ent)) {
value = get_atomic_ent_value(ent);
if (value) {
- PRINT_ENT_NODE_EDGE(ent,value,ENT_VALUE_EDGE_ATTR,i);
- /*
+ PRINT_ENT_NODE_EDGE(ent, value, ENT_VALUE_EDGE_ATTR, i);
+ /*
fprintf (F, "edge: { sourcename: \"%p\" targetname: \"", GET_ENTID(ent));
PRINT_NODEID(value);
fprintf(F, "\" " ENT_VALUE_EDGE_ATTR "\"}\n");
if (value) {
PRINT_ENT_NODE_EDGE(ent,value,ENT_VALUE_EDGE_ATTR,i);
dump_const_expression(value);
- PRINT_ENT_ENT_EDGE(ent,get_compound_ent_value_member(ent, i),ENT_CORR_EDGE_ATTR,i);
+ PRINT_ENT_ENT_EDGE(ent, get_compound_ent_value_member(ent, i), ENT_CORR_EDGE_ATTR, i);
/*
- fprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
- ENT_CORR_EDGE_ATTR "}\n", GET_ENTID(ent),
- get_compound_ent_value_member(ent, i), i);
- */
+ fprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
+ ENT_CORR_EDGE_ATTR "}\n", GET_ENTID(ent),
+ get_compound_ent_value_member(ent, i), i);
+ */
}
}
}
} break;
case k_type:
{
-#ifndef DEBUG
type *tp = (type *)tore;
-#endif
-
-
print_type_node(tp);
/* and now the edges */
switch (get_type_tpop_code(tp)) {
case tpo_class:
{
- for (i=0; i < get_class_n_supertypes(tp); i++)
- {
- PRINT_TYPE_TYPE_EDGE(tp,get_class_supertype(tp, i),TYPE_SUPER_EDGE_ATTR);
+ for (i=0; i < get_class_n_supertypes(tp); i++) {
+ PRINT_TYPE_TYPE_EDGE(tp,get_class_supertype(tp, i),TYPE_SUPER_EDGE_ATTR);
}
- for (i=0; i < get_class_n_members(tp); i++)
- {
- PRINT_TYPE_ENT_EDGE(tp,get_class_member(tp, i),TYPE_MEMBER_EDGE_ATTR);
+ for (i=0; i < get_class_n_members(tp); i++) {
+ PRINT_TYPE_ENT_EDGE(tp,get_class_member(tp, i),TYPE_MEMBER_EDGE_ATTR);
}
} break;
case tpo_struct:
{
- for (i=0; i < get_struct_n_members(tp); i++)
- {
- PRINT_TYPE_ENT_EDGE(tp,get_struct_member(tp, i),TYPE_MEMBER_EDGE_ATTR);
+ for (i=0; i < get_struct_n_members(tp); i++) {
+ PRINT_TYPE_ENT_EDGE(tp,get_struct_member(tp, i),TYPE_MEMBER_EDGE_ATTR);
}
} break;
case tpo_method:
/*@{*/
/** Makros for debugging the libfirm */
#ifdef __GNUC__
-/*
- * GNU C has the __FUNCTION__ extension
- */
-#define DDMSG printf("%s(l.%i)\n", __FUNCTION__, __LINE__)
-#define DDMSG1(X) printf("%s(l.%i) %s\n", __FUNCTION__, __LINE__, id_to_str(get_irn_opident(X)))
-#define DDMSG2(X) printf("%s(l.%i) %s%s: %ld\n", __FUNCTION__, __LINE__, id_to_str(get_irn_opident(X)), id_to_str(get_irn_modeident(X)), get_irn_node_nr(X))
-#define DDMSG3(X) printf("%s(l.%i) %s: %p\n", __FUNCTION__, __LINE__, print_firm_kind(X), (X))
-#define DDMSG4(X) xprintf("%s(l.%i) %I %I: %p\n", __FUNCTION__, __LINE__, get_type_tpop_nameid(X), get_type_ident(X), (X))
-#define DDMSG5(X) printf("%s%s: %ld", id_to_str(get_irn_opident(X)), id_to_str(get_irn_modeident(X)), get_irn_node_nr(X))
-
+/* GNU C has the extension */
+#define __MYFUNC__ __FUNCTION__
+#else
+/* use Filename instead */
+#define __MYFUNC__ __FILE__
+#endif
-#define DDMN(X) xprintf("%s(l.%i) %I%I: %ld (%p)\n", __FUNCTION__, __LINE__, get_irn_opident(X), get_irn_modeident(X), get_irn_node_nr(X), (X))
-#define DDMNB(X) xprintf("%I%I: %ld (in block %ld)\n", get_irn_opident(X), get_irn_modeident(X), get_irn_node_nr(X), get_irn_node_nr(get_nodes_Block(X)))
-#define DDMT(X) xprintf("%s(l.%i) %I %I: %p\n", __FUNCTION__, __LINE__, get_type_tpop_nameid(X), get_type_ident(X), (X))
-#define DDME(X) xprintf("%s(l.%i) %I: %p\n", __FUNCTION__, __LINE__, get_entity_ident(X), (X))
-#define DDMEO(X) xprintf("%s(l.%i) %I (own: %I): %p\n", __FUNCTION__, __LINE__, get_entity_ident(X), get_type_ident(get_entity_owner(X)), (X))
-#define DDMG(X) xprintf("%s(l.%i) %I: %p\n", __FUNCTION__, __LINE__, get_irg_ent(get_entity_ident(X)), (X))
+/** Output the firm kind of the node */
+#define DDMK(X) printf("%s(l.%i) %s: %p\n", __MYFUNC__, __LINE__, \
+ print_firm_kind(X), (X));
+/** Output information about a node */
+#define DDMN(X) printf("%s(l.%i) %s%s: %ld (%p)\n", __MYFUNC__, __LINE__, \
+ get_irn_opname(X), get_mode_name(get_irn_mode(X)), get_irn_node_nr(X), (X))
+/** Output information about a node and its block */
+#define DDMNB(X) printf("%s%s: %ld (in block %ld)\n", get_irn_opname(X), \
+ get_mode_name(get_irn_mode(X)), get_irn_node_nr(X), \
+ get_irn_node_nr(get_nodes_Block(X)))
+/** Output information about a type */
+#define DDMT(X) printf("%s(l.%i) %s %s: %ld (%p)\n", __MYFUNC__, __LINE__, \
+ get_type_tpop_name(X), get_type_name(X), get_type_nr(X), (X))
+/** Output information about an entity */
+#define DDME(X) printf("%s(l.%i) %s: %ld (%p\n", __MYFUNC__, __LINE__, \
+ get_entity_name(X), get_entity_nr(X), (X))
+/** Output information about an entity and its owner */
+#define DDMEO(X) printf("%s(l.%i) %s (own: %s): %ld (%p)\n", __MYFUNC__, __LINE__, \
+ get_entity_name(X), get_type_name(get_entity_owner(X)), get_entity_nr(X), (X))
+/** Output information about a graph */
+#define DDMG(X) printf("%s(l.%i) %s: %ld (%p)\n", __MYFUNC__, __LINE__, \
+ get_entity_name(get_irg_ent(X)), get_irg_graph_nr(X), (X))
+/** Output information about an ident */
+#define DDMI(X) printf("%s(l.%i) %s: %p\n", __MYFUNC__, __LINE__, \
+ id_to_str(X), (X))
+/** Output information about a mode */
+#define DDMM(X) printf("%s(l.%i) %s: %p\n", __MYFUNC__, __LINE__, \
+ get_mode_name(X), (X))
-#else
-/*
- * use Filename instead
- */
-#define DDMSG printf("%s(l.%i)\n", __FILE__, __LINE__)
-#define DDMSG1(X) printf("%s(l.%i) %s\n", __FILE__, __LINE__, id_to_str(get_irn_opident(X)))
-#define DDMSG2(X) printf("%s(l.%i) %s%s: %ld\n", __FILE__, __LINE__, id_to_str(get_irn_opident(X)), id_to_str(get_irn_modeident(X)), get_irn_node_nr(X))
-#define DDMSG3(X) printf("%s(l.%i) %s: %p\n", __FILE__, __LINE__, print_firm_kind(X), (X))
-#define DDMSG4(X) xprintf("%s(l.%i) %I %I: %p\n", __FILE__, __LINE__, get_type_tpop_nameid(X), get_type_ident(X), (X))
-#define DDMSG5(X) printf("%s%s: %ld", id_to_str(get_irn_opident(X)), id_to_str(get_irn_modeident(X)), get_irn_node_nr(X))
-
-
-#define DDMN(X) xprintf("%s(l.%i) %I%I: %ld (%p)\n", __FILE__, __LINE__, get_irn_opident(X), get_irn_modeident(X), get_irn_node_nr(X), (X))
-#define DDMNB(X) xprintf("%I%I: %ld (in block %ld)\n", get_irn_opident(X), get_irn_modeident(X), get_irn_node_nr(X), get_irn_node_nr(get_nodes_Block(X)))
-#define DDMT(X) xprintf("%s(l.%i) %I %I: %p\n", __FILE__, __LINE__, get_type_tpop_nameid(X), get_type_ident(X), (X))
-#define DDME(X) xprintf("%s(l.%i) %I: %p\n", __FILE__, __LINE__, get_entity_ident(X), (X))
-#define DDMG(X) xprintf("%s(l.%i) %I: %p\n", __FILE__, __LINE__, get_irg_ent(get_entity_ident(X)), (X))
-#define DDMI(X) xprintf("%s(l.%i) %I: %p\n", __FILE__, __LINE__, (X), (X))
-#define DDMM(X) xprintf("%s(l.%i) %I: %p\n", __FILE__, __LINE__, get_mode_ident(X), (X))
-
-#endif /* __GNUC__ */
/*@}*/ /* Macros for debug.. */
/*@}*/ /* end of ir_node group definition */