X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firdump.c;h=386d9eb4039bcc4c23911758ff75d83bb88f34fa;hb=8eea5eff43cbc4cc012f87645e738566e8a7d48f;hp=bf0c81aa384ac372248d19db635277ab78e12612;hpb=cdd903d8e390c19bf09b67bb991b45dde115050e;p=libfirm diff --git a/ir/ir/irdump.c b/ir/ir/irdump.c index bf0c81aa3..386d9eb40 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 @@ -671,21 +671,26 @@ 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_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; @@ -733,6 +738,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: @@ -1128,6 +1138,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: @@ -1425,34 +1438,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 @@ -1834,16 +1867,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. */ @@ -2217,7 +2254,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;