On Thu, 2011-12-01 at 10:32 +0100, Stephan Bergmann wrote:
On 11/30/2011 09:25 PM, David Malcolm wrote:
> I had a go at adding a "fullname" attribute to the function decl based
> on what I found. It works for my test case, but unfortunately it breaks
> the plugin for anything other than C++ code due to linker problems.
> See:
>
http://gcc.gnu.org/ml/gcc/2011-11/msg00504.html
dlsym was the first thing that came to my mind here, too. Great to see
it already included in the git repo. Works like a charm!
Yes, as noted on that other thread, I fixed this with dlsym(),
committing a version of this code which exposes a "fullname"
attribute in C++ to gcc.FunctionDecl instances:
http://gcc-python-plugin.readthedocs.org/en/latest/tree.html#gcc.Function...
It sounds like this addresses the first part of your use-case.
As for detecting where the result gets compared against 0, I'm not sure
of the best way to do this. Perhaps you could run your pass after the
code is in SSA form, and then identify exactly which variables hold
result values from a getLength() call, and then look for comparisons
with them against 0. Am not sure how copy-propagation works yet, so
this is just a suggestion.
Hope this is helpful.
Dave