renamed get_type_nameid to get_type_ident
[libfirm] / ir / ir / irdump.c
index 129d256..519b5ca 100644 (file)
 #define TYPE_METH_NODE_ATTR  "color: lightyellow"
 #define TYPE_CLASS_NODE_ATTR "color: green"
 #define ENTITY_NODE_ATTR     "color: yellow"
-#define ENT_TYPE_EDGE_ATTR   "label: \"type\" color: red"
-#define ENT_OWN_EDGE_ATTR    "label: \"owner\" color: black"
-#define METH_PAR_EDGE_ATTR   "label: \"param %d\" color: green"
-#define METH_RES_EDGE_ATTR   "label: \"res %d\" color: green"
-#define TYPE_SUPER_EDGE_ATTR "label: \"supertype\" color: blue"
-#define UNION_EDGE_ATTR      "label: \"component\" color: blue"
-#define PTR_PTS_TO_EDGE_ATTR "label: \"points to\" color:green"
-#define ARR_ELT_TYPE_EDGE_ATTR "label: \"arr elt\" color:green"
+#define ENT_TYPE_EDGE_ATTR   "class: 3 label: \"type\" color: red"
+#define ENT_OWN_EDGE_ATTR    "class: 4 label: \"owner\" color: black"
+#define METH_PAR_EDGE_ATTR   "class: 5 label: \"param %d\" color: green"
+#define METH_RES_EDGE_ATTR   "class: 6 label: \"res %d\" color: green"
+#define TYPE_SUPER_EDGE_ATTR "class: 7 label: \"supertype\" color: blue"
+#define UNION_EDGE_ATTR      "class: 8 label: \"component\" color: blue"
+#define PTR_PTS_TO_EDGE_ATTR "class: 9 label: \"points to\" color:green"
+#define ARR_ELT_TYPE_EDGE_ATTR "class: 10 label: \"arr elt\" color:green"
+#define ENT_OVERWRITES_EDGE_ATTR "class: 11 label: \"overwrites\" color:red"
+#define TYPE_MEMBER_EDGE_ATTR "class: 12 label: \"member\" color:blue"
 
 #define PRINT_NODEID(X) fprintf(F, "%p", X)
 
