public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH ARM]: PR67745: Fix function alignment after __attribute__ 2/2
@ 2015-09-29 13:44 Christian Bruel
  2015-09-29 13:59 ` Christian Bruel
  2015-09-30 19:30 ` Jeff Law
  0 siblings, 2 replies; 28+ messages in thread
From: Christian Bruel @ 2015-09-29 13:44 UTC (permalink / raw)
  Cc: gcc-patches, kyrylo.tkachov, kyrylo.tkachov, richard.earnshaw

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

This patch uses FUNCTION_BOUNDARY instead of DECL_ALIGN to check the max
align when optimizing for size in assemble_start_function.
This is necessary for ARM that can switch the max code alignment
directives between modes.

No regressions for ARM
Testing on-going for x86

Christian

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: align2.patch --]
[-- Type: text/x-patch; name="align2.patch", Size: 1503 bytes --]

2015-09-29  Christian Bruel  <christian.bruel@st.com>

	PR target/67745
	* gcc/varasm.c (assemble_start_function): Use current's function align.

Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c	(revision 228229)
+++ gcc/varasm.c	(working copy)
@@ -1729,7 +1729,7 @@ assemble_start_function (tree decl, cons
   if (CONSTANT_POOL_BEFORE_FUNCTION)
     output_constant_pool (fnname, decl);
 
-  align = symtab_node::get (decl)->definition_alignment ();
+  align = FUNCTION_BOUNDARY;
 
   /* Make sure the not and cold text (code) sections are properly
      aligned.  This is necessary here in the case where the function
@@ -1774,12 +1774,15 @@ assemble_start_function (tree decl, cons
       ASM_OUTPUT_ALIGN (asm_out_file, align);
     }
 
+  /* align_functions_log cannot exceed current function's ABI when
+     optimizing for size  */
+  if (optimize_function_for_size_p (cfun))
+    align_functions_log = MIN (align_functions_log, align);
+
   /* Handle a user-specified function alignment.
      Note that we still need to align to DECL_ALIGN, as above,
      because ASM_OUTPUT_MAX_SKIP_ALIGN might not do any alignment at all.  */
-  if (! DECL_USER_ALIGN (decl)
-      && align_functions_log > align
-      && optimize_function_for_speed_p (cfun))
+  if (! DECL_USER_ALIGN (decl) && align_functions_log > align)
     {
 #ifdef ASM_OUTPUT_MAX_SKIP_ALIGN
       ASM_OUTPUT_MAX_SKIP_ALIGN (asm_out_file,

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2015-10-16 14:12 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-29 13:44 [PATCH ARM]: PR67745: Fix function alignment after __attribute__ 2/2 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
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                                   ` Christian Bruel
2015-10-16 10:56                                   ` Bernd Schmidt
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

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).