+
+
+inline void
+dump_node_opcode (ir_node *n)
+{
+ /* Const */
+ if (n->op->code == iro_Const) {
+ xfprintf (F, "%v", n->attr.con);
+ /* SymConst */
+ } else if (n->op->code == iro_SymConst) {
+ if (get_SymConst_kind(n) == linkage_ptr_info) {
+ xfprintf (F, "%I", get_SymConst_ptrinfo(n));
+ } else {
+ assert(get_kind(get_SymConst_type(n)) == k_type_class);
+ assert(get_class_ident((type_class *)get_SymConst_type(n)));
+ xfprintf (F, "%s ", id_to_str(get_class_ident((type_class *)get_SymConst_type(n))));
+ if (get_SymConst_kind == type_tag)
+ xfprintf (F, "tag");
+ else
+ xfprintf (F, "size");
+ }
+ /* all others */
+ } else {
+ xfprintf (F, "%I", get_irn_opident(n));
+ }
+}
+
+inline void
+dump_node_mode (ir_node *n)
+{
+ switch (n->op->code) {
+ case iro_Phi:
+ case iro_Const:
+ case iro_Id:
+ case iro_Proj:
+ case iro_Conv:
+ case iro_Tuple:
+ case iro_Add:
+ case iro_Sub:
+ case iro_Mul:
+ case iro_And:
+ case iro_Or:
+ case iro_Eor:
+ case iro_Shl:
+ case iro_Shr:
+ case iro_Abs:
+ case iro_Cmp:
+ xfprintf (F, "%I", get_mode_ident(n->mode));
+ break;
+ default:
+ }
+}
+
+inline void
+dump_node_nodeattr (ir_node *n)
+{
+ switch (n->op->code) {
+ case iro_Proj:
+ if (n->in[1]->op->code == iro_Cmp) {
+ xfprintf (F, "%s", get_pnc_string(n->attr.proj));
+ } else {
+ xfprintf (F, "%ld", n->attr.proj);
+ }
+ break;
+ case iro_Sel:
+ /*assert(n->attr.s.ent->kind == k_entity);*/
+ assert(get_kind(get_Sel_entity(n)) == k_entity);
+ xfprintf (F, "%s", id_to_str(get_entity_ident(get_Sel_entity(n))));
+
+ /* xdoesn't work for some reason.
+ fprintf (F, "\"%I %I\" ", get_irn_opident(n), n->attr.s.ent); */
+ break;
+ default:
+ } /* end switch */
+}
+
+inline void
+dump_node_vcgattr (ir_node *n)
+{
+ switch (n->op->code) {
+ case iro_Start:
+ case iro_End:
+ xfprintf (F, "color: blue");
+ break;
+ case iro_Block:
+ xfprintf (F, "color: lightyellow");
+ break;
+ case iro_Phi:
+ xfprintf (F, "color: green");
+ break;
+ case iro_Const:
+ case iro_Proj:
+ case iro_Tuple:
+ xfprintf (F, "color: yellow");
+ break;
+ default:
+ xfprintf (F, DEFAULT_NODE_ATTR);
+ }
+}
+
+void
+dump_node (ir_node *n) {
+
+ /* dump this node */
+ xfprintf (F, "node: {title: \""); PRINT_NODEID(n); fprintf(F, "\" label: \"");
+
+ dump_node_opcode(n);
+ dump_node_mode (n);
+ xfprintf (F, " ");
+ dump_node_nodeattr(n);
+#ifdef DEBUG_libfirm
+ xfprintf (F, " %ld", get_irn_node_nr(n));
+#endif
+ xfprintf (F, "\" ");
+ dump_node_vcgattr(n);
+ xfprintf (F, "}\n");
+}
+