recursively optimize phi to get real minimal SSA-form for reducible CFGs
[libfirm] / ir / ir / irdumptxt.c
index 980332b..093daea 100644 (file)
@@ -123,8 +123,8 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
        if (get_irg_loopinfo_state(irg) & loopinfo_valid) {
                ir_loop *loop = get_irn_loop(n);
                if (loop != NULL) {
-                       fprintf(F, "  in loop %d with depth %d\n",
-                               get_loop_loop_nr(loop), get_loop_depth(loop));
+                       fprintf(F, "  in loop %ld with depth %u\n",
+                               get_loop_loop_nr(loop), get_loop_depth(loop));
                }
        }
 
@@ -133,7 +133,6 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
        case iro_Block: {
                if (has_Block_entity(n))
                        fprintf(F, "  Label: %lu\n", get_entity_label(get_Block_entity(n)));
-               ir_fprintf(F, "  macro Block: %+F\n", get_Block_MacroBlock(n));
                fprintf(F, "  block visited: %ld\n", get_Block_block_visited(n));
                fprintf(F, "  block marked: %u\n", get_Block_mark(n));
                if (get_irg_dom_state(get_irn_irg(n)) != dom_none) {
@@ -150,6 +149,7 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
                /* not dumped: mature    */
        }  break;
        case iro_Start: {
+               size_t   i;
                ir_type *tp = get_entity_type(get_irg_entity(get_irn_irg(n)));
                ir_fprintf(F, "  start of method of type %+F\n", tp);
                for (i = 0; i < get_method_n_params(tp); ++i)
@@ -186,6 +186,7 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
                        fprintf(F, "  tail call\n");
                ir_fprintf(F, "  calling method of type %+F\n", tp);
                if (get_unknown_type() != tp) {
+                       size_t i;
                        for (i = 0; i < get_method_n_params(tp); ++i)
                                ir_fprintf(F, "    param %d type: %+F\n", i, get_method_param_type(tp, i));
                        for (i = 0; i < get_method_n_ress(tp); ++i)
@@ -202,6 +203,7 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
                ir_fprintf(F, "  cast to type: %+F\n", get_Cast_type(n));
        } break;
        case iro_Return: {
+               size_t   i;
                ir_type *tp = get_entity_type(get_irg_entity(get_irn_irg(n)));
                ir_fprintf(F, "  return in method of type %+F\n", tp);
                for (i = 0; i < get_method_n_ress(tp); ++i) {
@@ -209,10 +211,6 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
                                           get_method_res_type(tp, i));
                }
        } break;
-       case iro_Const: {
-               assert(get_Const_type(n) != firm_none_type);
-               ir_fprintf(F, "  Const of type %+F\n", get_Const_type(n));
-       } break;
        case iro_SymConst: {
                switch (get_SymConst_kind(n)) {
                case symconst_addr_ent:
@@ -245,7 +243,6 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
                        fprintf(F, "  name: %s\n", get_enumeration_const_name(get_SymConst_enum(n)));
                        break;
                }
-               ir_fprintf(F, "  type of value: %+F\n", get_SymConst_value_type(n));
        } break;
        case iro_Load:
                fprintf(F, "  mode of loaded value: %s\n", get_mode_name_ex(get_Load_mode(n), NULL));
@@ -317,13 +314,13 @@ void dump_graph_as_text(FILE *out, ir_graph *irg)
  *  "prefix"    node8, ... node15,\n
  *  "prefix"    node16, node17\n
  */
-static void dump_node_list(FILE *F, firm_kind *k, char *prefix,
+static void dump_node_list(FILE *F, firm_kind *k, const char *prefix,
                            int (*get_entity_n_nodes)(firm_kind *ent),
                            ir_node *(*get_entity_node)(firm_kind *ent, int pos),
-                           char *name)
+                           const char *name)
 {
        int i, n_nodes = get_entity_n_nodes(k);
-       char *comma = "";
+       const char *comma = "";
 
        fprintf(F, "%s  %s (%d):", prefix, name, n_nodes);
        for (i = 0; i < n_nodes; ++i) {
@@ -344,13 +341,13 @@ static void dump_node_list(FILE *F, firm_kind *k, char *prefix,
  *  "prefix"    node8, ... node15,\n
  *  "prefix"    node16, node17\n
  */
-static void dump_type_list(FILE *F, ir_type *tp, char *prefix,
+static void dump_type_list(FILE *F, ir_type *tp, const char *prefix,
                            int (*get_n_types)(const ir_type *tp),
                            ir_type *(*get_type)(const ir_type *tp, int pos),
                            const char *name)
 {
        int i, n_nodes = get_n_types(tp);
-       char *comma = "";
+       const char *comma = "";
 
        fprintf(F, "%s  %s (%d):", prefix, name, n_nodes);
        for (i = 0; i < n_nodes; ++i) {
@@ -373,8 +370,8 @@ static void dump_ir_initializers_to_file(FILE *F, const char *prefix,
                                          const ir_initializer_t *initializer,
                                          ir_type *type)
 {
-       tarval  *tv;
-       ir_node *value;
+       ir_tarval *tv;
+       ir_node   *value;
 
        if (need_nl) {
                fprintf(F, "\n%s    ", prefix);
@@ -452,9 +449,8 @@ static void dump_entity_linkage(FILE *F, const ir_entity *entity)
                fprintf(F, " hidden_user");
 }
 
-static void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, char *prefix)
+static void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, const char *prefix)
 {
-       int i, j;
        ir_type *owner, *type;
 
        assert(is_entity(ent));
@@ -473,6 +469,7 @@ static void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, char *prefix)
 
                if (is_Class_type(get_entity_owner(ent))) {
                        if (get_entity_n_overwrites(ent) > 0) {
+                               size_t i;
                                fprintf(F, "%s  overwrites:\n", prefix);
                                for (i = 0; i < get_entity_n_overwrites(ent); ++i) {
                                        ir_entity *ov = get_entity_overwrites(ent, i);
@@ -483,6 +480,7 @@ static void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, char *prefix)
                                fprintf(F, "%s  Does not overwrite other entities.\n", prefix);
                        }
                        if (get_entity_n_overwrittenby(ent) > 0) {
+                               size_t i;
                                fprintf(F, "%s  overwritten by:\n", prefix);
                                for (i = 0; i < get_entity_n_overwrittenby(ent); ++i) {
                                        ir_entity *ov = get_entity_overwrittenby(ent, i);
@@ -578,8 +576,10 @@ static void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, char *prefix)
                        need_nl = 1;
                        dump_ir_initializers_to_file(F, prefix, initializer, get_entity_type(ent));
                } else if (entity_has_compound_ent_values(ent)) {
+                       size_t i;
                        fprintf(F, "%s  compound values:", prefix);
                        for (i = 0; i < get_compound_ent_n_values(ent); ++i) {
+                               size_t j;
                                compound_graph_path *path = get_compound_ent_value_path(ent, i);
                                ir_entity *ent0 = get_compound_graph_path_node(path, 0);
                                fprintf(F, "\n%s    %3d:%u ", prefix, get_entity_offset(ent0), get_entity_offset_bits_remainder(ent0));
@@ -590,7 +590,7 @@ static void dump_entity_to_file_prefix(FILE *F, ir_entity *ent, char *prefix)
                                        ir_entity *node = get_compound_graph_path_node(path, j);
                                        fprintf(F, ".%s", get_entity_name(node));
                                        if (is_Array_type(get_entity_owner(node)))
-                                               fprintf(F, "[%d]", get_compound_graph_path_array_index(path, j));
+                                               fprintf(F, "[%ld]", get_compound_graph_path_array_index(path, j));
                                }
                                fprintf(F, "\t = ");
                                dump_node_opcode(F, get_compound_ent_value(ent, i));
@@ -634,7 +634,7 @@ void dump_entity_to_file(FILE *out, ir_entity *ent)
 
 void dump_type_to_file(FILE *F, ir_type *tp)
 {
-       int i;
+       size_t i;
 
        if ((is_Class_type(tp))       && (verbosity & dump_verbosity_noClassTypes)) return;
        if ((is_Struct_type(tp))      && (verbosity & dump_verbosity_noStructTypes)) return;
@@ -768,13 +768,15 @@ void dump_type_to_file(FILE *F, ir_type *tp)
        case tpo_method:
                if (verbosity & dump_verbosity_typeattrs) {
                        fprintf(F, "\n  variadicity: %s", get_variadicity_name(get_method_variadicity(tp)));
-                       fprintf(F, "\n  return types: %d", get_method_n_ress(tp));
+                       fprintf(F, "\n  return types: %lu",
+                               (unsigned long) get_method_n_ress(tp));
                        for (i = 0; i < get_method_n_ress(tp); ++i) {
                                ir_type *rtp = get_method_res_type(tp, i);
                                ir_fprintf(F, "\n    %+F", rtp);
                        }
 
-                       fprintf(F, "\n  parameter types: %d", get_method_n_params(tp));
+                       fprintf(F, "\n  parameter types: %lu",
+                               (unsigned long) get_method_n_params(tp));
                        for (i = 0; i < get_method_n_params(tp); ++i) {
                                ir_type *ptp = get_method_param_type(tp, i);
                                ir_fprintf(F, "\n    %+F", ptp);