diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-06 01:37:38 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-06 01:37:38 +0000 |
commit | f65ffe0d139d4b2a2fde1638ef03f87e0207182f (patch) | |
tree | a3f8d22463404090d46e02a6a9634a4d654930fb /gcc/bitmap.h | |
parent | ac6a6c760194578f30436aa4963bd68d2ba83aab (diff) | |
download | gcc-f65ffe0d139d4b2a2fde1638ef03f87e0207182f.tar.gz |
* statistics.h (ALONE_PASS_MEM_STAT, ALONE_MEM_STAT_INFO,
ALONE_MEM_STAT_DECL): New macros.
* bitmap.h: Include statistics.h
(struct bitmap_head_def): Add variant with pointer to bitmap descriptor.
(bitmap_initialize_stat): Rename from bitmap_initialize; add statistics.
(bitmap_obstack_alloc_stat, bitmap_gc_alloc_stat): Declare.
* bitmap.c: Include hashtab.h
(bitmap_descriptor): New.
(bitmap_hash): New static variable
(hash_descriptor, eq_descriptor, bitmap_descriptor, register_overhead):
New static functions.
(bitmap_register): New.
(bitmap_element_free, bitmap_element_allocate, bitmap_elt_clear_from,
bitmap_obstack_release): Do accounting.
(bitmap_obstack_alloc_stat): Rename from bitmap_obstack_alloc ; do
accounting.
(bitmap_gc_alloc_stat): Likewise.
(bitmap_obstack_free, bitmap_find_bit): Do statictics.
(print_statistics, dump_bitmap_statistics): New functions.
* toplev.c (finalize): Dump bitmap statistics.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119573 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/bitmap.h')
-rw-r--r-- | gcc/bitmap.h | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/gcc/bitmap.h b/gcc/bitmap.h index 3da58c5ba2b..515527c08e8 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -22,6 +22,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #ifndef GCC_BITMAP_H #define GCC_BITMAP_H #include "hashtab.h" +#include "statistics.h" /* Fundamental storage type for bitmap. */ @@ -68,7 +69,13 @@ typedef struct bitmap_element_def GTY(()) BITMAP_WORD bits[BITMAP_ELEMENT_WORDS]; /* Bits that are set. */ } bitmap_element; -/* Head of bitmap linked list. */ +struct bitmap_descriptor; +/* Head of bitmap linked list. + The gengtype doesn't cope with ifdefs inside the definition, + but for statistics we need bitmap descriptor pointer in. + Trick it by two copies of the definition. This is safe + because the bitmap descriptor is not grabagecollected. */ +#ifndef GATHER_STATISTICS typedef struct bitmap_head_def GTY(()) { bitmap_element *first; /* First element in linked list. */ bitmap_element *current; /* Last element looked at. */ @@ -76,7 +83,16 @@ typedef struct bitmap_head_def GTY(()) { bitmap_obstack *obstack; /* Obstack to allocate elements from. If NULL, then use ggc_alloc. */ } bitmap_head; - +#else +typedef struct bitmap_head_def { + 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_obstack *obstack; /* Obstack to allocate elements from. + If NULL, then use ggc_alloc. */ + struct bitmap_descriptor *desc; +} bitmap_head; +#endif /* Global data */ extern bitmap_element bitmap_zero_bits; /* Zero bitmap element */ @@ -144,20 +160,28 @@ extern void bitmap_print (FILE *, bitmap, const char *, const char *); /* Initialize and release a bitmap obstack. */ extern void bitmap_obstack_initialize (bitmap_obstack *); extern void bitmap_obstack_release (bitmap_obstack *); +extern void bitmap_register (bitmap MEM_STAT_DECL); +extern void dump_bitmap_statistics (void); /* Initialize a bitmap header. OBSTACK indicates the bitmap obstack to allocate from, NULL for GC'd bitmap. */ static inline void -bitmap_initialize (bitmap head, bitmap_obstack *obstack) +bitmap_initialize_stat (bitmap head, bitmap_obstack *obstack MEM_STAT_DECL) { head->first = head->current = NULL; head->obstack = obstack; +#ifdef GATHER_STATISTICS + bitmap_register (head PASS_MEM_STAT); +#endif } +#define bitmap_initialize(h,o) bitmap_initialize_stat (h,o MEM_STAT_INFO) /* Allocate and free bitmaps from obstack, malloc and gc'd memory. */ -extern bitmap bitmap_obstack_alloc (bitmap_obstack *obstack); -extern bitmap bitmap_gc_alloc (void); +extern bitmap bitmap_obstack_alloc_stat (bitmap_obstack *obstack MEM_STAT_DECL); +#define bitmap_obstack_alloc(t) bitmap_obstack_alloc_stat (t MEM_STAT_INFO) +extern bitmap bitmap_gc_alloc_stat (ALONE_MEM_STAT_DECL); +#define bitmap_gc_alloc() bitmap_gc_alloc_stat (ALONE_MEM_STAT_INFO) extern void bitmap_obstack_free (bitmap); /* A few compatibility/functions macros for compatibility with sbitmaps */ |