diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-06-29 07:16:37 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-06-29 07:16:37 +0000 |
commit | b1af4cb2903711183e62f922fc235d48c7a738bb (patch) | |
tree | e52fb1419869e176950e8aab90f65e8e32ade6ce /gcc/expr.c | |
parent | 43e1e8b5b8ed9f0e4311c0974b9e459471a275b0 (diff) | |
download | gcc-b1af4cb2903711183e62f922fc235d48c7a738bb.zip gcc-b1af4cb2903711183e62f922fc235d48c7a738bb.tar.gz gcc-b1af4cb2903711183e62f922fc235d48c7a738bb.tar.bz2 |
expr.c (expand_expr_real_1): Apply the big-endian adjustment for bit-fields to all aggregate types.
* expr.c (expand_expr_real_1) <BIT_FIELD_REF>: Apply the big-endian
adjustment for bit-fields to all aggregate types.
ada/
* gcc-interface/gigi.h (make_packable_type): Remove default value.
(value_factor_p): Tweak prototype.
* gcc-interface/decl.c (gnat_to_gnu_entity): Add comment.
(gnat_to_gnu_component_type): Likewise.
(gnat_to_gnu_field): Likewise. Fetch the position of the field earlier
and simplify the condition under which the type is packed. Declare
local variable is_bitfield. Pass 1 as max_align to make_packable_type
if it is set to true.
(copy_and_substitute_in_layout): Pass 0 to make_packable_type.
* gcc-interface/utils.c (make_packable_array_type): New function.
(make_packable_type): Use it to rewrite the type of array field.
(maybe_pad_type): Pass align parameter to make_packable_type.
(create_field_decl): Minor tweaks.
(value_factor_p): Assert that FACTOR is a power of 2 and replace the
modulo computation by a masking operation.
From-SVN: r272810
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -10893,12 +10893,12 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, if (MEM_P (op0) && REG_P (XEXP (op0, 0))) mark_reg_pointer (XEXP (op0, 0), MEM_ALIGN (op0)); - /* If the result has a record type and the extraction is done in + /* If the result has aggregate type and the extraction is done in an integral mode, then the field may be not aligned on a byte boundary; in this case, if it has reverse storage order, it needs to be extracted as a scalar field with reverse storage order and put back into memory order afterwards. */ - if (TREE_CODE (type) == RECORD_TYPE + if (AGGREGATE_TYPE_P (type) && GET_MODE_CLASS (ext_mode) == MODE_INT) reversep = TYPE_REVERSE_STORAGE_ORDER (type); @@ -10908,13 +10908,13 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, ? NULL_RTX : target), ext_mode, ext_mode, reversep, alt_rtl); - /* If the result has a record type and the mode of OP0 is an + /* If the result has aggregate type and the mode of OP0 is an integral mode then, if BITSIZE is narrower than this mode and this is for big-endian data, we must put the field into the high-order bits. And we must also put it back into memory order if it has been previously reversed. */ scalar_int_mode op0_mode; - if (TREE_CODE (type) == RECORD_TYPE + if (AGGREGATE_TYPE_P (type) && is_int_mode (GET_MODE (op0), &op0_mode)) { HOST_WIDE_INT size = GET_MODE_BITSIZE (op0_mode); |