Ignore generated files.
[libfirm] / ir / ir / irdump.c
index 862b58b..5b9577c 100644 (file)
@@ -259,17 +259,6 @@ const char *get_mode_name_ex(const ir_mode *mode, int *bad) {
        return ERROR_TXT;
 }
 
-/**
- * returns the name of a type or <ERROR> if mode is NOT a mode object.
- * in the later case, sets bad
- */
-const char *get_type_name_ex(const ir_type *tp, int *bad) {
-       if (is_type(tp))
-               return get_type_name(tp);
-       *bad |= 1;
-       return ERROR_TXT;
-}
-
 #define CUSTOM_COLOR_BASE    100
 static const char *color_names[ird_color_count];
 static const char *color_rgb[ird_color_count];
@@ -760,16 +749,16 @@ int dump_node_opcode(FILE *F, ir_node *n)
                        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));
+                       ir_fprintf(F, "SymC %+F tag", get_SymConst_type(n));
                        break;
                case symconst_type_size:
-                       fprintf(F, "SymC %s size", get_type_name_ex(get_SymConst_type(n), &bad));
+                       ir_fprintf(F, "SymC %+F size", get_SymConst_type(n));
                        break;
                case symconst_type_align:
-                       fprintf(F, "SymC %s align", get_type_name_ex(get_SymConst_type(n), &bad));
+                       ir_fprintf(F, "SymC %+F align", get_SymConst_type(n));
                        break;
                case symconst_enum_const:
-                       fprintf(F, "SymC %s enum", get_enumeration_name(get_SymConst_enum(n)));
+                       fprintf(F, "SymC %s enum", get_enumeration_const_name(get_SymConst_enum(n)));
                        break;
                }
                break;
@@ -903,10 +892,11 @@ static int dump_node_typeinfo(FILE *F, ir_node *n) {
                if (get_irg_typeinfo_state(current_ir_graph) == ir_typeinfo_consistent  ||
                        get_irg_typeinfo_state(current_ir_graph) == ir_typeinfo_inconsistent) {
                        ir_type *tp = get_irn_typeinfo_type(n);
-                       if (tp != firm_none_type)
-                               fprintf(F, "[%s] ", get_type_name_ex(tp, &bad));
-                       else
+                       if (tp != firm_none_type) {
+                               ir_fprintf(F, "[%+F]", tp);
+                       } else {
                                fprintf(F, "[] ");
+                       }
                }
        }
        return bad;
