OSDN Git Service

2008-10-09 Thomas Koenig <tkoenig@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / print-tree.c
index ed31861..fb9f126 100644 (file)
@@ -29,6 +29,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ggc.h"
 #include "langhooks.h"
 #include "tree-iterator.h"
+#include "diagnostic.h"
 #include "tree-flow.h"
 
 /* Define the hash table of nodes already seen.
@@ -73,12 +74,12 @@ dump_addr (FILE *file, const char *prefix, const void *addr)
 void
 print_node_brief (FILE *file, const char *prefix, const_tree node, int indent)
 {
-  enum tree_code_class class;
+  enum tree_code_class tclass;
 
   if (node == 0)
     return;
 
-  class = TREE_CODE_CLASS (TREE_CODE (node));
+  tclass = TREE_CODE_CLASS (TREE_CODE (node));
 
   /* Always print the slot this node is in, and its code, address and
      name if any.  */
@@ -87,7 +88,7 @@ print_node_brief (FILE *file, const char *prefix, const_tree node, int indent)
   fprintf (file, "%s <%s", prefix, tree_code_name[(int) TREE_CODE (node)]);
   dump_addr (file, " ", node);
 
-  if (class == tcc_declaration)
+  if (tclass == tcc_declaration)
     {
       if (DECL_NAME (node))
        fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
@@ -98,7 +99,7 @@ print_node_brief (FILE *file, const char *prefix, const_tree node, int indent)
        fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
                 DECL_UID (node));
     }
-  else if (class == tcc_type)
+  else if (tclass == tcc_type)
     {
       if (TYPE_NAME (node))
        {
@@ -187,7 +188,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
   int hash;
   struct bucket *b;
   enum machine_mode mode;
-  enum tree_code_class class;
+  enum tree_code_class tclass;
   int len;
   int i;
   expanded_location xloc;
@@ -197,7 +198,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
     return;
   
   code = TREE_CODE (node);
-  class = TREE_CODE_CLASS (code);
+  tclass = TREE_CODE_CLASS (code);
 
   /* Don't get too deep in nesting.  If the user wants to see deeper,
      it is easy to use the address of a lowest-level node
@@ -209,7 +210,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
       return;
     }
 
-  if (indent > 8 && (class == tcc_type || class == tcc_declaration))
+  if (indent > 8 && (tclass == tcc_type || tclass == tcc_declaration))
     {
       print_node_brief (file, prefix, node, indent);
       return;
@@ -250,7 +251,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
   dump_addr (file, " ", node);
 
   /* Print the name, if any.  */
-  if (class == tcc_declaration)
+  if (tclass == tcc_declaration)
     {
       if (DECL_NAME (node))
        fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
@@ -261,7 +262,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
        fprintf (file, " %c.%u", TREE_CODE (node) == CONST_DECL ? 'C' : 'D',
                 DECL_UID (node));
     }
-  else if (class == tcc_type)
+  else if (tclass == tcc_type)
     {
       if (TYPE_NAME (node))
        {
@@ -281,7 +282,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
       if (indent <= 4)
        print_node_brief (file, "type", TREE_TYPE (node), indent + 4);
     }
-  else if (!GIMPLE_TUPLE_P (node))
+  else
     {
       print_node (file, "type", TREE_TYPE (node), indent + 4);
       if (TREE_TYPE (node))
@@ -460,8 +461,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
          print_node (file, "size", DECL_SIZE (node), indent + 4);
          print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
          
-         if (TREE_CODE (node) != FUNCTION_DECL
-             || DECL_INLINE (node) || DECL_BUILT_IN (node))
+         if (TREE_CODE (node) != FUNCTION_DECL || DECL_BUILT_IN (node))
            indent_to (file, indent + 3);
          
          if (DECL_USER_ALIGN (node))
@@ -712,18 +712,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
       print_node (file, "chain", TREE_CHAIN (node), indent + 4);
       break;
 
-    case tcc_gimple_stmt:
-      len = TREE_CODE_LENGTH (TREE_CODE (node));
-
-      for (i = 0; i < len; i++)
-       {
-         char temp[10];
-
-         sprintf (temp, "arg %d", i);
-         print_node (file, temp, GIMPLE_STMT_OPERAND (node, i), indent + 4);
-       }
-      break;
-
     case tcc_constant:
     case tcc_exceptional:
       switch (TREE_CODE (node))
@@ -896,8 +884,8 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
 
        case SSA_NAME:
          print_node_brief (file, "var", SSA_NAME_VAR (node), indent + 4);
-         print_node_brief (file, "def_stmt",
-                           SSA_NAME_DEF_STMT (node), indent + 4);
+         fprintf (file, "def_stmt ");
+         print_gimple_stmt (file, SSA_NAME_DEF_STMT (node), indent + 4, 0);
 
          indent_to (file, indent + 4);
          fprintf (file, "version %u", SSA_NAME_VERSION (node));
@@ -917,12 +905,6 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
            }
          break;
 
-       case PHI_NODE:
-         print_node (file, "result", PHI_RESULT (node), indent + 4);
-         for (i = 0; i < PHI_NUM_ARGS (node); i++)
-           print_node (file, "arg", PHI_ARG_DEF (node, i), indent + 4);
-         break;
-
        case OMP_CLAUSE:
            {
              int i;
@@ -944,6 +926,12 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
        case TARGET_OPTION_NODE:
          cl_target_option_print (file, indent + 4, TREE_TARGET_OPTION (node));
          break;
+       case IMPORTED_DECL:
+         fprintf (file, " imported declaration");
+         print_node_brief (file, "associated declaration",
+                           IMPORTED_DECL_ASSOCIATED_DECL (node),
+                           indent + 4);
+         break;
 
        default:
          if (EXCEPTIONAL_CLASS_P (node))