]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/tree-pretty-print.c
Merge with trunk.
[thirdparty/gcc.git] / gcc / tree-pretty-print.c
index 7cd578cf99629c2b9afd65f3e32c94237b1792a9..14b5414e571e4588add75c949008e6d11500dee9 100644 (file)
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "dumpfile.h"
 #include "value-prof.h"
 #include "predict.h"
+#include "wide-int-print.h"
 
 #include <new>                           // For placement-new.
 
@@ -272,8 +273,8 @@ dump_array_domain (pretty_printer *buffer, tree domain, int spc, int flags)
 
       if (min && max
          && integer_zerop (min)
-         && host_integerp (max, 0))
-       pp_wide_integer (buffer, TREE_INT_CST_LOW (max) + 1);
+         && tree_fits_shwi_p (max))
+       pp_wide_integer (buffer, tree_to_shwi (max) + 1);
       else
        {
          if (min)
@@ -1231,14 +1232,27 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
              NB: Neither of the following divisors can be trivially
              used to recover the original literal:
 
-             TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (node)))
+             tree_to_hwi (TYPE_SIZE_UNIT (TREE_TYPE (node)))
             TYPE_PRECISION (TREE_TYPE (TREE_TYPE (node)))  */
-         pp_wide_integer (buffer, TREE_INT_CST_LOW (node));
+         pp_wide_integer (buffer, tree_to_hwi (node));
          pp_string (buffer, "B"); /* pseudo-unit */
        }
+      else if (tree_fits_shwi_p (node))
+       pp_wide_integer (buffer, tree_to_shwi (node));
+      else if (tree_fits_uhwi_p (node))
+       pp_unsigned_wide_integer (buffer, tree_to_uhwi (node));
       else
-       pp_double_int (buffer, tree_to_double_int (node),
-                      TYPE_UNSIGNED (TREE_TYPE (node)));
+       {
+         wide_int val = node;
+
+         if (wi::neg_p (val, TYPE_SIGN (TREE_TYPE (node))))
+           {
+             pp_minus (buffer);
+             val = -val;
+           }
+         print_hex (val, pp_buffer (buffer)->digit_buffer);
+         pp_string (buffer, pp_buffer (buffer)->digit_buffer);
+       }
       if (TREE_OVERFLOW (node))
        pp_string (buffer, "(OVF)");
       break;
@@ -1486,7 +1500,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
        tree field, val;
        bool is_struct_init = false;
        bool is_array_init = false;
-       double_int curidx = double_int_zero;
+       widest_int curidx;
        pp_left_brace (buffer);
        if (TREE_CLOBBER_P (node))
          pp_string (buffer, "CLOBBER");
@@ -1501,7 +1515,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
          {
            tree minv = TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (node)));
            is_array_init = true;
-           curidx = tree_to_double_int (minv);
+           curidx = wi::to_widest (minv);
          }
        FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), ix, field, val)
          {
@@ -1515,7 +1529,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
                  }
                else if (is_array_init
                         && (TREE_CODE (field) != INTEGER_CST
-                            || tree_to_double_int (field) != curidx))
+                            || curidx != wi::to_widest (field)))
                  {
                    pp_left_bracket (buffer);
                    if (TREE_CODE (field) == RANGE_EXPR)
@@ -1526,17 +1540,17 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
                        dump_generic_node (buffer, TREE_OPERAND (field, 1), spc,
                                           flags, false);
                        if (TREE_CODE (TREE_OPERAND (field, 1)) == INTEGER_CST)
-                         curidx = tree_to_double_int (TREE_OPERAND (field, 1));
+                         curidx = wi::to_widest (TREE_OPERAND (field, 1));
                      }
                    else
                      dump_generic_node (buffer, field, spc, flags, false);
                    if (TREE_CODE (field) == INTEGER_CST)
-                     curidx = tree_to_double_int (field);
+                     curidx = wi::to_widest (field);
                    pp_string (buffer, "]=");
                  }
              }
             if (is_array_init)
-             curidx += double_int_one;
+             curidx += 1;
            if (val && TREE_CODE (val) == ADDR_EXPR)
              if (TREE_CODE (TREE_OPERAND (val, 0)) == FUNCTION_DECL)
                val = TREE_OPERAND (val, 0);
@@ -2102,7 +2116,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
 
     case ANNOTATE_EXPR:
       pp_string (buffer, "ANNOTATE_EXPR <");
-      switch ((enum annot_expr_kind) TREE_INT_CST_LOW (TREE_OPERAND (node, 1)))
+      switch ((enum annot_expr_kind) tree_to_shwi (TREE_OPERAND (node, 1)))
        {
        case annot_expr_ivdep_kind:
          pp_string (buffer, "ivdep, ");