This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][RFC] Add dynamic edge/bb flag allocation
On Wed, 23 May 2018, Michael Matz wrote:
> Hi,
>
> On Wed, 23 May 2018, Eric Botcazou wrote:
>
> > > Maybe you should convert the thing to a template when the need arises
> > > instead of before? You have now added 54 lines of code for wrapping an
> > > int!
> >
> > Yeah, it took me 5 minutes to understand what all this fluff is about!
>
> So, what I think this should look like: only one non-templated class for
> RAII purposes, which get's the pool to allocate from as a parameter in the
> ctor.
>
> Use:
>
> alloc_flags (&cfun->cfg->bb_flag_pool);
> alloc_flags (&cfun->cfg->edge_flag_pool);
You'll end up with sth like
alloc_flags flag (BB_FLAG_POOL_FOR_FN (cfun));
then, mixing C++ RAII and macros! (eh) Note you missed to name the
variable you declare. And yes, template deduction should make this
work w/o writing alloc_flags<int> flag (...).
> I don't see the sense in creating two classes for determining the pool
> (and then adding a third class when another pool is invented somewhere
> else) just for going from cfun to cfun->cfg->foopool. Also Richi asked if
> the flag pools (sigh, a large word for an int) should be merged. I think
> at this time they should be, but that the class ctor should still take the
> pool param (instead of the function), even if right now there'd only be
> one.
>
> So much for bike shedding :)
:/
Richard.