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: [bitmap] cleanup


On Wed, 2004-11-24 at 10:55 -0500, Andrew MacLeod wrote:
> On Wed, 2004-11-24 at 10:26, Nathan Sidwell wrote:
> > this one's been bothering me, so I decided to fix it.
> > 
> 
> Almost completely unrelated, but is there a reason we don't have a test
> if clear and set bitmap operation? I find I frequently use the idiom:
> 
> if (!bitmap_bit_p (map, b))
>   {
>     bitmap_set_bit (map, b);
>     <...>
>   }
> 
> and it seems like it would be more efficient in these cases to simply
> use something like
> 
> if (bitmap_test_and_set (map, b))
>   {
>     <...>
>   }
> 
> which would avoid at least the second call to bitmap_find_bit() every
> time.
> 
> Just curious if I missed something in the past...
> 
No reason that I'm aware of.

I implemented it once and fixed up a several obvious places where 
a tas operation could be used, but was unable to show any measurable
performance improvement.  That's probably because we cache the last
referenced node in the bitmap and thus the bitmap_set operation doesn't
have to find the right node, it just does the bit twiddle.

One could argue that having a bitmap_tas is cleaner....

jeff




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