]> gcc.gnu.org Git - gcc.git/commitdiff
ada: Minor generic tweaks left and and right
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 22 Feb 2023 16:22:11 +0000 (17:22 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 30 May 2023 07:12:18 +0000 (09:12 +0200)
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.

gcc/ada/gcc-interface/decl.cc
gcc/ada/gcc-interface/trans.cc
gcc/ada/gcc-interface/utils.cc
gcc/ada/gcc-interface/utils2.cc

index 53a112435903f5033d0d1c3077e7994b1b1955a9..456fe53737d4c4d7d6b82a60707a5370a92bed52 100644 (file)
@@ -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
index 4e5f26305f5375d22fa721206f3fd35881f80740..8c8a78f5d2dfc8d8f01c27d2c4e4eff984a66f79 100644 (file)
@@ -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
index 337b552619ec2e0d57612ff435109ee1a231067d..8f1861b848e3d536ea5efda5f8dfb9920f804c0b 100644 (file)
@@ -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
index c56fccb4a987d8c9741e5f96ba466ea6c4ee50ec..e1737724b65df24be114eb8858a6d70c1a21bb58 100644 (file)
@@ -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);
 
This page took 0.085397 seconds and 5 git commands to generate.