diff options
author | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-06-04 07:11:05 +0000 |
---|---|---|
committer | geoffk <geoffk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-06-04 07:11:05 +0000 |
commit | 1f3233d13f58417984cb2239d328b65e8d172744 (patch) | |
tree | 720630adca0f6b357e05c4feb8cbe33d556925ce /gcc/bitmap.h | |
parent | 0dc11899d8781bca1da5f4421327d61890424808 (diff) | |
download | gcc-1f3233d13f58417984cb2239d328b65e8d172744.tar.gz |
Merge from pch-branch up to tag pch-commit-20020603.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54232 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/bitmap.h')
-rw-r--r-- | gcc/bitmap.h | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/gcc/bitmap.h b/gcc/bitmap.h index c2dcb9df30e..ed402990f11 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -40,7 +40,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA having to realloc and copy a giant bit array. The `prev' field is undefined for an element on the free list. */ -typedef struct bitmap_element_def +typedef struct bitmap_element_def GTY(()) { struct bitmap_element_def *next; /* Next element. */ struct bitmap_element_def *prev; /* Previous element. */ @@ -49,12 +49,14 @@ typedef struct bitmap_element_def } bitmap_element; /* Head of bitmap linked list. */ -typedef struct bitmap_head_def { +typedef struct bitmap_head_def GTY(()) { bitmap_element *first; /* First element in linked list. */ bitmap_element *current; /* Last element looked at. */ unsigned int indx; /* Index of last element looked at. */ - -} bitmap_head, *bitmap; + int using_obstack; /* Are we using an obstack or ggc for + allocation? */ +} bitmap_head; +typedef struct bitmap_head_def *bitmap; /* Enumeration giving the various operations we support. */ enum bitmap_bits { @@ -100,10 +102,12 @@ extern void debug_bitmap_file PARAMS ((FILE *, bitmap)); /* Print a bitmap */ extern void bitmap_print PARAMS ((FILE *, bitmap, const char *, const char *)); -/* Initialize a bitmap header. */ -extern bitmap bitmap_initialize PARAMS ((bitmap)); +/* Initialize a bitmap header. If HEAD is NULL, a new header will be + allocated. USING_OBSTACK indicates how elements should be allocated. */ +extern bitmap bitmap_initialize PARAMS ((bitmap head, + int using_obstack)); -/* Release all memory held by bitmaps. */ +/* Release all memory used by the bitmap obstack. */ extern void bitmap_release_memory PARAMS ((void)); /* A few compatibility/functions macros for compatibility with sbitmaps */ @@ -117,22 +121,15 @@ extern int bitmap_last_set_bit PARAMS((bitmap)); /* Allocate a bitmap with oballoc. */ #define BITMAP_OBSTACK_ALLOC(OBSTACK) \ - bitmap_initialize ((bitmap) obstack_alloc (OBSTACK, sizeof (bitmap_head))) - -/* Allocate a bitmap with alloca. Note alloca cannot be passed as an - argument to a function, so we set a temporary variable to the value - returned by alloca and pass that variable to bitmap_initialize(). - PTR is then set to the value returned from bitmap_initialize() to - avoid having it appear more than once in case it has side effects. */ -#define BITMAP_ALLOCA(PTR) \ -do { \ - bitmap temp_bitmap_ = (bitmap) alloca (sizeof (bitmap_head)); \ - (PTR) = bitmap_initialize (temp_bitmap_); \ -} while (0) + bitmap_initialize ((bitmap) obstack_alloc (OBSTACK, sizeof (bitmap_head)), 1) + +/* Allocate a bitmap with ggc_alloc. */ +#define BITMAP_GGC_ALLOC() \ + bitmap_initialize (NULL, 0) /* Allocate a bitmap with xmalloc. */ #define BITMAP_XMALLOC() \ - bitmap_initialize ((bitmap) xmalloc (sizeof (bitmap_head))) + bitmap_initialize ((bitmap) xmalloc (sizeof (bitmap_head)), 1) /* Do any cleanup needed on a bitmap when it is no longer used. */ #define BITMAP_FREE(BITMAP) \ |