Creating a plugin which implements a modified -finstrument-functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I have occasionally found -finstrument-functions very useful in
tracking performance issues.  However, it is a very broad brush to
use, and without lots of judicious exclusions tends to be unwieldy.
In my use case I'd ideally want an inclusion-based approach and having
seen the relevant code (in gimplify.c), it would seem fairly
straightforward to do.

However, I'd prefer to spike out this functionality as a gcc plugin.
I have had a little experience with plugins before (hacking on the
mozilla dehydra plugin), and I'm well aware of both the python plugin
and Basile's MELT.  My use case somewhat counts against introducing
more complexity than needed, and ideally if it works out as a plugin,
I'd like to fold anything useful back into the main GCC tree, so I'd
like to do this in C.

That being said, I'm finding it rather troublesome to find the right
place to hook using the plugin system.  The existing
-finstrument-functions code hooks right at the end of
gimplify_function_tree, and replaces the BIND gimple statement with a
TRY_FINALLY block that does the instrumentation calls.

I've attempted to hook a pass directly after the gimplification, but I
can't seem to find and replace the BIND statement with a wrapped call
in the same way the existing code does.  Either the tree elements I'm
checking have no GIMPLE associated with them, or I'm looking in the
wrong place (most likely!).

Can anyone offer any advice on how I might achieve this? I've read up
a fair amount of the GCC innards documentation, and all of it makes
sense, but I'm having trouble mapping this knowledge to this
particular problem.

Many thanks in advance, Matt

--
Matt




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux