This is the mail archive of the gcc-patches@gcc.gnu.org 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: [RFC PATCH] add auto_bitmap


On 11/14/13 04:04, tsaunders@mozilla.com wrote:
From: Trevor Saunders <tsaunders@mozilla.com>

Hi,

this patch adds and starts to use a class auto_bitmap, which is a very thin
wrapper around bitmap.  Its advantage is that it takes care of delocation
automatically.  So you can do things like

int
f ()
{
   auto_bitmap x;
   // do stuff with x
}

Another advantage of this class is it puts the bitmap_head struct on the stack
instead of mallocing it or using a obstack.

I Think the biggest question is if I should make auto_bitmap a full c++ified
wrapper around   bitmap or if I should contiune just taking the address of it
and passing it as a bitmap, but other comments are of course welcome too.
I'd prefer to see it fully c++ified.

In response to one of Richi's comments, I spot checked the patch and only found two occurrences where this lengthened the lifetime of the bitmap in any significant way. The vast majority of the time any increase in length was trivial.

Those instances are in tree-ssa-loop-ivopts.c and the other in tree-ssa-strlen.c. I don't think you need to change anything for them, I'm just pointed out that of all the stuff you changed, these were the only ones I saw where lifetimes were changed significantly.

jeff


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