This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Source Code for Profile Guided Code Positioning

On 20/01/16 10:08, Sriraman Tallam wrote:
On Fri, Jan 15, 2016 at 9:51 AM, Yury Gribov <> wrote:
On 01/15/2016 08:44 PM, vivek pandya wrote:
Thanks Yury for this link.
It implements procedure reordering as linker plugin.
I have some questions :
1 ) Can you point me to some documentation for "how to write plugin
for linkers " I am I have not seen doc for structs with 'ld_' prefix
(i.e defined in plugin-api.h )
   2 ) There is one more algorithm for Basic Block ordering with
execution frequency count in PH paper . Is there any implementation
available for it ?

Quite frankly - I don't know (I've only learned about Google implementation

I've added Sriram to maybe comment.
Sorry for the late response.  The google/gcc_4_9 branch has the source
of function reordering linker Plugin.  It is available in the
function_reordering_plugin directory under the top level gcc

The function reordering plugin constructs a callgraph and uses profile
information to do a Pettis Hansen style function reordering.   This
plugin does not do basic block re-ordering.

There is no documentation as such that I am aware of to write a linker
plugin.  Here is a very brief overview.   The linker calls the
plugin's "onload" function when registering the plugin and the plugin
inturn can register two call-backs with the linker, "claim_file_hook"
and the "all_symbols_read_hook".  "claim_file_hook" is called  for
each object file that the linker prcesses and the
"all_symbols_read_hook" is called after all the symbols have been read
by the linker.  These are just two different interesting points in the
course of a link.

The plugin can also get handles to linker functions like
"get_input_section_name" which it can use to process sections given
their handle. You can also check the gold linker tests for simpler
plugin examples.


Very interesting, thank you! Actually, I see -freorder-functions switch in GCC that allows perform pretty the same optimizations in linker, right? Just wondering if you achieved to get performance improvements against -freorder-functions with your plugin.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]