From: Denys Vlasenko <dvlasenk@redhat.com>
To: Bernd Schmidt <bschmidt@redhat.com>, gcc-patches@gcc.gnu.org
Cc: Andrew Pinski <pinskia@gmail.com>, Uros Bizjak <ubizjak@gmail.com>
Subject: Re: [PATCH 2/2] Extend -falign-FOO=N to N[,M[,N2[,M2]]]
Date: Thu, 29 Sep 2016 22:04:00 -0000 [thread overview]
Message-ID: <4d311cfa-3fdc-c2a2-e9ed-028c8487708c@redhat.com> (raw)
In-Reply-To: <175480fb-142a-f261-5f86-421941369848@redhat.com>
On 09/29/2016 07:32 PM, Denys Vlasenko wrote:
>>> +#ifdef SUBALIGN_LOG
>>
>> We want to avoid adding new #defines; existing ones are being converted
>> to target hooks. I suspect the best way is to record whether an M value
>> was specified, and override it in the x86 option_override if required.
>> If that's infeasible for some reason we can revisit this.
>>
>>> + /* Before -falign-foo=N,M,N2,M2 was introduced, x86 had a tweak.
>>> + -falign-functions=N with N > 8 was adding secondary alignment.
>>> + -falign-functions=10 was emitting this before every function:
>>> + .p2align 4,,9
>>> + .p2align 3
>>> + Now this behavior (and more) can be explicitly requested:
>>> + -falign-functions=16,10,8
>>> + Retain old behavior if N2 is missing: */
>>> + else if (a[0].log > SUBALIGN_LOG)
>>> + a[1].log = SUBALIGN_LOG;
>>
>> So this would live in i386.c, probably.
>
> Thanks, I'm working on it...
...and I can't find a sane way to achieve it in the way you prefer.
Hooking it into ix86_override_options_after_change()?
Like this?
/* Implement TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook. */
static void
ix86_override_options_after_change (void)
{
ix86_default_align (&global_options);
}
static void
ix86_default_align (struct gcc_options *opts)
{
struct align_flags *fa;
/* -falign-foo without argument: supply one */
if (opts->x_flag_align_functions && !opts->x_str_align_functions)
{
opts->x_str_align_functions = processor_target_table[ix86_tune].align_func;
}
/* Before -falign-foo=N,M,N2,M2 was introduced, x86 had a tweak.
-falign-functions=N with N > 8 was adding secondary alignment.
-falign-functions=10 was emitting this before every function:
.p2align 4,,9
.p2align 3
Retain old behavior if N2 is missing: */
fa = this_target_flag_state->x_align_functions;
if (fa[1].log == 0 && fa[0].log > 3)
fa[1].log = 3;
}
Well, the problem here is that init_alignments() is called
much later than this hook. The
fa = this_target_flag_state->x_align_functions;
if (fa[1].log == 0 && fa[0].log > 3)
fa[1].log = 3;
will not trigger here: x_align_functions[0].log is not yet set!
Just set N2 to 2^3 unconditionally?
fa = this_target_flag_state->x_align_functions;
fa[1].log = 3;
This will make any alignment, even none: -falign-functions=1
have 8 byte subalign.
Help?
next prev parent reply other threads:[~2016-09-29 21:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-28 13:13 [PATCH 0/2] Extend -falign-FOO=N to N[,M[,N2[,M2]]] version 4 Denys Vlasenko
2016-09-28 12:57 ` [PATCH 1/2] Temporary remove "at least 8 byte alignment" code from x86 Denys Vlasenko
2016-09-28 13:31 ` [PATCH 2/2] Extend -falign-FOO=N to N[,M[,N2[,M2]]] Denys Vlasenko
2016-09-29 8:27 ` Florian Weimer
2016-09-29 14:54 ` Bernd Schmidt
2016-09-29 17:36 ` Denys Vlasenko
2016-09-29 22:04 ` Denys Vlasenko [this message]
2016-09-30 12:10 ` Bernd Schmidt
2016-09-30 15:40 ` Denys Vlasenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4d311cfa-3fdc-c2a2-e9ed-028c8487708c@redhat.com \
--to=dvlasenk@redhat.com \
--cc=bschmidt@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=pinskia@gmail.com \
--cc=ubizjak@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).