- /* dump this node */
- fprintf (F, "node: {title: \""); PRINT_NODEID(n); fprintf(F, "\" label: ");
-
- switch (n->op->code) { /* node label */
- case iro_Start:
- xfprintf (F, "\"%I\" color: blue ", get_irn_opident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_EndReg:
- /* fall through */
- case iro_EndExcept:
- /* fall through */
- case iro_End:
- xfprintf (F, "\"%I\" color: blue ", get_irn_opident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Block:
- xfprintf (F, "\"%I\" color: lightyellow ", get_irn_opident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Phi:
- xfprintf (F, "\"%I%I\" color: green", get_irn_opident(n), get_irn_modeident(n));
- if (get_irn_modecode(n) == irm_M)
- xfprintf (F, DEFAULT_NODE_ATTR " color: green");
- else
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Const:
- xfprintf (F, "\"%v%I\" color: yellow ", n->attr.con, get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Id:
- xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Proj:
- if (n->in[1]->op->code == iro_Cmp) {
- xfprintf (F, "\"%I%I %s\" color: yellow", get_irn_opident(n), get_irn_modeident(n),
- get_pnc_string(n->attr.proj));
- } else {
- xfprintf (F, "\"%I%I %ld\"", get_irn_opident(n), get_irn_modeident(n), n->attr.proj);
- }
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Filter:
- xfprintf (F, "\"%I%I %ld\"", get_irn_opident(n), get_irn_modeident(n), n->attr.filter.proj);
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Conv:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Tuple:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Add:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Sub:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Mul:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Quot:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_DivMod:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Div:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Mod:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_And:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Or:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Eor:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Shl:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Shr:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Abs:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Cmp:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Jmp:
- xfprintf (F, "\"%I\"", get_irn_opident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Break:
- xfprintf (F, "\"%I\"", get_irn_opident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Cond:
- xfprintf (F, "\"%I\"", get_irn_opident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Call:
- xfprintf (F, "\"%I\"", get_irn_opident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_CallBegin:
- xfprintf (F, "\"%I\"", get_irn_opident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Return:
- xfprintf (F, "\"%I\"", get_irn_opident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Raise:
- xfprintf (F, "\"%I%I\"", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Load:
- case iro_Store:
- xfprintf (F, "\"%R\"", n);
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Alloc:
- xfprintf (F, "\"%I\" ", get_irn_opident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Sel:
- assert(get_kind(get_Sel_entity(n)) == k_entity);
- xfprintf (F, "\"%I ", get_irn_opident(n));
- xfprintf (F, "%I", get_entity_ident(get_Sel_entity(n)));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_SymConst:
- assert(get_kind(get_SymConst_type(n)) == k_type);
- assert(get_type_ident(get_SymConst_type(n)));
- xfprintf (F, "\"%s ", get_type_name(get_SymConst_type(n)));
- switch (n->attr.i.num){
- case type_tag:
- xfprintf (F, "tag\" ");
- break;
- case size:
- xfprintf (F, "size\" ");
- break;
- default:
- assert(0);
- break;
- }
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Sync:
- xfprintf (F, "\"%I\" ", get_irn_opident(n));
- xfprintf (F, DEFAULT_NODE_ATTR " color: green");
- break;
- case iro_Bad:
- xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- case iro_Unknown:
- xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
- xfprintf (F, DEFAULT_NODE_ATTR);
- break;
- default:
- xfprintf (F, "\"%I%I\" ", get_irn_opident(n), get_irn_modeident(n));
- }
- xfprintf (F, "}\n"); /* footer */
-}
-
-
-/* dump the edge to the block this node belongs to */
-static void
-dump_ir_block_edge(ir_node *n) {
- if (dump_const_local_set() && is_constlike_node(n)) return;
- if (is_no_Block(n)) {
- xfprintf (F, "edge: { sourcename: \"");
- PRINT_NODEID(n);
- xfprintf (F, "\" targetname: \"");
- PRINT_NODEID(get_nodes_Block(n));
- xfprintf (F, "\" " BLOCK_EDGE_ATTR "}\n");
- }
-}
-
-static void print_edge_vcgattr(ir_node *from, int to) {
- assert(from);
-
- if (is_backedge(from, to)) xfprintf (F, BACK_EDGE_ATTR);
-
- switch (get_irn_opcode(from)) {
- case iro_Block:
- xfprintf (F, CF_EDGE_ATTR);
- break;
- case iro_Start: break;
- case iro_End:
- if (to >= 0) {
- if (get_irn_mode(get_End_keepalive(from, to)) == mode_BB)
- xfprintf (F, CF_EDGE_ATTR);
- if (get_irn_mode(get_End_keepalive(from, to)) == mode_X)
- xfprintf (F, MEM_EDGE_ATTR);
- }
- break;
- case iro_EndReg: break;
- case iro_EndExcept: break;
- case iro_Jmp: break;
- case iro_Break: break;
- case iro_Cond: break;
- case iro_Return:
- case iro_Raise:
- if (to == 0) xfprintf (F, MEM_EDGE_ATTR);
- break;
- case iro_Const: break;
- case iro_SymConst:break;
- case iro_Sel:
- case iro_Call:
- if (to == 0) xfprintf (F, MEM_EDGE_ATTR);
- break;
- case iro_CallBegin: break;
- case iro_Add: break;
- case iro_Sub: break;
- case iro_Minus: break;
- case iro_Mul: break;
- case iro_Quot:
- case iro_DivMod:
- case iro_Div:
- case iro_Mod:
- if (to == 0) xfprintf (F, MEM_EDGE_ATTR);
- break;
- case iro_Abs: break;
- case iro_And: break;
- case iro_Or: break;
- case iro_Eor: break;
- case iro_Shl: break;
- case iro_Shr: break;
- case iro_Shrs: break;
- case iro_Rot: break;
- case iro_Cmp: break;
- case iro_Conv: break;
- case iro_Phi:
- if (get_irn_modecode(from) == irm_M) xfprintf (F, MEM_EDGE_ATTR);
- break;
- case iro_Load:
- case iro_Store:
- case iro_Alloc:
- case iro_Free:
- if (to == 0) xfprintf (F, MEM_EDGE_ATTR);
- break;
- case iro_Sync:
- xfprintf (F, MEM_EDGE_ATTR);
- break;
- case iro_Tuple: break;
- case iro_Proj:
- case iro_Filter:
- switch (get_irn_modecode(from)) {
- case irm_X:
- xfprintf (F, CF_EDGE_ATTR);
- break;
- case irm_M:
- xfprintf (F, MEM_EDGE_ATTR);
- break;
- default: break;
- }
- break;
- case iro_Bad: break;
- case iro_Unknown: break;
- case iro_Id: break;
- default:
- ;
- }
-}
-
-/* dump edges to our inputs */
-static void
-dump_ir_data_edges(ir_node *n) {
- int i, visited = get_irn_visited(n);
-
- if ((get_irn_op(n) == op_End) && (!dump_keepalive))
- return;
-
- for (i = 0; i < get_irn_arity(n); i++) {
- ir_node * pred = get_irn_n(n, i);
- assert(pred);
- if ((interprocedural_view && get_irn_visited(pred) < visited))
- continue; /* pred not dumped */
- if (is_backedge(n, i))
- fprintf (F, "backedge: {sourcename: \"");
- else
- fprintf (F, "edge: {sourcename: \"");
- PRINT_NODEID(n);
- fprintf (F, "\" targetname: \"");
- if ((dump_const_local_set()) && is_constlike_node(pred))
- PRINT_NODEID(n);
- PRINT_NODEID(pred);
- fprintf (F, "\"");
- fprintf (F, " label: \"%d\" ", i);
- print_edge_vcgattr(n, i);
- fprintf (F, "}\n");
- }