Use be_emit_irprintf("%T", x) instead of be_emit_tarval().
[libfirm] / ir / ir / irdumptxt.c
index ec86216..d61fe6c 100644 (file)
@@ -22,7 +22,6 @@
  * @brief   Write text representation of firm to file.
  * @author  Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Hubert Schmidt,
  *          Matthias Braun
- * @version $Id$
  */
 #include "config.h"
 
@@ -57,8 +56,7 @@ ir_dump_verbosity_t ir_get_dump_verbosity(void)
        return verbosity;
 }
 
-/* Write the irnode and all its attributes to the file passed. */
-void dump_irnode_to_file(FILE *F, ir_node *n)
+void dump_irnode_to_file(FILE *F, const ir_node *n)
 {
        char     comma;
        ir_graph *irg;
@@ -153,8 +151,9 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
        /* Source types */
        switch (get_irn_opcode(n)) {
        case iro_Block: {
-               if (has_Block_entity(n))
-                       fprintf(F, "  Label: %lu\n", get_entity_label(get_Block_entity(n)));
+               ir_entity *const entity = get_Block_entity(n);
+               if (entity != NULL)
+                       fprintf(F, "  Label: %lu\n", get_entity_label(entity));
                fprintf(F, "  block visited: %lu\n", get_Block_block_visited(n));
                fprintf(F, "  block marked: %u\n", get_Block_mark(n));
                if (is_irg_state(get_irn_irg(n), IR_GRAPH_STATE_CONSISTENT_DOMINANCE)) {
@@ -204,8 +203,6 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
        } break;
        case iro_Call: {
                ir_type *tp = get_Call_type(n);
-               if (get_Call_tail_call(n))
-                       fprintf(F, "  tail call\n");
                ir_fprintf(F, "  calling method of type %+F\n", tp);
                if (get_unknown_type() != tp) {
                        size_t i;
@@ -250,11 +247,6 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
                        fprintf(F, "  entity: ");
                        dump_entity_to_file(F, get_SymConst_entity(n));
                        break;
-               case symconst_type_tag:
-                       fprintf(F, "  kind: type_tag\n");
-                       fprintf(F, "  type: ");
-                       dump_type_to_file(F, get_SymConst_type(n));
-                       break;
                case symconst_type_size:
                        fprintf(F, "  kind: size\n");
                        fprintf(F, "  type: ");
@@ -324,7 +316,7 @@ void dump_irnode_to_file(FILE *F, ir_node *n)
 
        if (get_irg_typeinfo_state(get_irn_irg(n)) == ir_typeinfo_consistent  ||
                get_irg_typeinfo_state(get_irn_irg(n)) == ir_typeinfo_inconsistent  )
-               if (get_irn_typeinfo_type(n) != firm_none_type)
+               if (get_irn_typeinfo_type(n) != get_none_type())
                        ir_fprintf (F, "  Analysed type: %s\n", get_irn_typeinfo_type(n));
 }
 
@@ -352,9 +344,13 @@ static bool is_init_string(ir_initializer_t const* const init, ir_type *const ty
        n = get_initializer_compound_n_entries(init);
        for (i = 0; i != n; ++i) {
                ir_initializer_t const* const val = get_initializer_compound_value(init, i);
-               ir_tarval*              const tv  = get_initializer_tarval_value(val);
+               ir_tarval*                    tv;
                long                          v;
 
+               if (get_initializer_kind(val) != IR_INITIALIZER_TARVAL)
+                       return false;
+               tv = get_initializer_tarval_value(val);
+
                if (!tarval_is_constant(tv))
                        return false;