Hi, This patch implements section anchors for the AArch64 port.
OK for aarch64-branch? Regards, James Greenhalgh -- 2012-09-06 James Greenhalgh <james.greenha...@arm.com> Richard Earnshaw <rearn...@arm.com> * common/config/aarch64/aarch64-common.c (aarch_option_optimization_table): New. (TARGET_OPTION_OPTIMIZATION_TABLE): Define. * gcc/config.gcc ([aarch64] target_has_targetm_common): Set to yes. * 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.
diff --git gcc/common/config/aarch64/aarch64-common.c gcc/common/config/aarch64/aarch64-common.c index df72406..bd249e1 100644 --- gcc/common/config/aarch64/aarch64-common.c +++ 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 gcc/config.gcc gcc/config.gcc index 72ef1ca..27a93b5 100644 --- gcc/config.gcc +++ gcc/config.gcc @@ -314,6 +314,7 @@ aarch64*-*-*) need_64bit_hwint=yes extra_headers="arm_neon.h" extra_objs="aarch64-builtins.o" + target_has_targetm_common=yes ;; alpha*-*-*) cpu_type=alpha diff --git gcc/config/aarch64/aarch64-elf.h gcc/config/aarch64/aarch64-elf.h index 6d8b933..1c021d0 100644 --- gcc/config/aarch64/aarch64-elf.h +++ 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 gcc/config/aarch64/aarch64.c gcc/config/aarch64/aarch64.c index 310c1a0..98f43e1 100644 --- gcc/config/aarch64/aarch64.c +++ gcc/config/aarch64/aarch64.c @@ -6799,6 +6799,17 @@ aarch64_c_mode_for_suffix (char suffix) #undef TARGET_VECTORIZE_PREFERRED_SIMD_MODE #define TARGET_VECTORIZE_PREFERRED_SIMD_MODE aarch64_preferred_simd_mode +/* 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"