public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch AArch64] Switch constant pools to separate rodata sections.
@ 2015-11-03 16:36 Ramana Radhakrishnan
  2015-11-03 17:10 ` James Greenhalgh
  0 siblings, 1 reply; 11+ messages in thread
From: Ramana Radhakrishnan @ 2015-11-03 16:36 UTC (permalink / raw)
  To: gcc-patches

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

Hi,

	Now that PR63304 is fixed and we have an option to address
any part of the memory using adrp / add or adrp / ldr instructions
it makes sense to switch out literal pools into their own
mergeable sections by default.

This would mean that by default we could now start getting
the benefits of constant sharing across the board, potentially
improving code size. The other advantage of doing so, for the
security conscious is that this prevents intermingling of literal
pools with code.

Wilco's kindly done some performance measurements and suggests that
there is not really a performance regression in doing this.
I've looked at the code size for SPEC2k6 today at -Ofast and
in general there is a good code size improvement as expected
by sharing said constants.

Tested on aarch64-none-elf with no regressions and bootstrapped 
and regression tested in my tree for a number of days now.

Ok to commit ?

regards
Ramana

   * config/aarch64/aarch64.c (aarch64_select_rtx_section): Switch
to default section handling for non PC relative literal loads.

[-- Attachment #2: default-rodata.txt --]
[-- Type: text/plain, Size: 1312 bytes --]

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 5c8604f..9d709e5 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5244,13 +5244,22 @@ aarch64_use_blocks_for_constant_p (machine_mode mode ATTRIBUTE_UNUSED,
   return false;
 }
 
+/* Force all constant pool entries into the current function section.
+   In the large model we cannot reliably address all the address space
+   thus for now, inline this with the text.  */
 static section *
-aarch64_select_rtx_section (machine_mode mode ATTRIBUTE_UNUSED,
-			    rtx x ATTRIBUTE_UNUSED,
-			    unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED)
-{
-  /* Force all constant pool entries into the current function section.  */
-  return function_section (current_function_decl);
+aarch64_select_rtx_section (machine_mode mode,
+			    rtx x,
+			    unsigned HOST_WIDE_INT align)
+{
+  /* Force all constant pool entries into the current function section.
+     In the large model we cannot reliably address all the address space
+     thus for now, inline this with the text.  */
+  if (!aarch64_nopcrelative_literal_loads
+      || aarch64_cmodel == AARCH64_CMODEL_LARGE)
+    return function_section (current_function_decl);
+
+  return default_elf_select_rtx_section (mode, x, align);
 }
 
 
-- 
1.9.1


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

end of thread, other threads:[~2015-11-10 17:00 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-03 16:36 [Patch AArch64] Switch constant pools to separate rodata sections Ramana Radhakrishnan
2015-11-03 17:10 ` James Greenhalgh
2015-11-04 14:26   ` Ramana Radhakrishnan
2015-11-05  9:35     ` James Greenhalgh
2015-11-08 11:43     ` Andreas Schwab
2015-11-09 14:24       ` Ramana Radhakrishnan
2015-11-09 16:46       ` Ramana Radhakrishnan
2015-11-09 17:21         ` James Greenhalgh
2015-11-10 16:39     ` Alan Lawrence
2015-11-10 16:47       ` Ramana Radhakrishnan
2015-11-10 17:00       ` Alan Lawrence

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