diff mbox

[AArch64-4.7] Backport: Implement section anchors

Message ID 1360761999-23124-1-git-send-email-james.greenhalgh@arm.com
State New
Headers show

Commit Message

James Greenhalgh Feb. 13, 2013, 1:26 p.m. UTC
Hi,

This patch is a backport of the section anchors support introduced
to aarch64-branch here:
http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00384.html

The patch has been tested for aarch64-none-elf with only a known
regression, fixed by backporting this patch by Andrew Pinski:
http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00580.html

Is this OK to commit to aarch64-4.7-branch?

Thanks,
James Greenhalgh

---
gcc/

2013-02-13  James Greenhalgh  <james.greenhalgh@arm.com>

	Backport from aarch64-branch.
	2012-09-06  James Greenhalgh  <james.greenhalgh@arm.com>
		    Richard Earnshaw  <rearnsha@arm.com>

	* common/config/aarch64/aarch64-common.c
	(aarch_option_optimization_table): New.
	(TARGET_OPTION_OPTIMIZATION_TABLE): Define.
	* gcc/config/aarch64/aarch64-elf.h (ASM_OUTPUT_DEF): New definition.
	* gcc/config/aarch64/aarch64.c (TARGET_MIN_ANCHOR_OFFSET): Define.
	(TARGET_MAX_ANCHOR_OFFSET): Likewise.

Comments

Marcus Shawcroft Feb. 13, 2013, 1:28 p.m. UTC | #1
On 13 February 2013 13:26, James Greenhalgh <james.greenhalgh@arm.com> wrote:
>
> Hi,
>
> This patch is a backport of the section anchors support introduced
> to aarch64-branch here:
> http://gcc.gnu.org/ml/gcc-patches/2012-09/msg00384.html
>
> The patch has been tested for aarch64-none-elf with only a known
> regression, fixed by backporting this patch by Andrew Pinski:
> http://gcc.gnu.org/ml/gcc-patches/2012-11/msg00580.html
>
> Is this OK to commit to aarch64-4.7-branch?

Yes.
/Marcus
diff mbox

Patch

diff --git a/gcc/common/config/aarch64/aarch64-common.c b/gcc/common/config/aarch64/aarch64-common.c
index df72406..bd249e1 100644
--- a/gcc/common/config/aarch64/aarch64-common.c
+++ b/gcc/common/config/aarch64/aarch64-common.c
@@ -36,6 +36,17 @@ 
 #undef  TARGET_HANDLE_OPTION
 #define TARGET_HANDLE_OPTION aarch64_handle_option
 
+#undef	TARGET_OPTION_OPTIMIZATION_TABLE
+#define TARGET_OPTION_OPTIMIZATION_TABLE aarch_option_optimization_table
+
+/* Set default optimization options.  */
+static const struct default_options aarch_option_optimization_table[] =
+  {
+    /* Enable section anchors by default at -O1 or higher.  */
+    { OPT_LEVELS_1_PLUS, OPT_fsection_anchors, NULL, 1 },
+    { OPT_LEVELS_NONE, 0, NULL, 0 }
+  };
+
 /* Implement TARGET_HANDLE_OPTION.
    This function handles the target specific options for CPU/target selection.
 
diff --git a/gcc/config/aarch64/aarch64-elf.h b/gcc/config/aarch64/aarch64-elf.h
index 6d8b933..1c021d0 100644
--- a/gcc/config/aarch64/aarch64-elf.h
+++ b/gcc/config/aarch64/aarch64-elf.h
@@ -25,6 +25,15 @@ 
 #define ASM_OUTPUT_LABELREF(FILE, NAME) \
   aarch64_asm_output_labelref (FILE, NAME)
 
+#define ASM_OUTPUT_DEF(FILE, NAME1, NAME2)	\
+  do						\
+    {						\
+      assemble_name (FILE, NAME1);		\
+      fputs (" = ", FILE);			\
+      assemble_name (FILE, NAME2);		\
+      fputc ('\n', FILE);			\
+    } while (0)
+
 #define TEXT_SECTION_ASM_OP	"\t.text"
 #define DATA_SECTION_ASM_OP	"\t.data"
 #define BSS_SECTION_ASM_OP	"\t.bss"
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 1e546cc..ed5b6bb 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -7950,6 +7950,17 @@  aarch64_vectorize_vec_perm_const_ok (enum machine_mode vmode,
 #define TARGET_VECTORIZE_VEC_PERM_CONST_OK \
   aarch64_vectorize_vec_perm_const_ok
 
+/* Section anchor support.  */
+
+#undef TARGET_MIN_ANCHOR_OFFSET
+#define TARGET_MIN_ANCHOR_OFFSET -256
+
+/* Limit the maximum anchor offset to 4k-1, since that's the limit for a
+   byte offset; we can do much more for larger data types, but have no way
+   to determine the size of the access.  We assume accesses are aligned.  */
+#undef TARGET_MAX_ANCHOR_OFFSET
+#define TARGET_MAX_ANCHOR_OFFSET 4095
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-aarch64.h"