Commit Message

This patch adds a new linker plugin to re-order functions. The plugin constructs an annotated callgraph with edge profile information and then repeatedly groups sections that are connected by hot edges and passes the new function layout to the linker. The grouping is done similar to the Pettis Hansen procedure ordering scheme.
I had earlier reverted a patch for a plugin that was written in C++. I have re-written the same plugin in C.
How to use the plugin:
During Profile use build stage of Feedback-directed builds, use the flags:
-fcallgraph-profiles-sections
-Wl,--plugin,<path_to_plugin>/libfunction_reordering_plugin.so
The first flag generates special .gnu.callgraph.text sections which contain the callgraph profiles that are read by the plugin and an new function layout is generated. The ordering of sections is dumped in file final_layout.txt along with the callgraph edge profile information.
The plugin itself is implemented in the three files: function_ordering_plugin.c, callgraph.c, and callgraph.h. The file include/plugin-api.h has changes which has already been submitted to trunk. The rest is related to Makefiles and configure scripts to build and install the plugin. I have not attached any of the auto-generated files.
--
This patch is available for review at http://codereview.appspot.com/5124041

Comments

> Re: [google] Linker plugin to do function reordering...
Is there a particularly good reason for why you guys
slip `[google]' into all of your `Subject:' lines?
I was under the impresions that this list is for work
on GCC. Consider putting something germane in the
brackets instead.

On 11-09-24 09:37 , Michael Witten wrote:
>> Re: [google] Linker plugin to do function reordering...>> Is there a particularly good reason for why you guys> slip `[google]' into all of your `Subject:' lines?
Yes, labels in brackets tend to be markers for branches, version
numbers, specific modules. In this case, they're used to indicate
patches to one of the google branches (http://gcc.gnu.org/svn.html,
http://gcc.gnu.org/ml/gcc/2011-01/msg00246.html).
Diego.

On Sat, 24 Sep 2011 10:00:37 -0400, Diego Novillo wrote:
> On 11-09-24 09:37 , Michael Witten wrote:>>> Re: [google] Linker plugin to do function reordering...>>>> Is there a particularly good reason for why you guys>> slip `[google]' into all of your `Subject:' lines?>> Yes, labels in brackets tend to be markers for branches, version > numbers, specific modules. In this case, they're used to indicate > patches to one of the google branches (http://gcc.gnu.org/svn.html, > http://gcc.gnu.org/ml/gcc/2011-01/msg00246.html).
From that email:
> google/integration> A branch following trunk that contains some minimal patches that> are likely not useful anywhere outside of Google's build environment.> These are typically configuration patches.
Why is gnu.gcc.org hosting work that is specific to some company's
build system?
> google/main> A branch of google/integration that contains Google local patches> that we are looking to contribute to trunk. Some of these patches are> either in the process of being reviewed, or have not yet been> proposed. The intent of this branch is to serve as a staging platform> to allow collaboration with external developers. Patches in this> branch are only expected to remain here until they are reviewed and> accepted in trunk.
Why is it necessary to announce a patch [series] for this branch when it
is intended that such a patch [series] make it to the trunk? Shouldn't an
employee of your company submit a `trunk'-worthy patch [series] for review
as would anyone else?
Isn't having one branch named `google' (or `google/maint') too ridiculously
generic to be of any use whatsoever? Wouldn't it make far more sense to have
a topic branch if deemed necessary (for, say, a large patch series)?
Why is gnu.gcc.org hosting such a pointless branch? Is it just that the
technical inadequacies of SVN made it easier for your multi-billion-dollar
company to host its essentially private work in GNU's repository?
Furthermore, looking at the `Subject' header of this email:
Subject: Re: [google] Linker plugin to do function reordering using
callgraph edge profiles (issue5124041)
I wonder what `issue5124041' means. Is that a reference that only has
meaning for employees of your company?
Sincerely,
Michael Witten

I think you may be trolling, but I'll give you the benefit of the
doubt since you seem to be lacking some background.
On Sat, Sep 24, 2011 at 15:19, Michael Witten <mfwitten@gmail.com> wrote:
> Why is gnu.gcc.org hosting work that is specific to some company's> build system?
We've long allowed different companies hold branches on gcc.gnu.org.
From one of the links I posted in my previous response:
http://gcc.gnu.org/svn.html#distrobranches
> Why is it necessary to announce a patch [series] for this branch when it> is intended that such a patch [series] make it to the trunk? Shouldn't an> employee of your company submit a `trunk'-worthy patch [series] for review> as would anyone else?
Yes, and you will see several patches from google.com addresses that
are not labeled [google]. Those are meant for trunk or devel
branches. It is true that if a patch is meant for trunk, it should
not have a branch tag. I expect slipups like that to occur from time
to time. Thanks for pointing it out.
> I wonder what `issue5124041' means. Is that a reference that only has> meaning for employees of your company?
No. This is Rietveld, an open source code review system. I suggested
using it for code reviews a while ago and contributed a script to
facilitate using it with GCC. See http://gcc.gnu.org/wiki/rietveld
Diego.

On Sep 24, 2011, at 12:19 PM, Michael Witten wrote:
> Why is gnu.gcc.org hosting work that is specific to some company's> build system?
This list isn't for this topic. If you want, please, really, go play in gnu.misc.discuss. This list is for technical patches and the technical review of such. If your email isn't of that nature, then it is off-topic for this list. Thanks.
> Why is gnu.gcc.org hosting such a pointless branch? Is it just that the> technical inadequacies of SVN made it easier for your multi-billion-dollar> company to host its essentially private work in GNU's repository?
This isn't GNU's repository, this is GCC's repository.