On 04/03/16 17:24, Alan Lawrence wrote:
On 26/02/16 14:52, James Greenhalgh wrote:

gcc/ChangeLog:

    * gcc/config/aarch64/aarch64.c (aarch64_function_arg_alignment):
    Rewrite, looking one level down for records and arrays.
---
  gcc/config/aarch64/aarch64.c | 31 ++++++++++++++++---------------
  1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 9142ac0..b084f83 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1925,22 +1925,23 @@ aarch64_vfp_is_call_candidate (cumulative_args_t
pcum_v, machine_mode mode,
  static unsigned int
  aarch64_function_arg_alignment (machine_mode mode, const_tree type)
  {
-  unsigned int alignment;
+  if (!type)
+    return GET_MODE_ALIGNMENT (mode);
+  if (integer_zerop (TYPE_SIZE (type)))
+    return 0;

-  if (type)
-    {
-      if (!integer_zerop (TYPE_SIZE (type)))
-    {
-      if (TYPE_MODE (type) == mode)
-        alignment = TYPE_ALIGN (type);
-      else
-        alignment = GET_MODE_ALIGNMENT (mode);
-    }
-      else
-    alignment = 0;
-    }
-  else
-    alignment = GET_MODE_ALIGNMENT (mode);
+  gcc_assert (TYPE_MODE (type) == mode);
+
+  if (!AGGREGATE_TYPE_P (type))
+    return TYPE_ALIGN (TYPE_MAIN_VARIANT (type));
+
+  if (TREE_CODE (type) == ARRAY_TYPE)
+    return TYPE_ALIGN (TREE_TYPE (type));
+
+  unsigned int alignment = 0;
+
+  for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
+    alignment = std::max (alignment, DECL_ALIGN (field));

    return alignment;
  }



Ping.

[snip]


I'm not proposing to backport these AArch64 changes, hence:

Ping^2.

(For gcc 7 ?)

Also tests https://gcc.gnu.org/ml/gcc-patches/2016-01/msg01073.html .

Ping^3.

Cheers, Alan

Reply via email to