comparison gcc/bitmap.h @ 67:f6334be47118

update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
author nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
date Tue, 22 Mar 2011 17:18:12 +0900
parents 77e2b8dfacca
children 04ced10e8804
comparison
equal deleted inserted replaced
65:65488c3d617d 67:f6334be47118
1 /* Functions to support general ended bitmaps. 1 /* Functions to support general ended bitmaps.
2 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 3 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
4 4
5 This file is part of GCC. 5 This file is part of GCC.
6 6
7 GCC is free software; you can redistribute it and/or modify it under 7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free 8 the terms of the GNU General Public License as published by the Free
75 typedef struct GTY(()) bitmap_head_def { 75 typedef struct GTY(()) bitmap_head_def {
76 bitmap_element *first; /* First element in linked list. */ 76 bitmap_element *first; /* First element in linked list. */
77 bitmap_element *current; /* Last element looked at. */ 77 bitmap_element *current; /* Last element looked at. */
78 unsigned int indx; /* Index of last element looked at. */ 78 unsigned int indx; /* Index of last element looked at. */
79 bitmap_obstack *obstack; /* Obstack to allocate elements from. 79 bitmap_obstack *obstack; /* Obstack to allocate elements from.
80 If NULL, then use ggc_alloc. */ 80 If NULL, then use GGC allocation. */
81 #ifdef GATHER_STATISTICS 81 #ifdef GATHER_STATISTICS
82 struct bitmap_descriptor GTY((skip)) *desc; 82 struct bitmap_descriptor GTY((skip)) *desc;
83 #endif 83 #endif
84 } bitmap_head; 84 } bitmap_head;
85 85
383 { 383 {
384 bi->bits >>= 1; 384 bi->bits >>= 1;
385 *bit_no += 1; 385 *bit_no += 1;
386 } 386 }
387 387
388 /* Advance to first set bit in BI. */
389
390 static inline void
391 bmp_iter_next_bit (bitmap_iterator * bi, unsigned *bit_no)
392 {
393 #if (GCC_VERSION >= 3004)
394 {
395 unsigned int n = __builtin_ctzl (bi->bits);
396 gcc_assert (sizeof (unsigned long) == sizeof (BITMAP_WORD));
397 bi->bits >>= n;
398 *bit_no += n;
399 }
400 #else
401 while (!(bi->bits & 1))
402 {
403 bi->bits >>= 1;
404 *bit_no += 1;
405 }
406 #endif
407 }
408
388 /* Advance to the next nonzero bit of a single bitmap, we will have 409 /* Advance to the next nonzero bit of a single bitmap, we will have
389 already advanced past the just iterated bit. Return true if there 410 already advanced past the just iterated bit. Return true if there
390 is a bit to iterate. */ 411 is a bit to iterate. */
391 412
392 static inline bool 413 static inline bool
394 { 415 {
395 /* If our current word is nonzero, it contains the bit we want. */ 416 /* If our current word is nonzero, it contains the bit we want. */
396 if (bi->bits) 417 if (bi->bits)
397 { 418 {
398 next_bit: 419 next_bit:
399 while (!(bi->bits & 1)) 420 bmp_iter_next_bit (bi, bit_no);
400 {
401 bi->bits >>= 1;
402 *bit_no += 1;
403 }
404 return true; 421 return true;
405 } 422 }
406 423
407 /* Round up to the word boundary. We might have just iterated past 424 /* Round up to the word boundary. We might have just iterated past
408 the end of the last word, hence the -1. It is not possible for 425 the end of the last word, hence the -1. It is not possible for
441 { 458 {
442 /* If our current word is nonzero, it contains the bit we want. */ 459 /* If our current word is nonzero, it contains the bit we want. */
443 if (bi->bits) 460 if (bi->bits)
444 { 461 {
445 next_bit: 462 next_bit:
446 while (!(bi->bits & 1)) 463 bmp_iter_next_bit (bi, bit_no);
447 {
448 bi->bits >>= 1;
449 *bit_no += 1;
450 }
451 return true; 464 return true;
452 } 465 }
453 466
454 /* Round up to the word boundary. We might have just iterated past 467 /* Round up to the word boundary. We might have just iterated past
455 the end of the last word, hence the -1. It is not possible for 468 the end of the last word, hence the -1. It is not possible for
508 { 521 {
509 /* If our current word is nonzero, it contains the bit we want. */ 522 /* If our current word is nonzero, it contains the bit we want. */
510 if (bi->bits) 523 if (bi->bits)
511 { 524 {
512 next_bit: 525 next_bit:
513 while (!(bi->bits & 1)) 526 bmp_iter_next_bit (bi, bit_no);
514 {
515 bi->bits >>= 1;
516 *bit_no += 1;
517 }
518 return true; 527 return true;
519 } 528 }
520 529
521 /* Round up to the word boundary. We might have just iterated past 530 /* Round up to the word boundary. We might have just iterated past
522 the end of the last word, hence the -1. It is not possible for 531 the end of the last word, hence the -1. It is not possible for