diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2023-02-22 17:22:11 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2023-05-30 09:12:18 +0200 |
commit | e2c9982eef42bc6421c7e9539983a743c7f7a13a (patch) | |
tree | d082031430c751be9d208ce4d26a591860c1f72d /gcc/ada/gcc-interface | |
parent | f60d3abea1106dca6565bb390eabfe19c84e2f40 (diff) | |
download | gcc-e2c9982eef42bc6421c7e9539983a743c7f7a13a.zip gcc-e2c9982eef42bc6421c7e9539983a743c7f7a13a.tar.gz gcc-e2c9982eef42bc6421c7e9539983a743c7f7a13a.tar.bz2 |
ada: Minor generic tweaks left and and right
No functional changes.
gcc/ada/
* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Replace
integer_zero_node with null_pointer_node for pointer types.
* gcc-interface/trans.cc (gnat_gimplify_expr) <NULL_EXPR>: Likewise.
* gcc-interface/utils.cc (maybe_pad_type): Do not attempt to make a
packable type from a fat pointer type.
* gcc-interface/utils2.cc (build_atomic_load): Use a local variable.
(build_atomic_store): Likewise.
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r-- | gcc/ada/gcc-interface/decl.cc | 2 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.cc | 2 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils.cc | 1 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils2.cc | 21 |
4 files changed, 14 insertions, 12 deletions
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 53a1124..456fe53 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -1212,7 +1212,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) && (POINTER_TYPE_P (gnu_type) || TYPE_IS_FAT_POINTER_P (gnu_type)) && !gnu_expr && !Is_Imported (gnat_entity)) - gnu_expr = integer_zero_node; + gnu_expr = null_pointer_node; /* If we are defining the object and it has an Address clause, we must either get the address expression from the saved GCC tree for the diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc index 4e5f263..8c8a78f 100644 --- a/gcc/ada/gcc-interface/trans.cc +++ b/gcc/ada/gcc-interface/trans.cc @@ -8987,7 +8987,7 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p, || TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE) *expr_p = build_unary_op (INDIRECT_REF, NULL_TREE, convert (build_pointer_type (type), - integer_zero_node)); + null_pointer_node)); /* Otherwise, just make a VAR_DECL. */ else diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc index 337b552..8f1861b 100644 --- a/gcc/ada/gcc-interface/utils.cc +++ b/gcc/ada/gcc-interface/utils.cc @@ -1562,6 +1562,7 @@ maybe_pad_type (tree type, tree size, unsigned int align, at the RTL level when the stand-alone object is accessed as a whole. */ if (align > 0 && RECORD_OR_UNION_TYPE_P (type) + && !TYPE_IS_FAT_POINTER_P (type) && TYPE_MODE (type) == BLKmode && !TYPE_BY_REFERENCE_P (type) && TREE_CODE (orig_size) == INTEGER_CST diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index c56fccb..e173772 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -692,13 +692,14 @@ build_atomic_load (tree src, bool sync) = build_int_cst (integer_type_node, sync ? MEMMODEL_SEQ_CST : MEMMODEL_RELAXED); tree orig_src = src; - tree t, addr, val; + tree type, t, addr, val; unsigned int size; int fncode; /* Remove conversions to get the address of the underlying object. */ src = remove_conversions (src, false); - size = resolve_atomic_size (TREE_TYPE (src)); + type = TREE_TYPE (src); + size = resolve_atomic_size (type); if (size == 0) return orig_src; @@ -710,7 +711,7 @@ build_atomic_load (tree src, bool sync) /* First reinterpret the loaded bits in the original type of the load, then convert to the expected result type. */ - t = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (src), val); + t = fold_build1 (VIEW_CONVERT_EXPR, type, val); return convert (TREE_TYPE (orig_src), t); } @@ -728,13 +729,14 @@ build_atomic_store (tree dest, tree src, bool sync) = build_int_cst (integer_type_node, sync ? MEMMODEL_SEQ_CST : MEMMODEL_RELAXED); tree orig_dest = dest; - tree t, int_type, addr; + tree type, t, int_type, addr; unsigned int size; int fncode; /* Remove conversions to get the address of the underlying object. */ dest = remove_conversions (dest, false); - size = resolve_atomic_size (TREE_TYPE (dest)); + type = TREE_TYPE (dest); + size = resolve_atomic_size (type); if (size == 0) return build_binary_op (MODIFY_EXPR, NULL_TREE, orig_dest, src); @@ -746,12 +748,11 @@ build_atomic_store (tree dest, tree src, bool sync) then reinterpret them in the effective type. But if the original type is a padded type with the same size, convert to the inner type instead, as we don't want to artificially introduce a CONSTRUCTOR here. */ - if (TYPE_IS_PADDING_P (TREE_TYPE (dest)) - && TYPE_SIZE (TREE_TYPE (dest)) - == TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (dest))))) - src = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (dest))), src); + if (TYPE_IS_PADDING_P (type) + && TYPE_SIZE (type) == TYPE_SIZE (TREE_TYPE (TYPE_FIELDS (type)))) + src = convert (TREE_TYPE (TYPE_FIELDS (type)), src); else - src = convert (TREE_TYPE (dest), src); + src = convert (type, src); src = fold_build1 (VIEW_CONVERT_EXPR, int_type, src); addr = build_unary_op (ADDR_EXPR, ptr_type, dest); |