X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firdump.c;h=d3729aea7ef7296c1bd2c4237e1fb136760e59fc;hb=478fdb370b1098bd2efcbb964d60e9fcbeb5d205;hp=c01465590c628f169d734cfa562eec3aad38ec5e;hpb=d9bef16cf09218c009110a0ce40c061a471f5b9d;p=libfirm diff --git a/ir/ir/irdump.c b/ir/ir/irdump.c index c01465590..d3729aea7 100644 --- a/ir/ir/irdump.c +++ b/ir/ir/irdump.c @@ -6,7 +6,7 @@ * Modified by: Goetz Lindenmaier, Hubert Schmidt * Created: * CVS-ID: $Id$ - * Copyright: (c) 1998-2003 Universit�t Karlsruhe + * Copyright: (c) 1998-2006 Universit�t Karlsruhe * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. */ #ifdef HAVE_CONFIG_H @@ -111,6 +111,19 @@ DUMP_NODE_EDGE_FUNC get_dump_node_edge_hook(void) } +static DUMP_NODE_EDGE_FUNC dump_block_edge_hook = NULL; + +void set_dump_block_edge_hook(DUMP_NODE_EDGE_FUNC func) +{ + dump_block_edge_hook = func; +} + +DUMP_NODE_EDGE_FUNC get_dump_block_edge_hook(void) +{ + return dump_node_edge_hook; +} + + /** The vcg node attribute hook. */ static DUMP_IR_GRAPH_FUNC dump_ir_graph_hook = NULL; /** The vcg node attribute hook. */ @@ -658,21 +671,29 @@ int dump_node_opcode(FILE *F, ir_node *n) } break; case iro_SymConst: { - if (get_SymConst_kind(n) == symconst_addr_name) { + switch (get_SymConst_kind(n)) { + case symconst_addr_name: /* don't use get_SymConst_ptr_info as it mangles the name. */ - fprintf (F, "SymC %s", get_id_str(get_SymConst_name(n))); - } else if (get_SymConst_kind(n) == symconst_addr_ent) { - assert(get_SymConst_entity(n)); - assert(is_entity(get_SymConst_entity(n))); - fprintf (F, "SymC &%s", get_entity_name(get_SymConst_entity(n))); - } else { - assert(get_kind(get_SymConst_type(n)) == k_type); - assert(get_type_ident(get_SymConst_type(n))); - fprintf (F, "SymC %s ", get_type_name_ex(get_SymConst_type(n), &bad)); - if (get_SymConst_kind(n) == symconst_type_tag) - fprintf (F, "tag"); - else - fprintf (F, "size"); + fprintf(F, "SymC %s", get_id_str(get_SymConst_name(n))); + break; + case symconst_addr_ent: + fprintf(F, "SymC &%s", get_entity_name(get_SymConst_entity(n))); + break; + case symconst_ofs_ent: + fprintf(F, "SymC %s offset", get_entity_name(get_SymConst_entity(n))); + break; + case symconst_type_tag: + fprintf(F, "SymC %s tag", get_type_name_ex(get_SymConst_type(n), &bad)); + break; + case symconst_type_size: + fprintf(F, "SymC %s size", get_type_name_ex(get_SymConst_type(n), &bad)); + break; + case symconst_type_align: + fprintf(F, "SymC %s align", get_type_name_ex(get_SymConst_type(n), &bad)); + break; + case symconst_enum_const: + fprintf(F, "SymC %s enum", get_enumeration_name(get_SymConst_enum(n))); + break; } } break; @@ -720,6 +741,11 @@ int dump_node_opcode(FILE *F, ir_node *n) case iro_Block: fprintf (F, "%s%s", is_Block_dead(n) ? "Dead " : "", get_irn_opname(n)); break; + case iro_Conv: + if (get_Conv_strict(n)) + fprintf (F, "strict"); + fprintf (F, "%s", get_irn_opname(n)); + break; default: default_case: @@ -805,6 +831,7 @@ static const pns_lookup_t start_lut[] = { X(X_initial_exec), X(P_frame_base), X(P_globals), + X(P_tls), X(T_args), X(P_value_arg_base) #undef X @@ -925,7 +952,6 @@ static const pns_lookup_t bound_lut[] = { X(M), X(X_except), X(res), - X(M_except) #undef X }; @@ -1115,6 +1141,9 @@ static void dump_node_vcgattr(FILE *F, ir_node *node, ir_node *local, int bad) case iro_Psi: print_vcg_color(F, ird_color_gold); break; + case iro_Pin: + print_vcg_color(F, ird_color_orchid); + break; case iro_Const: case iro_Proj: case iro_Filter: @@ -1412,34 +1441,54 @@ print_edge_vcgattr(FILE *F, ir_node *from, int to) { /* dump edges to our inputs */ static void dump_ir_data_edges(FILE *F, ir_node *n) { - int i; - unsigned long 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 ((get_interprocedural_view() && get_irn_visited(pred) < visited)) - continue; /* pred not dumped */ - - if (dump_backedge_information_flag && is_backedge(n, i)) - fprintf (F, "backedge: {sourcename: \""); - else - fprintf (F, "edge: {sourcename: \""); - PRINT_NODEID(n); - fprintf (F, "\" targetname: "); - if ((get_opt_dump_const_local()) && is_constlike_node(pred)) { - PRINT_CONSTID(n, pred); - } else { - fprintf(F, "\""); PRINT_NODEID(pred); fprintf(F, "\""); - } - fprintf (F, " label: \"%d\" ", i); - print_edge_vcgattr(F, n, i); - fprintf (F, "}\n"); - } + int i; + unsigned long visited = get_irn_visited(n); + + if ((get_irn_op(n) == op_End) && (!dump_keepalive)) + return; + + /* dump the dependency edges. */ + for (i = 0; i < get_irn_deps(n); ++i) { + ir_node *dep = get_irn_dep(n, i); + + if(dep) { + fprintf(F, "edge: {sourcename: \""); + PRINT_NODEID(n); + fprintf(F, "\" targetname: "); + if ((get_opt_dump_const_local()) && is_constlike_node(dep)) { + PRINT_CONSTID(n, dep); + } else { + fprintf(F, "\""); + PRINT_NODEID(dep); + fprintf(F, "\""); + } + fprintf(F, " label: \"%d\" ", i); + fprintf(F, " color: darkgreen}\n"); + } + } + + for (i = 0; i < get_irn_arity(n); i++) { + ir_node * pred = get_irn_n(n, i); + assert(pred); + + if ((get_interprocedural_view() && get_irn_visited(pred) < visited)) + continue; /* pred not dumped */ + + if (dump_backedge_information_flag && is_backedge(n, i)) + fprintf (F, "backedge: {sourcename: \""); + else + fprintf (F, "edge: {sourcename: \""); + PRINT_NODEID(n); + fprintf (F, "\" targetname: "); + if ((get_opt_dump_const_local()) && is_constlike_node(pred)) { + PRINT_CONSTID(n, pred); + } else { + fprintf(F, "\""); PRINT_NODEID(pred); fprintf(F, "\""); + } + fprintf (F, " label: \"%d\" ", i); + print_edge_vcgattr(F, n, i); + fprintf (F, "}\n"); + } } /** Dumps a node and its edges but not the block edge @@ -1524,6 +1573,9 @@ dump_whole_block(FILE *F, ir_node *block) { /* dump the blocks edges */ dump_ir_data_edges(F, block); + if (dump_block_edge_hook) + dump_block_edge_hook(F, block); + /* dump the nodes that go into the block */ for (node = ird_get_irn_link(block); node; node = ird_get_irn_link(node)) { dump_node(F, node); @@ -1660,11 +1712,8 @@ static void dump_node2type_edges(ir_node *n, void *env) /* @@@ some consts have an entity */ break; case iro_SymConst: - if ( (get_SymConst_kind(n) ==symconst_type_tag) - || (get_SymConst_kind(n) ==symconst_size)) - { - print_node_type_edge(F,n,get_SymConst_type(n),NODE2TYPE_EDGE_ATTR); - } + if (SYMCONST_HAS_TYPE(get_SymConst_kind(n))) + print_node_type_edge(F,n,get_SymConst_type(n),NODE2TYPE_EDGE_ATTR); break; case iro_Sel: { print_node_ent_edge(F,n,get_Sel_entity(n),NODE2TYPE_EDGE_ATTR); @@ -1821,16 +1870,20 @@ void dump_entity_node(FILE *F, entity *ent, int color) static void dump_enum_item(FILE *F, ir_type *tp, int pos) { char buf[1024]; - ident *id = get_enumeration_nameid(tp, pos); - tarval *tv = get_enumeration_enum(tp, pos); + ir_enum_const *ec = get_enumeration_const(tp, pos); + ident *id = get_enumeration_nameid(ec); + tarval *tv = get_enumeration_value(ec); - tarval_snprintf(buf, sizeof(buf), tv); - fprintf (F, "node: {title: \""); + if (tv) + tarval_snprintf(buf, sizeof(buf), tv); + else + strncpy(buf, "", sizeof(buf)); + fprintf(F, "node: {title: \""); PRINT_ITEMID(tp, pos); fprintf(F, "\""); - fprintf (F, DEFAULT_ENUM_ITEM_ATTRIBUTE); - fprintf (F, "label: "); - fprintf (F, "\"enum item %s\" " ENUM_ITEM_NODE_ATTR, get_id_str(id)); - fprintf (F, "\n info1: \"value: %s\"}\n", buf); + fprintf(F, DEFAULT_ENUM_ITEM_ATTRIBUTE); + fprintf(F, "label: "); + fprintf(F, "\"enum item %s\" " ENUM_ITEM_NODE_ATTR, get_id_str(id)); + fprintf(F, "\n info1: \"value: %s\"}\n", buf); } /* dumps a type or entity and it's edges. */ @@ -2204,7 +2257,7 @@ FILE *vcg_open (ir_graph *irg, const char * suffix1, const char *suffix2) { if (!suffix2) suffix2 = ""; /* open file for vcg graph */ - fname = malloc (len * 2 + strlen(suffix1) + strlen(suffix2) + 5); + fname = xmalloc (len * 2 + strlen(suffix1) + strlen(suffix2) + 5); /* strncpy (fname, nm, len); */ /* copy the filename */ j = 0;