This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] gcc feature request: Moving blocks into sections
- From: Linus Torvalds <torvalds at linux-foundation dot org>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: Steven Rostedt <rostedt at goodmis dot org>, LKML <linux-kernel at vger dot kernel dot org>, gcc <gcc at gcc dot gnu dot org>, Ingo Molnar <mingo at kernel dot org>, Mathieu Desnoyers <mathieu dot desnoyers at efficios dot com>, "H. Peter Anvin" <hpa at linux dot intel dot com>, Thomas Gleixner <tglx at linutronix dot de>, David Daney <ddaney dot cavm at gmail dot com>, Behan Webster <behanw at converseincode dot com>, Peter Zijlstra <peterz at infradead dot org>, Herbert Xu <herbert at gondor dot hengli dot com dot au>
- Date: Mon, 5 Aug 2013 12:56:17 -0700
- Subject: Re: [RFC] gcc feature request: Moving blocks into sections
- References: <1375721715 dot 22073 dot 80 dot camel at gandalf dot local dot home> <CA+55aFw_o=D-j_SRn=Y4LhHm-tEyuP1Je5ZHVTYxbVyLyDcLEg at mail dot gmail dot com> <1375725328 dot 22073 dot 101 dot camel at gandalf dot local dot home> <CA+55aFwRHpL-3YObZfw6NxxDxMqQbiwp0=NnpotGj2RHDNF3iw at mail dot gmail dot com> <CA+55aFw=OX3Zz_PJc7NUGwFLAE1RYUsPe9Dn8qHDN0nZeW2R5A at mail dot gmail dot com> <CA+55aFyzmGzv3C9gy5Xi=pSmAOzpYMNAqrrrZmsvNbt4LdrorQ at mail dot gmail dot com> <20130805194009 dot GZ17022 at redhat dot com>
On Mon, Aug 5, 2013 at 12:40 PM, Marek Polacek <polacek@redhat.com> wrote:
>
> FWIW, we also support hot/cold attributes for labels, thus e.g.
>
> if (bar ())
> goto A;
> /* ... */
> A: __attribute__((cold))
> /* ... */
>
> I don't know whether that might be useful for what you want or not though...
Steve? That does sound like it might at least re-order the basic
blocks better for your cases. Worth checking out, no?
That said, I don't know what gcc actually does for that case. It may
be that it just ends up trying to transfer that "cold" information to
the conditional itself, which wouldn't work for our asm goto use. I
hope/assume it doesn't do that, though, since the "cold" attribute
would presumably also be useful for things like computed gotos etc -
so it really isn't about the _source_ of the branch, but about that
specific target, and the basic block re-ordering.
Anyway, the exact implementation details may make it more or less
useful for our special static key things. But it does sound like the
right thing to do for static keys.
Linus