This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Identifying global state within GCC
- From: David Malcolm <dmalcolm at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 02 May 2013 13:00:40 -0400
- Subject: Re: Identifying global state within GCC
- References: <1367440332 dot 21297 dot 10 dot camel at surprise> <51826828 dot 5070104 at redhat dot com> <1367512711 dot 1779 dot 27 dot camel at surprise>
On Thu, 2013-05-02 at 12:38 -0400, David Malcolm wrote:
> On Thu, 2013-05-02 at 07:20 -0600, Jeff Law wrote:
> > On 05/01/2013 02:32 PM, David Malcolm wrote:
> > > I had a go at writing a custom pass to try to locate places where GCC
> > > makes use of global state.
> > >
> > > You can see the pass here (which I implemented using gcc-python-plugin):
> > > https://gcc-python-plugin.readthedocs.org/en/latest/working-with-c.html#finding-global-variables
> > >
> > > A build log from recompiling gcc using this pass can be seen at:
> > > http://fedorapeople.org/~dmalcolm/gcc/2013-05-01/make.log
> > > (about 12MB in size; I killed it when I saw that stage 1 was done).
> > >
> > > I'm sure there are quite a few false positives in there.
> > >
> > > Hope this is helpful. FWIW I had an earlier version of the pass which
> > > merely gave *declaration* sites for global variables, rather than all
> > > *uses* of such variables.
> > I wonder how useful it would be to filter out the source line
> > information, then produce a histogram of which global state is hit the
> > most often across the build. That'd give us an interesting hitlist as
> > we start trying to remove the global state.
>
> A python script to do this (by parsing the logs) can be seen at:
> http://fedorapeople.org/~dmalcolm/gcc/2013-05-02/make-histogram.py
>
> The results of running it can be seen at:
> http://fedorapeople.org/~dmalcolm/gcc/2013-05-02/histogram.txt
> (141k)
[sorry for also sending the large attachment; I rewrote the email and
meant to detach both attachments]