[gcc/devel/gccgo] Remove last use of expr_align

Ian Lance Taylor ian@gcc.gnu.org
Sun Jul 12 18:03:21 GMT 2020


https://gcc.gnu.org/g:65ba91b79e1664ba7e7f60f68e4cb956453b692e

commit 65ba91b79e1664ba7e7f60f68e4cb956453b692e
Author: Eric Botcazou <ebotcazou@gcc.gnu.org>
Date:   Sat May 9 21:37:13 2020 +0200

    Remove last use of expr_align
    
    It was in the ada/gcc-interface repository and is outdated.
    
            * tree.h (expr_align): Delete.
            * tree.c (expr_align): Likewise.
    ada/
            * gcc-interface/utils2.c: Include builtins.h.
            (known_alignment) <ADDR_EXPR>: Use DECL_ALIGN for DECL_P operands
            and get_object_alignment for the rest.

Diff:
---
 gcc/ChangeLog                  |  5 +++++
 gcc/ada/ChangeLog              |  6 ++++++
 gcc/ada/gcc-interface/utils2.c |  6 +++++-
 gcc/tree.c                     | 45 ------------------------------------------
 gcc/tree.h                     |  1 -
 5 files changed, 16 insertions(+), 47 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 178973f0e73..cff8ea3f95a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-09  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* tree.h (expr_align): Delete.
+	* tree.c (expr_align): Likewise.
+
 2020-05-09  Hans-Peter Nilsson  <hp@axis.com>
 
 	* resource.c (init_resource_info): Filter-out TARGET_FLAGS_REGNUM
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 35d111401e2..0c1c265c8eb 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2020-05-09  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* gcc-interface/utils2.c: Include builtins.h.
+	(known_alignment) <ADDR_EXPR>: Use DECL_ALIGN for DECL_P operands
+	and get_object_alignment for the rest.
+
 2020-05-08  Eric Botcazou  <ebotcazou@adacore.com>
 
 	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Force at
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index 6ff1372899c..30d08f50896 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -32,6 +32,7 @@
 #include "alias.h"
 #include "tree.h"
 #include "inchash.h"
+#include "builtins.h"
 #include "fold-const.h"
 #include "stor-layout.h"
 #include "stringpool.h"
@@ -167,7 +168,10 @@ known_alignment (tree exp)
       break;
 
     case ADDR_EXPR:
-      this_alignment = expr_align (TREE_OPERAND (exp, 0));
+      if (DECL_P (TREE_OPERAND (exp, 0)))
+	this_alignment = DECL_ALIGN (TREE_OPERAND (exp, 0));
+      else
+	this_alignment = get_object_alignment (TREE_OPERAND (exp, 0));
       break;
 
     case CALL_EXPR:
diff --git a/gcc/tree.c b/gcc/tree.c
index 397474900ff..5b7d3fddbcb 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3351,51 +3351,6 @@ int_byte_position (const_tree field)
   return tree_to_shwi (byte_position (field));
 }
 
-/* Return the strictest alignment, in bits, that T is known to have.  */
-
-unsigned int
-expr_align (const_tree t)
-{
-  unsigned int align0, align1;
-
-  switch (TREE_CODE (t))
-    {
-    CASE_CONVERT:  case NON_LVALUE_EXPR:
-      /* If we have conversions, we know that the alignment of the
-	 object must meet each of the alignments of the types.  */
-      align0 = expr_align (TREE_OPERAND (t, 0));
-      align1 = TYPE_ALIGN (TREE_TYPE (t));
-      return MAX (align0, align1);
-
-    case SAVE_EXPR:         case COMPOUND_EXPR:       case MODIFY_EXPR:
-    case INIT_EXPR:         case TARGET_EXPR:         case WITH_CLEANUP_EXPR:
-    case CLEANUP_POINT_EXPR:
-      /* These don't change the alignment of an object.  */
-      return expr_align (TREE_OPERAND (t, 0));
-
-    case COND_EXPR:
-      /* The best we can do is say that the alignment is the least aligned
-	 of the two arms.  */
-      align0 = expr_align (TREE_OPERAND (t, 1));
-      align1 = expr_align (TREE_OPERAND (t, 2));
-      return MIN (align0, align1);
-
-      /* FIXME: LABEL_DECL and CONST_DECL never have DECL_ALIGN set
-	 meaningfully, it's always 1.  */
-    case LABEL_DECL:     case CONST_DECL:
-    case VAR_DECL:       case PARM_DECL:   case RESULT_DECL:
-    case FUNCTION_DECL:
-      gcc_assert (DECL_ALIGN (t) != 0);
-      return DECL_ALIGN (t);
-
-    default:
-      break;
-    }
-
-  /* Otherwise take the alignment from that of the type.  */
-  return TYPE_ALIGN (TREE_TYPE (t));
-}
-
 /* Return, as a tree node, the number of elements for TYPE (which is an
    ARRAY_TYPE) minus one. This counts only elements of the top array.  */
 
diff --git a/gcc/tree.h b/gcc/tree.h
index c51c4b651d4..4644d6616d9 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -4641,7 +4641,6 @@ extern hashval_t type_hash_canon_hash (tree);
 extern tree type_hash_canon (unsigned int, tree);
 
 extern tree convert (tree, tree);
-extern unsigned int expr_align (const_tree);
 extern tree size_in_bytes_loc (location_t, const_tree);
 inline tree
 size_in_bytes (const_tree t)


More information about the Gcc-cvs mailing list