@@ -946,11 +936,10 @@ static const pns_lookup_t cond_lut[] = {
 /** the lookup table for Proj(Call) names */
 static const pns_lookup_t call_lut[] = {
 #define X(a)    { pn_Call_##a, #a }
-       X(M_regular),
+       X(M),
        X(X_regular),
        X(X_except),
        X(T_result),
-       X(M_except),
        X(P_value_res_base)
 #undef X
 };
@@ -1031,7 +1020,6 @@ static const pns_lookup_t copyb_lut[] = {
        X(M),
        X(X_regular),
        X(X_except),
-       X(M_except)
 #undef X
 };
 
@@ -1042,7 +1030,6 @@ static const pns_lookup_t instof_lut[] = {
        X(X_regular),
        X(X_except),
        X(res),
-       X(M_except),
 #undef X
 };
 
@@ -1161,13 +1148,13 @@ handle_lut:
                fprintf(F, "%s ", get_ent_dump_name(get_Sel_entity(n)));
                break;
        case iro_Cast:
-               fprintf(F, "(%s) ", get_type_name_ex(get_Cast_type(n), &bad));
+               ir_fprintf(F, "(%+F)", get_Cast_type(n));
                break;
        case iro_Confirm:
                fprintf(F, "%s ", get_pnc_string(get_Confirm_cmp(n)));
                break;
        case iro_CopyB:
-               fprintf(F, "(%s) ", get_type_name_ex(get_CopyB_type(n), &bad));
+               ir_fprintf(F, "(%+F)", get_CopyB_type(n));
                break;
 
        default:
@@ -1200,6 +1187,7 @@ int dump_node_label(FILE *F, ir_node *n) {
        int bad = 0;
 
        bad |= dump_node_opcode(F, n);
+       fputs(" ", F);
        bad |= dump_node_mode(F, n);
        fprintf(F, " ");
        bad |= dump_node_typeinfo(F, n);
@@ -1213,6 +1201,29 @@ int dump_node_label(FILE *F, ir_node *n) {
        return bad;
 }
 
+/* Dumps the vrp information of a node to a file */
+int dump_vrp_info(FILE *F, ir_node *n) {
+       if (!n->vrp.valid) {
+               return 1;
+       }
+
+       fprintf(F, "range_type: %d\n", n->vrp.range_type);
+       if (n->vrp.range_type == VRP_RANGE || n->vrp.range_type ==
+                       VRP_ANTIRANGE) {
+               ir_fprintf(F, "range_bottom: %F\n",n->vrp.range_bottom);
+               ir_fprintf(F, "range_top: %F\n", n->vrp.range_top);
+       }
+       ir_fprintf(F, "bits_set: %T\n", n->vrp.bits_set);
+       ir_fprintf(F, "bits_not_set: %T\n", n->vrp.bits_not_set);
+       if (n->vrp.bits_node == NULL) {
+               fprintf(F, "bits_node: None");
+       } else {
+               fprintf(F, "bits_node: #%ld\n", get_irn_node_nr(n->vrp.bits_node));
+       }
+
+       return 0;
+}
+
 /**
  * Dumps the attributes of a node n into the file F.
  * Currently this is only the color of a node.
@@ -1432,13 +1443,19 @@ static void print_dbg_info(FILE *F, dbg_info *dbg)
 {
        char buf[1024];
 
-       if (__dbg_info_snprint) {
-               buf[0] = '\0';
-               if (__dbg_info_snprint(buf, sizeof(buf), dbg) > 0)
-                       fprintf(F, " info3: \"%s\"\n", buf);
+       ir_dbg_info_snprint(buf, sizeof(buf), dbg);
+       if (buf[0] != 0) {
+               fprintf(F, " info3: \"%s\"\n", buf);
        }
 }
 
+static void print_type_dbg_info(FILE *F, type_dbg_info *dbg)
+{
+       (void) F;
+       (void) dbg;
+       /* TODO */
+}
+
 /**
  * Dump a node
  */
@@ -1953,10 +1970,7 @@ static void print_typespecific_info(FILE *F, ir_type *tp) {
 static void print_typespecific_vcgattr(FILE *F, ir_type *tp) {
        switch (get_type_tpop_code(tp)) {
        case tpo_class:
-               if (peculiarity_existent == get_class_peculiarity(tp))
-                       fprintf(F, " " TYPE_CLASS_NODE_ATTR);
-               else
-                       fprintf(F, " " TYPE_DESCRIPTION_NODE_ATTR);
+               fprintf(F, " " TYPE_CLASS_NODE_ATTR);
                break;
        case tpo_struct:
                fprintf(F, " " TYPE_METH_NODE_ATTR);
@@ -1978,23 +1992,16 @@ static void print_typespecific_vcgattr(FILE *F, ir_type *tp) {
        } /* switch type */
 }
 
-
 int dump_type_node(FILE *F, ir_type *tp)
 {
        int bad = 0;
 
        fprintf(F, "node: {title: ");
        PRINT_TYPEID(tp);
-       fprintf(F, " label: \"%s %s\"", get_type_tpop_name(tp), get_type_name_ex(tp, &bad));
-       fprintf(F, " info1: \"");
-#if 0
-       bad |= print_type_info(F, tp);
-       print_typespecific_info(F, tp);
-#else
+       ir_fprintf(F, " label: \"%s %+F\" info1: \"", get_type_tpop_name(tp), tp);
        dump_type_to_file(F, tp, dump_verbosity_max);
-#endif
        fprintf(F, "\"\n");
-       print_dbg_info(F, get_type_dbg_info(tp));
+       print_type_dbg_info(F, get_type_dbg_info(tp));
        print_typespecific_vcgattr(F, tp);
        fprintf(F, "}\n");
 
@@ -2024,7 +2031,7 @@ static void dump_enum_item(FILE *F, ir_type *tp, int pos)
 {
        char buf[1024];
        ir_enum_const *ec = get_enumeration_const(tp, pos);
-       ident         *id = get_enumeration_nameid(ec);
+       ident         *id = get_enumeration_const_nameid(ec);
        tarval        *tv = get_enumeration_value(ec);
 
        if (tv)
@@ -2071,33 +2078,23 @@ static void dump_type_info(type_or_ent tore, void *env) {
                                print_ent_ent_edge(F,ent, get_entity_overwrites(ent, i), 0, -1, ENT_OVERWRITES_EDGE_ATTR);
                }
                /* attached subgraphs */
-               if (const_entities && (get_entity_variability(ent) != variability_uninitialized)) {
-                       if (is_atomic_entity(ent)) {
-                               value = get_atomic_ent_value(ent);
-                               if (value) {
-                                       print_ent_node_edge(F, ent, value, ENT_VALUE_EDGE_ATTR, i);
-                                       /* DDMN(value);  $$$ */
-                                       dump_const_expression(F, value);
-                               }
-                       }
-                       if (is_compound_entity(ent)) {
-                               if (has_entity_initializer(ent)) {
-                                       /* new style initializers */
-                                       dump_entity_initializer(F, ent);
-                               } else {
-                                       /* old style compound entity values */
-                                       for (i = get_compound_ent_n_values(ent) - 1; i >= 0; --i) {
-                                               value = get_compound_ent_value(ent, i);
-                                               if (value) {
-                                                       print_ent_node_edge(F, ent, value, ENT_VALUE_EDGE_ATTR, i);
-                                                       dump_const_expression(F, value);
-                                                       print_ent_ent_edge(F, ent, get_compound_ent_value_member(ent, i), 0, -1, 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);
-                                                       */
-                                               }
+               if (const_entities) {
+                       if (ent->initializer != NULL) {
+                               /* new style initializers */
+                               dump_entity_initializer(F, ent);
+                       } else if (entity_has_compound_ent_values(ent)) {
+                               /* old style compound entity values */
+                               for (i = get_compound_ent_n_values(ent) - 1; i >= 0; --i) {
+                                       value = get_compound_ent_value(ent, i);
+                                       if (value) {
+                                               print_ent_node_edge(F, ent, value, ENT_VALUE_EDGE_ATTR, i);
+                                               dump_const_expression(F, value);
+                                               print_ent_ent_edge(F, ent, get_compound_ent_value_member(ent, i), 0, -1, 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);
+                                               */
                                        }
                                }
                        }