Handle variable-length vectors in compute_record_mode
This patch makes compute_record_mode handle SVE vectors in the same way as it would handle fixed-length vectors. There should be no change in behaviour for other targets. This is needed for the SVE equivalent of arm_neon.h types like int8x8x2_t (i.e. a pair of int8x8_ts). 2019-09-18 Richard Sandiford <richard.sandiford@arm.com> gcc/ * stor-layout.c (compute_record_mode): Operate on poly_uint64 sizes instead of uhwi sizes. From-SVN: r275869
This commit is contained in:
parent
ef20d22150
commit
defc6f266c
|
@ -1,3 +1,8 @@
|
|||
2019-09-18 Richard Sandiford <richard.sandiford@arm.com>
|
||||
|
||||
* stor-layout.c (compute_record_mode): Operate on poly_uint64
|
||||
sizes instead of uhwi sizes.
|
||||
|
||||
2019-09-18 Richard Sandiford <richard.sandiford@arm.com>
|
||||
|
||||
* dwarf2out.c (loc_list_from_tree_1): Handle POLY_INT_CST.
|
||||
|
|
|
@ -1811,7 +1811,8 @@ compute_record_mode (tree type)
|
|||
line. */
|
||||
SET_TYPE_MODE (type, BLKmode);
|
||||
|
||||
if (! tree_fits_uhwi_p (TYPE_SIZE (type)))
|
||||
poly_uint64 type_size;
|
||||
if (!poly_int_tree_p (TYPE_SIZE (type), &type_size))
|
||||
return;
|
||||
|
||||
/* A record which has any BLKmode members must itself be
|
||||
|
@ -1822,20 +1823,21 @@ compute_record_mode (tree type)
|
|||
if (TREE_CODE (field) != FIELD_DECL)
|
||||
continue;
|
||||
|
||||
poly_uint64 field_size;
|
||||
if (TREE_CODE (TREE_TYPE (field)) == ERROR_MARK
|
||||
|| (TYPE_MODE (TREE_TYPE (field)) == BLKmode
|
||||
&& ! TYPE_NO_FORCE_BLK (TREE_TYPE (field))
|
||||
&& !(TYPE_SIZE (TREE_TYPE (field)) != 0
|
||||
&& integer_zerop (TYPE_SIZE (TREE_TYPE (field)))))
|
||||
|| ! tree_fits_uhwi_p (bit_position (field))
|
||||
|| !tree_fits_poly_uint64_p (bit_position (field))
|
||||
|| DECL_SIZE (field) == 0
|
||||
|| ! tree_fits_uhwi_p (DECL_SIZE (field)))
|
||||
|| !poly_int_tree_p (DECL_SIZE (field), &field_size))
|
||||
return;
|
||||
|
||||
/* If this field is the whole struct, remember its mode so
|
||||
that, say, we can put a double in a class into a DF
|
||||
register instead of forcing it to live in the stack. */
|
||||
if (simple_cst_equal (TYPE_SIZE (type), DECL_SIZE (field))
|
||||
if (known_eq (field_size, type_size)
|
||||
/* Partial int types (e.g. __int20) may have TYPE_SIZE equal to
|
||||
wider types (e.g. int32), despite precision being less. Ensure
|
||||
that the TYPE_MODE of the struct does not get set to the partial
|
||||
|
@ -1855,7 +1857,6 @@ compute_record_mode (tree type)
|
|||
For UNION_TYPE, if the widest field is MODE_INT then use that mode.
|
||||
If the widest field is MODE_PARTIAL_INT, and the union will be passed
|
||||
by reference, then use that mode. */
|
||||
poly_uint64 type_size;
|
||||
if ((TREE_CODE (type) == RECORD_TYPE
|
||||
|| (TREE_CODE (type) == UNION_TYPE
|
||||
&& (GET_MODE_CLASS (mode) == MODE_INT
|
||||
|
@ -1864,7 +1865,6 @@ compute_record_mode (tree type)
|
|||
(pack_cumulative_args (0),
|
||||
function_arg_info (type, mode, /*named=*/false)))))))
|
||||
&& mode != VOIDmode
|
||||
&& poly_int_tree_p (TYPE_SIZE (type), &type_size)
|
||||
&& known_eq (GET_MODE_BITSIZE (mode), type_size))
|
||||
;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue