public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Christian Bruel <christian.bruel@st.com>
To: <law@redhat.com>
Cc: <gcc-patches@gcc.gnu.org>, <Ramana.Radhakrishnan@arm.com>,
	       <kyrylo.tkachov@arm.com>, <richard.earnshaw@arm.com>
Subject: Re: [PATCH ARM]: PR67745: Fix function alignment after __attribute__ 2/2
Date: Wed, 07 Oct 2015 07:05:00 -0000	[thread overview]
Message-ID: <5614C412.5080400@st.com> (raw)
In-Reply-To: <560D5B36.2020600@st.com>

[-- Attachment #1: Type: text/plain, Size: 840 bytes --]

The ARM target can switch different alignment requirements between the 
thumb or arm, thanks to the attribute ((target)). Using 
FUNCTION_BOUNDARY that now depends on the switchable target_flag.

The previous attempt to fix this was to use the set_current_function 
hook to reset DECL_ALIGN. On a second thought I found this not 
satisfactory because this hook is called multiple time between passes, 
whereas the setting only needs to be done once.

Instead, this patch resets the function's DECL_ALIGN in 
allocate_struct_function, when not enforced by the user or the language, 
after the attributes are processed.

Tested for arm-none-eabi (with the 1/2 part 
https://gcc.gnu.org/ml/gcc-patches/2015-09/msg02198.html)

Bootstraped for x86_64-unknown-linux-gnu and tested (c+,c++,fortran)

Comments ? OK for trunk ?

thanks

Christian



[-- Attachment #2: align3.patch --]
[-- Type: text/x-patch, Size: 818 bytes --]

2015-10-07  Christian Bruel  <christian.bruel@st.com>

	PR target/67745
	* function.c (allocate_struct_function): Relayout function's alignment.

Index: gcc/function.c
===================================================================
--- gcc/function.c	(revision 228515)
+++ gcc/function.c	(working copy)
@@ -4840,6 +4840,12 @@ allocate_struct_function (tree fndecl, b
 	  for (tree parm = DECL_ARGUMENTS (fndecl); parm;
 	       parm = DECL_CHAIN (parm))
 	    relayout_decl (parm);
+
+	  /* Similarly, relayout function's alignment if not forced.  */
+	  if (!DECL_USER_ALIGN (fndecl)
+	      && (TREE_CODE (fntype) != METHOD_TYPE
+		  || TARGET_PTRMEMFUNC_VBIT_LOCATION != ptrmemfunc_vbit_in_pfn))
+	    DECL_ALIGN (fndecl) = FUNCTION_BOUNDARY;
 	}
 
       if (!abstract_p && aggregate_value_p (result, fndecl))

  reply	other threads:[~2015-10-07  7:05 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29 13:44 Christian Bruel
2015-09-29 13:59 ` Christian Bruel
2015-09-30 19:30 ` Jeff Law
2015-10-01  7:12   ` Christian Bruel
2015-10-01 16:11     ` Christian Bruel
2015-10-07  7:05       ` Christian Bruel [this message]
2015-10-07 10:18         ` Bernd Schmidt
2015-10-07 10:45           ` Christian Bruel
2015-10-07 17:37             ` Bernd Schmidt
2015-10-07 17:50               ` Bernd Schmidt
2015-10-08 13:14                 ` Christian Bruel
2015-10-08 13:20                   ` Bernd Schmidt
2015-10-08 13:51                     ` Christian Bruel
2015-10-08 14:30                       ` Bernd Schmidt
2015-10-12 10:56                         ` Christian Bruel
2015-10-12 11:19                           ` Bernd Schmidt
2015-10-12 11:26                             ` Christian Bruel
2015-10-16  8:03                             ` refactoring TARGET_PTRMEMFUNC_VBIT_LOCATION checks Christian Bruel
2015-10-16  9:47                               ` Bernd Schmidt
2015-10-16 10:50                                 ` Christian Bruel
2015-10-16 10:56                                   ` Bernd Schmidt
2015-10-16 10:56                                   ` Christian Bruel
2015-10-13  8:03                           ` [PATCH ARM]: PR67745: Fix function alignment after __attribute__ 2/2 Ramana Radhakrishnan
2015-10-13 10:18                             ` Christian Bruel
2015-10-16 14:18                             ` Christian Bruel
2015-10-08 14:01               ` Christian Bruel
2015-10-08 14:05                 ` Bernd Schmidt
2015-10-07 17:40         ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5614C412.5080400@st.com \
    --to=christian.bruel@st.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kyrylo.tkachov@arm.com \
    --cc=law@redhat.com \
    --cc=richard.earnshaw@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).