@@ -66,17 +68,19 @@ int edge_label = 1;
 inline void
 dump_node_opcode (ir_node *n)
 {
+
   /* Const */
   if (n->op->code == iro_Const) {
     xfprintf (F, "%v", n->attr.con);
+
   /* SymConst */
   } else if (n->op->code == iro_SymConst) {
     if (get_SymConst_kind(n) == linkage_ptr_info) {
       xfprintf (F, "%I", get_SymConst_ptrinfo(n));
     } else {
       assert(get_kind(get_SymConst_type(n)) == k_type);
-      assert(get_type_nameid(get_SymConst_type(n)));
-      xfprintf (F, "%s ", id_to_str(get_type_nameid(get_SymConst_type(n))));
+      assert(get_type_ident(get_SymConst_type(n)));
+      xfprintf (F, "%s ", id_to_str(get_type_ident(get_SymConst_type(n))));
       if (get_SymConst_kind == type_tag)
        xfprintf (F, "tag");
       else
@@ -319,7 +323,7 @@ dump_ir_node (ir_node *n)
     break;
   case iro_SymConst:
     assert(get_kind(get_SymConst_type(n)) == k_type);
-    assert(get_type_nameid(get_SymConst_type(n)));
+    assert(get_type_ident(get_SymConst_type(n)));
     xfprintf (F, "\"%s ", get_type_name(get_SymConst_type(n)));
     switch (n->attr.i.num){
     case type_tag:
@@ -491,17 +495,24 @@ dump_type_info (type_or_ent *tore, void *env) {
   case k_entity:
     {
       entity *ent = (entity *)tore;
-      xfprintf (F, "\"ent %I\" " ENTITY_NODE_ATTR "}\n", get_entity_ident(ent));
+      xfprintf (F, "\"ent %I\" " ENTITY_NODE_ATTR , get_entity_ident(ent));
+      if(dynamic_allocated == get_entity_allocation(ent))
+       xfprintf (F, " info1:\"dynamic allocated\"}\n");
+      else
+       xfprintf (F, " info1:\"static allocated\"}\n");
       xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
                 ENT_OWN_EDGE_ATTR "}\n", tore, get_entity_owner(ent));
       xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
                 ENT_TYPE_EDGE_ATTR "}\n", tore, get_entity_type(ent));
+      for(i = 0; i < get_entity_n_overwrites(ent); i++)
+       xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
+                 ENT_OVERWRITES_EDGE_ATTR "}\n", tore, get_entity_overwrites(ent, i));
     } break;
   case k_type:
     {
       /* why can't I cast here??? @@@ */
       type *type = tore;
-      xfprintf (F, "\"%I %I", get_type_tpop_nameid(type), get_type_nameid(type));
+      xfprintf (F, "\"%I %I", get_type_tpop_nameid(type), get_type_ident(type));
 
       switch (get_type_tpop_code(type)) {
       case tpo_class:
@@ -511,10 +522,18 @@ dump_type_info (type_or_ent *tore, void *env) {
            xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
                      TYPE_SUPER_EDGE_ATTR "}\n",
                      type, get_class_supertype(type, i));
+         for (i=0; i < get_class_n_member(type); i++)
+           xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
+                     TYPE_MEMBER_EDGE_ATTR "}\n",
+                     type, get_class_member(type, i));
        } break;
       case tpo_struct:
        {
          xfprintf (F, "\"}\n");
+         for (i=0; i < get_struct_n_member(type); i++)
+           xfprintf (F, "edge: { sourcename: \"%p\" targetname: \"%p\" "
+                     TYPE_MEMBER_EDGE_ATTR "}\n",
+                     type, get_struct_member(type, i));
        } break;
       case tpo_method:
        {
@@ -559,8 +578,8 @@ dump_type_info (type_or_ent *tore, void *env) {
        } break;
       default: break;
       } /* switch type */
-
-    break; /* case k_type */
+    }
+    break; /* case k_type */
   default:
     {
       xfprintf (F, "\" faulty type \"}\n");
@@ -581,7 +600,7 @@ void vcg_open (ir_graph *irg, char *suffix) {
   char label[4];
 
   /** open file for vcg graph */
-  id    = get_entity_ld_name (get_irg_ent(irg));
+  id    = get_entity_ld_ident (get_irg_ent(irg));
   len   = id_to_strlen (id);
   cp    = id_to_str (id);
 
@@ -618,7 +637,18 @@ void vcg_open (ir_graph *irg, char *suffix) {
            "port_sharing: no\n"
            "orientation: bottom_to_top\n"
            "classname 1: \"Data\"\n"
-           "classname 2: \"Block\"\n", cp, label);
+           "classname 2: \"Block\"\n"
+           "classname 3: \"Entity type\""
+           "classname 4: \"Entity owner\""
+           "classname 5: \"Method Param\""
+           "classname 6: \"Method Res\""
+           "classname 7: \"Super\""
+           "classname 8: \"Union\""
+           "classname 9: \"Points-to\""
+           "classname 10: \"Array Element Type\""
+           "classname 11: \"Overwrites\""
+           "classname 12: \"Member\""
+           , cp, label);
 
   xfprintf (F, "\n");          /* a separator */
 }
@@ -653,7 +683,18 @@ void vcg_open_name (const char *name) {
            "port_sharing: no\n"
            "orientation: bottom_to_top\n"
            "classname 1: \"Data\"\n"
-           "classname 2: \"Block\"\n", name, label);
+           "classname 2: \"Block\"\n"
+           "classname 3: \"Entity type\"\n"
+           "classname 4: \"Entity owner\"\n"
+           "classname 5: \"Method Param\"\n"
+           "classname 6: \"Method Res\"\n"
+           "classname 7: \"Super\"\n"
+           "classname 8: \"Union\"\n"
+           "classname 9: \"Points-to\"\n"
+           "classname 10: \"Array Element Type\"\n"
+           "classname 11: \"Overwrites\"\n"
+           "classname 12: \"Member\"\n"
+           , name, label);
 
   xfprintf (F, "\n");          /* a separator */
 }