* [Patch] alpha: add support for -fsection-anchors
@ 2011-11-04 14:58 Tristan Gingold
2011-11-04 15:33 ` Richard Henderson
0 siblings, 1 reply; 3+ messages in thread
From: Tristan Gingold @ 2011-11-04 14:58 UTC (permalink / raw)
To: GCC Patches, Richard Henderson
Hi,
the alpha/vms ABI uses a per-function TOC/GOT, not unlike AIX. As a consequence, -fsection-anchors really reduce the size of the TOC and even of the code.
This patch adds support of -fsection-anchors on alpha, and enable by default on Alpha/VMA (although it is still off at -O0). This is a port of a similar patch we had for gcc 4.5
Tested on trunk by building alpha64-dec-vms and alpha-linux.
Richard, as it impacts all alpha targets, do you have any objection ?
Tristan.
2011-11-04 Tristan Gingold <gingold@adacore.com>
* common/config/alpha/alpha-common.c (alpha_option_init_struct):
New function.
(TARGET_OPTION_INIT_STRUCT): Define.
* config/alpha/alpha.c (TARGET_MIN_ANCHOR_OFFSET)
(TARGET_MAX_ANCHOR_OFFSET)
(TARGET_USE_BLOCKS_FOR_CONSTANT_P): Redefine.
index fcf5369..8a366b6 100644
--- a/gcc/common/config/alpha/alpha-common.c
+++ b/gcc/common/config/alpha/alpha-common.c
@@ -36,6 +36,17 @@ static const struct default_options alpha_option_optimization_table[] =
{ OPT_LEVELS_NONE, 0, NULL, 0 }
};
+/* Implement TARGET_OPTION_INIT_STRUCT. */
+
+static void
+alpha_option_init_struct (struct gcc_options *opts ATTRIBUTE_UNUSED)
+{
+#if TARGET_ABI_OPEN_VMS
+ /* Enable section anchors by default. */
+ opts->x_flag_section_anchors = 1;
+#endif
+}
+
/* Implement TARGET_HANDLE_OPTION. */
static bool
@@ -75,6 +86,9 @@ alpha_handle_option (struct gcc_options *opts,
#undef TARGET_HANDLE_OPTION
#define TARGET_HANDLE_OPTION alpha_handle_option
+#undef TARGET_OPTION_INIT_STRUCT
+#define TARGET_OPTION_INIT_STRUCT alpha_option_init_struct
+
#undef TARGET_OPTION_OPTIMIZATION_TABLE
#define TARGET_OPTION_OPTIMIZATION_TABLE alpha_option_optimization_table
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 682e5be..9a43f80 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -9643,6 +9643,14 @@ alpha_conditional_register_usage (void)
#define TARGET_STDARG_OPTIMIZE_HOOK alpha_stdarg_optimize_hook
#endif
+/* Use 16-bits anchor. */
+#undef TARGET_MIN_ANCHOR_OFFSET
+#define TARGET_MIN_ANCHOR_OFFSET -0x7fff - 1
+#undef TARGET_MAX_ANCHOR_OFFSET
+#define TARGET_MAX_ANCHOR_OFFSET 0x7fff
+#undef TARGET_USE_BLOCKS_FOR_CONSTANT_P
+#define TARGET_USE_BLOCKS_FOR_CONSTANT_P hook_bool_mode_const_rtx_true
+
#undef TARGET_RTX_COSTS
#define TARGET_RTX_COSTS alpha_rtx_costs
#undef TARGET_ADDRESS_COST
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch] alpha: add support for -fsection-anchors
2011-11-04 14:58 [Patch] alpha: add support for -fsection-anchors Tristan Gingold
@ 2011-11-04 15:33 ` Richard Henderson
2011-11-07 8:55 ` Tristan Gingold
0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2011-11-04 15:33 UTC (permalink / raw)
To: Tristan Gingold; +Cc: GCC Patches
On 11/04/2011 07:52 AM, Tristan Gingold wrote:
> Richard, as it impacts all alpha targets, do you have any objection ?
I suspect not. We might even see what we can do about enabling it
by default for all alpha targets...
r~
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch] alpha: add support for -fsection-anchors
2011-11-04 15:33 ` Richard Henderson
@ 2011-11-07 8:55 ` Tristan Gingold
0 siblings, 0 replies; 3+ messages in thread
From: Tristan Gingold @ 2011-11-07 8:55 UTC (permalink / raw)
To: Richard Henderson; +Cc: GCC Patches
On Nov 4, 2011, at 4:21 PM, Richard Henderson wrote:
> On 11/04/2011 07:52 AM, Tristan Gingold wrote:
>> Richard, as it impacts all alpha targets, do you have any objection ?
>
> I suspect not. We might even see what we can do about enabling it
> by default for all alpha targets…
Committed. I let maintainers for the other OSes decide wether they want it by default or not.
Tristan.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-07 8:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-04 14:58 [Patch] alpha: add support for -fsection-anchors Tristan Gingold
2011-11-04 15:33 ` Richard Henderson
2011-11-07 8:55 ` Tristan Gingold
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).