Remove enum tarval_classification_t.
[libfirm] / ir / ir / irdump.c
index 682e4f1..9b1904a 100644 (file)
@@ -48,9 +48,7 @@
 #include "irdump_t.h"
 
 #include "irgwalk.h"
-#include "typewalk.h"
 #include "tv_t.h"
-#include "type_or_entity.h"
 #include "irouts.h"
 #include "irdom.h"
 #include "irloop_t.h"
@@ -102,6 +100,7 @@ static int dump_out_edge_flag = 0;
 static int dump_loop_information_flag = 0;
 static int dump_backedge_information_flag = 1;
 static int dump_const_local = 0;
+static int dump_node_idx_labels = 0;
 /** An option to dump all graph anchors */
 static int dump_anchors = 0;
 
@@ -193,6 +192,10 @@ void dump_consts_local(int flag) {
        dump_const_local = flag;
 }
 
+void dump_node_idx_label(int flag) {
+       dump_node_idx_labels = flag;
+}
+
 void dump_constant_entity_values(int flag) {
        const_entities = flag;
 }
@@ -494,6 +497,7 @@ static void ird_set_irg_link(ir_graph *irg, void *x) {
  * Walker, clears the private link field.
  */
 static void clear_link(ir_node * node, void * env) {
+       (void) env;
        ird_set_irn_link(node, NULL);
 }
 
@@ -537,20 +541,10 @@ static int node_floats(ir_node *n) {
  *  Walker that visits the anchors
  */
 static void ird_walk_graph(ir_graph *irg, irg_walk_func *pre, irg_walk_func *post, void *env) {
-       irg_walk_graph(irg, pre, post, env);
-
        if (dump_anchors) {
-               int i;
-
-               for (i = anchor_max - 1; i >= 0; --i) {
-                       ir_node *n = irg->anchors[i];
-
-                       if (n) {
-                               /* reset the visit flag: will be increase in the walker */
-                               set_irg_visited(irg, get_irg_visited(irg) - 1);
-                               irg_walk(n, pre, post, env);
-                       }
-               }
+               irg_walk_anchors(irg, pre, post, env);
+       } else {
+               irg_walk_graph(irg, pre, post, env);
        }
 }
 
@@ -558,6 +552,7 @@ static void ird_walk_graph(ir_graph *irg, irg_walk_func *pre, irg_walk_func *pos
  * Walker, allocates an array for all blocks and puts it's nodes non-floating nodes into this array.
  */
 static void collect_node(ir_node * node, void *env) {
+       (void) env;
        if (is_Block(node)
            || node_floats(node)
            || get_irn_op(node) == op_Bad
@@ -689,7 +684,7 @@ int dump_node_opcode(FILE *F, ir_node *n)
                int res;
                char buf[1024];
                res = tarval_snprintf(buf, sizeof(buf), get_Const_tarval(n));
-               assert(res < sizeof(buf) && "buffer to small for tarval_snprintf");
+               assert(res < (int) sizeof(buf) && "buffer to small for tarval_snprintf");
                fprintf(F, buf);
        } break;
 
@@ -717,6 +712,9 @@ int dump_node_opcode(FILE *F, ir_node *n)
                case symconst_enum_const:
                        fprintf(F, "SymC %s enum", get_enumeration_name(get_SymConst_enum(n)));
                        break;
+               case symconst_label:
+                       fprintf(F, "SymC %lu label", get_SymConst_label(n));
+                       break;
                }
        } break;
 
@@ -759,8 +757,15 @@ int dump_node_opcode(FILE *F, ir_node *n)
                break;
        }
        case iro_Load:
+               if (get_Load_align(n) == align_non_aligned)
+                       fprintf(F, "ua");
                fprintf(F, "%s[%s]", get_irn_opname(n), get_mode_name_ex(get_Load_mode(n), &bad));
                break;
+       case iro_Store:
+               if (get_Store_align(n) == align_non_aligned)
+                       fprintf(F, "ua");
+               fprintf(F, "%s", get_irn_opname(n));
+               break;
        case iro_Block:
                fprintf(F, "%s%s", is_Block_dead(n) ? "Dead " : "", get_irn_opname(n));
                break;
@@ -769,6 +774,15 @@ int dump_node_opcode(FILE *F, ir_node *n)
                        fprintf(F, "strict");
                fprintf(F, "%s", get_irn_opname(n));
                break;
+       case iro_Div:
+               fprintf(F, "%s[%s]", get_irn_opname(n), get_mode_name_ex(get_Div_resmode(n), &bad));
+               break;
+       case iro_Mod:
+               fprintf(F, "%s[%s]", get_irn_opname(n), get_mode_name_ex(get_Mod_resmode(n), &bad));
+               break;
+       case iro_DivMod:
+               fprintf(F, "%s[%s]", get_irn_opname(n), get_mode_name_ex(get_DivMod_resmode(n), &bad));
+               break;
 
        default:
 default_case:
@@ -872,10 +886,11 @@ static const pns_lookup_t cond_lut[] = {
 static const pns_lookup_t call_lut[] = {
 #define X(a)    { pn_Call_##a, #a }
        X(M_regular),
-       X(T_result),
-       X(P_value_res_base),
+       X(X_regular),
        X(X_except),
-       X(M_except)
+       X(T_result),
+       X(M_except),
+       X(P_value_res_base)
 #undef X
 };
 
@@ -883,6 +898,7 @@ static const pns_lookup_t call_lut[] = {
 static const pns_lookup_t quot_lut[] = {
 #define X(a)    { pn_Quot_##a, #a }
        X(M),
+       X(X_regular),
        X(X_except),
        X(res)
 #undef X
@@ -892,6 +908,7 @@ static const pns_lookup_t quot_lut[] = {
 static const pns_lookup_t divmod_lut[] = {
 #define X(a)    { pn_DivMod_##a, #a }
        X(M),
+       X(X_regular),
        X(X_except),
        X(res_div),
        X(res_mod)
@@ -902,6 +919,7 @@ static const pns_lookup_t divmod_lut[] = {
 static const pns_lookup_t div_lut[] = {
 #define X(a)    { pn_Div_##a, #a }
        X(M),
+       X(X_regular),
        X(X_except),
        X(res)
 #undef X
@@ -911,6 +929,7 @@ static const pns_lookup_t div_lut[] = {
 static const pns_lookup_t mod_lut[] = {
 #define X(a)    { pn_Mod_##a, #a }
        X(M),
+       X(X_regular),
        X(X_except),
        X(res)
 #undef X
@@ -920,6 +939,7 @@ static const pns_lookup_t mod_lut[] = {
 static const pns_lookup_t load_lut[] = {
 #define X(a)    { pn_Load_##a, #a }
        X(M),
+       X(X_regular),
        X(X_except),
        X(res)
 #undef X
@@ -929,6 +949,7 @@ static const pns_lookup_t load_lut[] = {
 static const pns_lookup_t store_lut[] = {
 #define X(a)    { pn_Store_##a, #a }
        X(M),
+       X(X_regular),
        X(X_except)
 #undef X
 };
@@ -937,6 +958,7 @@ static const pns_lookup_t store_lut[] = {
 static const pns_lookup_t alloc_lut[] = {
 #define X(a)    { pn_Alloc_##a, #a }
        X(M),
+       X(X_regular),
        X(X_except),
        X(res)
 #undef X
@@ -946,6 +968,7 @@ static const pns_lookup_t alloc_lut[] = {
 static const pns_lookup_t copyb_lut[] = {
 #define X(a)    { pn_CopyB_##a, #a }
        X(M),
+       X(X_regular),
        X(X_except),
        X(M_except)
 #undef X
@@ -955,6 +978,7 @@ static const pns_lookup_t copyb_lut[] = {
 static const pns_lookup_t instof_lut[] = {
 #define X(a)    { pn_InstOf_##a, #a }
        X(M),
+       X(X_regular),
        X(X_except),
        X(res),
        X(M_except),
@@ -973,6 +997,7 @@ static const pns_lookup_t raise_lut[] = {
 static const pns_lookup_t bound_lut[] = {
 #define X(a)    { pn_Bound_##a, #a }
        X(M),
+       X(X_regular),
        X(X_except),
        X(res),
 #undef X
@@ -1110,7 +1135,11 @@ int dump_node_label(FILE *F, ir_node *n) {
        fprintf(F, " ");
        bad |= dump_node_typeinfo(F, n);
        bad |= dump_node_nodeattr(F, n);
-       fprintf(F, "%ld:%d", get_irn_node_nr(n), get_irn_idx(n));
+       if(dump_node_idx_labels) {
+               fprintf(F, "%ld:%d", get_irn_node_nr(n), get_irn_idx(n));
+       } else {
+               fprintf(F, "%ld", get_irn_node_nr(n));
+       }
 
        return bad;
 }
@@ -1171,6 +1200,9 @@ static void dump_node_vcgattr(FILE *F, ir_node *node, ir_node *local, int bad)
        case iro_Tuple:
                print_vcg_color(F, ird_color_yellow);
                break;
+       case iro_ASM:
+               print_vcg_color(F, ird_color_darkyellow);
+               break;
        default:
                PRINT_DEFAULT_NODE_ATTR;
        }
@@ -1414,8 +1446,8 @@ print_mem_edge_vcgattr(FILE *F, ir_node *from, int to) {
                fprintf(F, INTER_MEM_EDGE_ATTR);
 }
 
-static void
-print_edge_vcgattr(FILE *F, ir_node *from, int to) {
+/** Print the vcg attributes for the edge from node from to it's to's input */
+static void print_edge_vcgattr(FILE *F, ir_node *from, int to) {
        assert(from);
 
        if (dump_edge_vcgattr_hook)
@@ -1433,9 +1465,9 @@ print_edge_vcgattr(FILE *F, ir_node *from, int to) {
        case iro_End:
                if (to >= 0) {
                        if (get_irn_mode(get_End_keepalive(from, to)) == mode_BB)
-                               fprintf(F, CF_EDGE_ATTR);
-                       if (get_irn_mode(get_End_keepalive(from, to)) == mode_X)
-                               fprintf(F, INTER_MEM_EDGE_ATTR);
+                               fprintf(F, KEEP_ALIVE_CF_EDGE_ATTR);
+                       else
+                               fprintf(F, KEEP_ALIVE_DF_EDGE_ATTR);
                }
                break;
        default:
@@ -1456,9 +1488,8 @@ 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)  {
+/** 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);
 
@@ -2186,6 +2217,7 @@ void dump_vcg_header(FILE *F, const char *name, const char *orientation) {
                "classname 17: \"interblock Memory\"\n"
                "classname 18: \"Exception Control Flow for Interval Analysis\"\n"
                "classname 19: \"Postdominators\"\n"
+               "classname 20: \"Keep Alive\"\n"
                "infoname 1: \"Attribute\"\n"
                "infoname 2: \"Verification errors\"\n"
                "infoname 3: \"Debug info\"\n",