[PATCH] DWARF5 DW_FORM_data16 support

Jakub Jelinek jakub@redhat.com
Mon Oct 17 21:39:00 GMT 2016


Hi!

DWARF5 has a new 128-bit constant class form, this patch uses it
e.g. for __int128 values.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2016-10-17  Jakub Jelinek  <jakub@redhat.com>

	* dwarf2out.c (size_of_die, value_format, output_die): Use
	DW_FORM_data16 for 128-bit dw_val_class_const_double or
	dw_val_class_wide_int.

--- gcc/dwarf2out.c.jj	2016-10-17 11:45:03.000000000 +0200
+++ gcc/dwarf2out.c	2016-10-17 14:46:46.369083146 +0200
@@ -8591,14 +8591,14 @@ size_of_die (dw_die_ref die)
 	  break;
 	case dw_val_class_const_double:
 	  size += HOST_BITS_PER_DOUBLE_INT / HOST_BITS_PER_CHAR;
-	  if (HOST_BITS_PER_WIDE_INT >= 64)
+	  if (HOST_BITS_PER_WIDE_INT >= (dwarf_version >= 5 ? 128 : 64))
 	    size++; /* block */
 	  break;
 	case dw_val_class_wide_int:
 	  size += (get_full_len (*a->dw_attr_val.v.val_wide)
 		   * HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR);
 	  if (get_full_len (*a->dw_attr_val.v.val_wide) * HOST_BITS_PER_WIDE_INT
-	      > 64)
+	      > (dwarf_version >= 5 ? 128 : 64))
 	    size++; /* block */
 	  break;
 	case dw_val_class_vec:
@@ -8979,6 +8979,9 @@ value_format (dw_attr_node *a)
 	case 32:
 	  return DW_FORM_data8;
 	case 64:
+	  if (dwarf_version >= 5)
+	    return DW_FORM_data16;
+	  /* FALLTHRU */
 	default:
 	  return DW_FORM_block1;
 	}
@@ -8993,6 +8996,10 @@ value_format (dw_attr_node *a)
 	  return DW_FORM_data4;
 	case 64:
 	  return DW_FORM_data8;
+	case 128:
+	  if (dwarf_version >= 5)
+	    return DW_FORM_data16;
+	  /* FALLTHRU */
 	default:
 	  return DW_FORM_block1;
 	}
@@ -9439,7 +9446,7 @@ output_die (dw_die_ref die)
 	  {
 	    unsigned HOST_WIDE_INT first, second;
 
-	    if (HOST_BITS_PER_WIDE_INT >= 64)
+	    if (HOST_BITS_PER_WIDE_INT >= (dwarf_version >= 5 ? 128 : 64))
 	      dw2_asm_output_data (1,
 				   HOST_BITS_PER_DOUBLE_INT
 				   / HOST_BITS_PER_CHAR,
@@ -9468,9 +9475,9 @@ output_die (dw_die_ref die)
 	    int i;
 	    int len = get_full_len (*a->dw_attr_val.v.val_wide);
 	    int l = HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR;
-	    if (len * HOST_BITS_PER_WIDE_INT > 64)
-	      dw2_asm_output_data (1, get_full_len (*a->dw_attr_val.v.val_wide) * l,
-				   NULL);
+	    if (len * HOST_BITS_PER_WIDE_INT > (dwarf_version >= 5 ? 128 : 64))
+	      dw2_asm_output_data (1, get_full_len (*a->dw_attr_val.v.val_wide)
+				      * l, NULL);
 
 	    if (WORDS_BIG_ENDIAN)
 	      for (i = len - 1; i >= 0; --i)

	Jakub



More information about the Gcc-patches mailing list