diff options
51 files changed, 395 insertions, 271 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f01b7f3..6b8a217 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,116 @@ +2004-11-22 Nathan Sidwell <nathan@codesourcery.com> + + * bitmap.h (struct bitmap_obstack): New obstack type. + (struct bitmap_head_def): Replace using_obstack with obstack + pointer. + (bitmap_default_obstack): New. + (bitmap_initialize): Make inline, does not do allocation. + (bitmap_release_memory): Remove. + (bitmap_obstack_initialize, bitmap_obstack_release): Declare. + (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, + bitmap_obstack_free, bitmap_malloc_free): Declare. + (BITMAP_OBSTACK_ALLOC, BITMAP_GGC_ALLOC, BITMAP_XMALLOC): Adjust. + (BITMAP_FREE): Replace with ... + (BITMAP_OBSTACK_FREE): ... this. + (BITMAP_XFREE): Adjust. + (BITMAP_INIT_ONCE): Remove. + * bitmap.c (bitmap_obstack, bitmap_obstack_init, bitmap_free: Remove. + (bitmap_default_obstack): New. + (bitmap_elem_to_freelist): Adjust. + (bitmap_element_allocate): Adjust. Break initialization into ... + (bitmap_obstack_initialize): ... here. + (bitmap_release_memory): Replace with ... + (bitmap_obstack_release): ... this. + (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, + bitmap_obstack_free, bitmap_malloc_free): New. + (bitmap_ior_and_compl, bitmap_ior_and_compl_into): Use + bitmap_initialize. + (bitmap_initialize): Move to bitmap.h. + * gengtype.c (open_base_files): Add obstack.h to ifiles. + * Makefile.in (BASIC_BLOCK_H, REGS_H): Add obstack.h. + * basic-block.h (INIT_REG_SET): Allocate from reg_obstack. + (INITIALIZE_REG_SET): Remove. + (FREE_REG_SET): Use BITMAP_OBSTACK_FREE. + (INIT_ONCE_REG_SET, MAX_REGNO_REG_SET): Remove. + (flow_obstack): Do not declare. + (reg_obstack): Declare. + * regs.h: Include obstack.h. + * tree-optimize.c (tree_rest_of_compilation): Initialize and + release bitmap obstack here. + * bb-reorder.c: #include regs, not basic-block. + (fix_crossing_conditional_branches): Allocate regsets from + reg_obstack. + * bt-load.c: Do not inlude bitmap.h, sbitmap.h, basic-block.h or + obstack.h. + * caller-save.c: Include regs.h earlier. + * cfg.c: Do not include basic-block.h or obstack.h. + (reg_obstack): Define. + * cfganal.c: Include obstack.h + * cfgcleanyp.c: Do not include basic-block.h. Include regs.h + earlier. + * cfglayout.c: Do not include obstack.h. + (flow_obstack): Remove declaration. + (cfg_layout_duplicate_bb): Use reg_obstack. + * cfgloop.c, cfgloopanal.c, cfgloopmanip.c: Include obstack.h. + * cfgrtl.c (rtl_split_block): Use reg_obstack. + (force_nonfallthru_and_redirect, rtl_split_edge): Likewise. + (safe_insert_insn_on_edge): Use OBSTACK_ALLOC_REG_SET, adjust. + (cfg_layout_split_edge): Use reg_obstack. + * cse.c: Include regs.h earlier. + * ddg.c: Do not include basic-block.h. + * dominance.c: Inlude obstack.h. + * flow.c (update_life_info): Use OBSTACK_ALLOC_REG_SET, adjust. + (calculate_global_regs_live): Likewise. + (allocate_bb_life_data): Use reg_obstack. + (init_propagate_block_info): Use OBSTACK_ALLOC_REGSET. + * global.c: Do not include basic-block.h. + (build_insn_chain): Use OBSTACK_ALLOC_REG_SET, adjust. + * graph.c: Include obstack.h. + * haifa-sched.c: Do not include basic-block.h. + * ifcvt.c: Use OBSTACK_ALLOC_REG_SET, adjust. + * local-alloc.c: Do not include basic-block.h. + * loop-init.c, loop-invariant.c: Include obstack.h. + * loop-iv.c: Likewise. + (simplify_using_initial_values): Use OBSTACK_ALLOC_REG_SET, + adjust. + * loop-unroll.c, loop-unswitch.c: Inlude obstack.h. + * modulo-sched.c: Do not include basic-block.h. + * passes.c (rest_of_handle_final): Do not call + regset_release_memory. + * ra-debug.c: Include regs.h earlier. Do not include + basic-block.h. + * recog.c (peephole2_optimize): Use OBSTACK_ALLOC_REG_SET, adjust. + * regclass.c (init_reg_sets): Do not call INIT_ONCE_REG_SET. + (allocate_reg_info): Do not call MAX_REGNO_REG_SET. + (regset_release_memory): Remove. + * resource.c: Do not include basic-block.h. + * rtlanal.c: Do not include basic-block.h. + * sbitmap.c: Include obstack.h. + * sched-deps.c: Do not include basic-block.h. + (reg_pending_sets_head, reg_pending_clobbers_head, + reg_pending_uses_head): Remove. + (init_deps_global): Use OBSTACK_ALLOC_REG_SET. + * sched-ebb.c: Do not include basic-block.h. + * sched-rgn.c: Likewise. + * tree-if-conv.c (get_loop_body_in_if_conv_order): Use + BITMAP_XFREE. + * tree-outof-ssa.c (perform_edge_inserts): Use BITMAP_XFREE. + * tree-sra.c (decide_instantiations): Adjust bitmap + initialization. + * tree-ssa-dce.c: Include obstack.h. + * tree-ssa-pre.c (grand_bitmap_obstack): Make a bitmap_obstack. + (value_insert_into_set_bitmap): Remove useless bitmap_clear. + (bitmap_set_new): Likewise. + (init_pre): Initialize bitmap obstack. + (fini_pre): Release bitmap obstack. + * tree-ssanames.c (ssa_names_to_rewrite): Make static. + (marked_for_rewrite_p): ssa_names_to_rewrite is never NULL. + (mark_for_rewrite, unmark_for_rewrite): Likewise. + (marked_ssa_names): Likewise. + (init_ssanames): Use BITMAP_XMALLOC. + (fini_ssanames): Use BITMAP_XFREE. + * web.c: Include obstack.h + 2004-11-22 Nick Clifton <nickc@redhat.com> * sbitmap.c (sbitmap_union_of_preds): Set 'e' to the next edge diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 88493d5..879b057 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -691,7 +691,7 @@ PARAMS_H = params.h params.def TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h builtins.def \ input.h statistics.h vec.h BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h varray.h $(PARTITION_H) \ - hard-reg-set.h cfghooks.h + hard-reg-set.h cfghooks.h $(OBSTACK_H) COVERAGE_H = coverage.h gcov-io.h gcov-iov.h DEMANGLE_H = $(srcdir)/../include/demangle.h RECOG_H = recog.h @@ -700,7 +700,7 @@ EMIT_RTL_H = emit-rtl.h FLAGS_H = flags.h options.h EXPR_H = expr.h insn-config.h function.h $(RTL_H) $(FLAGS_H) $(TREE_H) $(MACHMODE_H) $(EMIT_RTL_H) OPTABS_H = optabs.h insn-codes.h -REGS_H = regs.h varray.h $(MACHMODE_H) +REGS_H = regs.h varray.h $(MACHMODE_H) $(OBSTACK_H) RA_H = ra.h bitmap.h sbitmap.h hard-reg-set.h insn-modes.h RESOURCE_H = resource.h hard-reg-set.h SCHED_INT_H = sched-int.h $(INSN_ATTR_H) $(BASIC_BLOCK_H) $(RTL_H) diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 69fc0ab..2b1294f 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -38,7 +38,7 @@ typedef bitmap_head regset_head; typedef bitmap regset; /* Initialize a new regset. */ -#define INIT_REG_SET(HEAD) bitmap_initialize (HEAD, 1) +#define INIT_REG_SET(HEAD) bitmap_initialize (HEAD, ®_obstack) /* Clear a register set by freeing up the linked list. */ #define CLEAR_REG_SET(HEAD) bitmap_clear (HEAD) @@ -104,11 +104,8 @@ typedef bitmap_iterator reg_set_iterator; /* Allocate a register set with oballoc. */ #define OBSTACK_ALLOC_REG_SET(OBSTACK) BITMAP_OBSTACK_ALLOC (OBSTACK) -/* Initialize a register set. Returns the new register set. */ -#define INITIALIZE_REG_SET(HEAD) bitmap_initialize (&HEAD, 1) - /* Do any cleanup needed on a regset when it is no longer used. */ -#define FREE_REG_SET(REGSET) BITMAP_FREE(REGSET) +#define FREE_REG_SET(REGSET) BITMAP_OBSTACK_FREE(REGSET) /* Allocate a register set with xmalloc. */ #define XMALLOC_REG_SET() BITMAP_XMALLOC () @@ -116,14 +113,6 @@ typedef bitmap_iterator reg_set_iterator; /* Free a register set. */ #define XFREE_REG_SET(REGSET) BITMAP_XFREE (REGSET) -/* Do any one-time initializations needed for regsets. */ -#define INIT_ONCE_REG_SET() BITMAP_INIT_ONCE () - -/* Grow any tables needed when the number of registers is calculated - or extended. For the linked list allocation, nothing needs to - be done, other than zero the statistics on the first allocation. */ -#define MAX_REGNO_REG_SET(NUM_REGS, NEW_P, RENUMBER_P) - /* Type we use to hold basic block counters. Should be at least 64bit. Although a counter cannot be negative, we use a signed type, because erroneous negative counts can be generated when the @@ -388,7 +377,7 @@ extern regset regs_live_at_setjmp; extern GTY(()) rtx label_value_list; -extern struct obstack flow_obstack; +extern bitmap_obstack reg_obstack; /* Indexed by n, gives number of basic block that (REG n) is used in. If the value is REG_BLOCK_GLOBAL (-2), diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index 1d0b097..7572e52 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -70,7 +70,7 @@ #include "coretypes.h" #include "tm.h" #include "rtl.h" -#include "basic-block.h" +#include "regs.h" #include "flags.h" #include "timevar.h" #include "output.h" @@ -81,7 +81,6 @@ #include "tm_p.h" #include "obstack.h" #include "expr.h" -#include "regs.h" /* The number of rounds. In most cases there will only be 4 rounds, but when partitioning hot and cold basic blocks into separate sections of @@ -1692,9 +1691,9 @@ fix_crossing_conditional_branches (void) /* Update register liveness information. */ new_bb->global_live_at_start = - OBSTACK_ALLOC_REG_SET (&flow_obstack); + OBSTACK_ALLOC_REG_SET (®_obstack); new_bb->global_live_at_end = - OBSTACK_ALLOC_REG_SET (&flow_obstack); + OBSTACK_ALLOC_REG_SET (®_obstack); COPY_REG_SET (new_bb->global_live_at_end, prev_bb->global_live_at_end); COPY_REG_SET (new_bb->global_live_at_start, diff --git a/gcc/bitmap.c b/gcc/bitmap.c index 6ab194f..68b8429 100644 --- a/gcc/bitmap.c +++ b/gcc/bitmap.c @@ -30,8 +30,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "bitmap.h" /* Obstack to allocate bitmap elements from. */ -static struct obstack bitmap_obstack; -static int bitmap_obstack_init = FALSE; #ifndef INLINE #ifndef __GNUC__ @@ -42,9 +40,10 @@ static int bitmap_obstack_init = FALSE; #endif /* Global data */ -bitmap_element bitmap_zero_bits; /* An element of all zero bits. */ -static bitmap_element *bitmap_free; /* Freelist of bitmap elements. */ -static GTY((deletable)) bitmap_element *bitmap_ggc_free; +bitmap_element bitmap_zero_bits; /* An element of all zero bits. */ +bitmap_obstack bitmap_default_obstack; /* The default bitmap obstack. */ +static GTY((deletable)) bitmap_element *bitmap_ggc_free; /* Freelist of + GC'd elements. */ static void bitmap_elem_to_freelist (bitmap, bitmap_element *); static void bitmap_element_free (bitmap, bitmap_element *); @@ -60,10 +59,12 @@ static bitmap_element *bitmap_find_bit (bitmap, unsigned int); static INLINE void bitmap_elem_to_freelist (bitmap head, bitmap_element *elt) { - if (head->using_obstack) + bitmap_obstack *bit_obstack = head->obstack; + + if (bit_obstack) { - elt->next = bitmap_free; - bitmap_free = elt; + elt->next = bit_obstack->elements; + bit_obstack->elements = elt; } else { @@ -107,43 +108,22 @@ static INLINE bitmap_element * bitmap_element_allocate (bitmap head) { bitmap_element *element; - - if (head->using_obstack) + bitmap_obstack *bit_obstack = head->obstack; + + if (bit_obstack) { - if (bitmap_free != 0) - { - element = bitmap_free; - bitmap_free = element->next; - } + element = bit_obstack->elements; + + if (element) + bit_obstack->elements = element->next; else - { - /* We can't use gcc_obstack_init to initialize the obstack since - print-rtl.c now calls bitmap functions, and bitmap is linked - into the gen* functions. */ - if (!bitmap_obstack_init) - { - bitmap_obstack_init = TRUE; - -#if !defined(__GNUC__) || (__GNUC__ < 2) -#define __alignof__(type) 0 -#endif - - obstack_specify_allocation (&bitmap_obstack, OBSTACK_CHUNK_SIZE, - __alignof__ (bitmap_element), - obstack_chunk_alloc, - obstack_chunk_free); - } - - element = XOBNEW (&bitmap_obstack, bitmap_element); - } + element = XOBNEW (&bit_obstack->obstack, bitmap_element); } else { - if (bitmap_ggc_free != NULL) - { - element = bitmap_ggc_free; - bitmap_ggc_free = element->next; - } + element = bitmap_ggc_free; + if (element) + bitmap_ggc_free = element->next; else element = GGC_NEW (bitmap_element); } @@ -153,19 +133,139 @@ bitmap_element_allocate (bitmap head) return element; } -/* Release any memory allocated by bitmaps. */ +/* Remove ELT and all following elements from bitmap HEAD. */ void -bitmap_release_memory (void) +bitmap_elt_clear_from (bitmap head, bitmap_element *elt) +{ + bitmap_element *next; + + while (elt) + { + next = elt->next; + bitmap_element_free (head, elt); + elt = next; + } +} + +/* Clear a bitmap by freeing the linked list. */ + +INLINE void +bitmap_clear (bitmap head) { - bitmap_free = 0; - if (bitmap_obstack_init) + bitmap_element *element, *next; + + for (element = head->first; element != 0; element = next) { - bitmap_obstack_init = FALSE; - obstack_free (&bitmap_obstack, NULL); + next = element->next; + bitmap_elem_to_freelist (head, element); } + + head->first = head->current = 0; +} + +/* Initialize a bitmap obstack. If BIT_OBSTACK is NULL, initialize + the default bitmap obstack. */ + +void +bitmap_obstack_initialize (bitmap_obstack *bit_obstack) +{ + if (!bit_obstack) + bit_obstack = &bitmap_default_obstack; + +#if !defined(__GNUC__) || (__GNUC__ < 2) +#define __alignof__(type) 0 +#endif + + bit_obstack->elements = NULL; + bit_obstack->heads = NULL; + obstack_specify_allocation (&bit_obstack->obstack, OBSTACK_CHUNK_SIZE, + __alignof__ (bitmap_element), + obstack_chunk_alloc, + obstack_chunk_free); } +/* Release the memory from a bitmap obstack. If BIT_OBSTACK is NULL, + release the default bitmap obstack. */ + +void +bitmap_obstack_release (bitmap_obstack *bit_obstack) +{ + if (!bit_obstack) + bit_obstack = &bitmap_default_obstack; + + bit_obstack->elements = NULL; + bit_obstack->heads = NULL; + obstack_free (&bit_obstack->obstack, NULL); +} + +/* Create a new bitmap on an obstack. If BIT_OBSTACK is NULL, create + it on the default bitmap obstack. */ + +bitmap +bitmap_obstack_alloc (bitmap_obstack *bit_obstack) +{ + bitmap map; + + if (!bit_obstack) + bit_obstack = &bitmap_default_obstack; + map = bit_obstack->heads; + if (map) + bit_obstack->heads = (void *)map->first; + else + map = XOBNEW (&bit_obstack->obstack, bitmap_head); + bitmap_initialize (map, bit_obstack); + + return map; +} + +/* Create a new GCd bitmap. */ + +bitmap +bitmap_gc_alloc (void) +{ + bitmap map; + + map = GGC_NEW (struct bitmap_head_def); + bitmap_initialize (map, NULL); + + return map; +} + +/* Create a new malloced bitmap. Elements will be allocated from the + default bitmap obstack. */ + +bitmap +bitmap_malloc_alloc (void) +{ + bitmap map; + + map = xmalloc (sizeof (bitmap_head)); + bitmap_initialize (map, &bitmap_default_obstack); + + return map; +} + +/* Release an obstack allocated bitmap. */ + +void +bitmap_obstack_free (bitmap map) +{ + bitmap_clear (map); + map->first = (void *)map->obstack->heads; + map->obstack->heads = map; +} + +/* Release a malloc allocated bitmap. */ + +void +bitmap_malloc_free (bitmap map) +{ + bitmap_clear (map); + free (map); +} + + /* Return nonzero if all bits in an element are zero. */ static INLINE int @@ -269,38 +369,6 @@ bitmap_elt_insert_after (bitmap head, bitmap_element *elt) } return node; } - -/* Remove ELT and all following elements from bitmap HEAD. */ - -void -bitmap_elt_clear_from (bitmap head, bitmap_element *elt) -{ - bitmap_element *next; - - while (elt) - { - next = elt->next; - bitmap_element_free (head, elt); - elt = next; - } -} - - -/* Clear a bitmap by freeing the linked list. */ - -INLINE void -bitmap_clear (bitmap head) -{ - bitmap_element *element, *next; - - for (element = head->first; element != 0; element = next) - { - next = element->next; - bitmap_elem_to_freelist (head, element); - } - - head->first = head->current = 0; -} /* Copy a bitmap to another bitmap. */ @@ -1065,9 +1133,8 @@ bitmap_ior_and_compl (bitmap dst, bitmap a, bitmap from1, bitmap from2) { bitmap_head tmp; bool changed; - - tmp.first = tmp.current = 0; - tmp.using_obstack = 0; + + bitmap_initialize (&tmp, &bitmap_default_obstack); bitmap_and_compl (&tmp, from1, from2); changed = bitmap_ior (dst, a, &tmp); bitmap_clear (&tmp); @@ -1083,8 +1150,7 @@ bitmap_ior_and_compl_into (bitmap a, bitmap from1, bitmap from2) bitmap_head tmp; bool changed; - tmp.first = tmp.current = 0; - tmp.using_obstack = 0; + bitmap_initialize (&tmp, &bitmap_default_obstack); bitmap_and_compl (&tmp, from1, from2); changed = bitmap_ior_into (a, &tmp); bitmap_clear (&tmp); @@ -1092,20 +1158,6 @@ bitmap_ior_and_compl_into (bitmap a, bitmap from1, bitmap from2) return changed; } -/* Initialize a bitmap header. */ - -bitmap -bitmap_initialize (bitmap head, int using_obstack) -{ - if (head == NULL && ! using_obstack) - head = GGC_NEW (struct bitmap_head_def); - - head->first = head->current = 0; - head->using_obstack = using_obstack; - - return head; -} - /* Debugging function to print out the contents of a bitmap. */ void diff --git a/gcc/bitmap.h b/gcc/bitmap.h index fb466dc..d6e316a 100644 --- a/gcc/bitmap.h +++ b/gcc/bitmap.h @@ -39,6 +39,14 @@ typedef unsigned long BITMAP_WORD; #define BITMAP_ELEMENT_ALL_BITS (BITMAP_ELEMENT_WORDS * BITMAP_WORD_BITS) +/* Obstack for allocating bitmaps and elements from. */ +typedef struct bitmap_obstack GTY (()) +{ + struct bitmap_element_def *elements; + struct bitmap_head_def *heads; + struct obstack GTY ((skip)) obstack; +} bitmap_obstack; + /* Bitmap set element. We use a linked list to hold only the bits that are set. This allows for use to grow the bitset dynamically without having to realloc and copy a giant bit array. The `prev' field is @@ -57,13 +65,16 @@ 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. */ - int using_obstack; /* Are we using an obstack or ggc for - allocation? */ + bitmap_obstack *obstack; /* Obstack to allocate elements from. + If NULL, then use ggc_alloc. */ } bitmap_head; + + typedef struct bitmap_head_def *bitmap; /* Global data */ extern bitmap_element bitmap_zero_bits; /* Zero bitmap element */ +extern bitmap_obstack bitmap_default_obstack; /* Default bitmap obstack */ /* Clear a bitmap by freeing up the linked list. */ extern void bitmap_clear (bitmap); @@ -118,36 +129,47 @@ extern void debug_bitmap_file (FILE *, bitmap); /* Print a bitmap. */ extern void bitmap_print (FILE *, bitmap, const char *, const char *); -/* 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 (bitmap head, int using_obstack); +/* Initialize and releas a bitmap obstack. */ +extern void bitmap_obstack_initialize (bitmap_obstack *); +extern void bitmap_obstack_release (bitmap_obstack *); + +/* Initialize a bitmap header. OBSTACK indicates the bitmap obstack + to allocate from, NULL for GC'd bitmap. */ -/* Release all memory used by the bitmap obstack. */ -extern void bitmap_release_memory (void); +static inline void +bitmap_initialize (bitmap head, bitmap_obstack *obstack) +{ + head->first = head->current = NULL; + head->obstack = obstack; +} + +/* Allocate and free bitmaps from obstack, malloc and gc'd memory. */ +extern bitmap bitmap_obstack_alloc (bitmap_obstack *obstack); +extern bitmap bitmap_malloc_alloc (void); +extern bitmap bitmap_gc_alloc (void); +extern void bitmap_obstack_free (bitmap); +extern void bitmap_malloc_free (bitmap); /* A few compatibility/functions macros for compatibility with sbitmaps */ #define dump_bitmap(file, bitmap) bitmap_print (file, bitmap, "", "\n") #define bitmap_zero(a) bitmap_clear (a) extern unsigned bitmap_first_set_bit (bitmap); -/* Allocate a bitmap with oballoc. */ -#define BITMAP_OBSTACK_ALLOC(OBSTACK) \ - bitmap_initialize (obstack_alloc (OBSTACK, sizeof (bitmap_head)), 1) +/* Allocate a bitmap from a bit obstack. */ +#define BITMAP_OBSTACK_ALLOC(OBSTACK) bitmap_obstack_alloc (OBSTACK) -/* Allocate a bitmap with ggc_alloc. */ -#define BITMAP_GGC_ALLOC() \ - bitmap_initialize (NULL, 0) +/* Allocate a gc'd bitmap. */ +#define BITMAP_GGC_ALLOC() bitmap_gc_alloc () /* Allocate a bitmap with xmalloc. */ -#define BITMAP_XMALLOC() \ - bitmap_initialize (xmalloc (sizeof (bitmap_head)), 1) +#define BITMAP_XMALLOC() bitmap_malloc_alloc () /* Do any cleanup needed on a bitmap when it is no longer used. */ -#define BITMAP_FREE(BITMAP) \ +#define BITMAP_OBSTACK_FREE(BITMAP) \ do { \ if (BITMAP) \ { \ - bitmap_clear (BITMAP); \ + bitmap_obstack_free (BITMAP); \ (BITMAP) = 0; \ } \ } while (0) @@ -157,15 +179,11 @@ do { \ do { \ if (BITMAP) \ { \ - bitmap_clear (BITMAP); \ - free (BITMAP); \ + bitmap_malloc_free (BITMAP); \ (BITMAP) = 0; \ } \ } while (0) -/* Do any one-time initializations needed for bitmaps. */ -#define BITMAP_INIT_ONCE() - /* Iterator for bitmaps. */ typedef struct diff --git a/gcc/bt-load.c b/gcc/bt-load.c index abfe8cd..3457fac 100644 --- a/gcc/bt-load.c +++ b/gcc/bt-load.c @@ -22,13 +22,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "system.h" #include "coretypes.h" #include "tm.h" -#include "bitmap.h" -#include "sbitmap.h" #include "rtl.h" #include "hard-reg-set.h" -#include "basic-block.h" #include "regs.h" -#include "obstack.h" #include "fibheap.h" #include "output.h" #include "target.h" diff --git a/gcc/caller-save.c b/gcc/caller-save.c index 62873fc..4fcff8e 100644 --- a/gcc/caller-save.c +++ b/gcc/caller-save.c @@ -24,9 +24,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "coretypes.h" #include "tm.h" #include "rtl.h" +#include "regs.h" #include "insn-config.h" #include "flags.h" -#include "regs.h" #include "hard-reg-set.h" #include "recog.h" #include "basic-block.h" @@ -52,7 +52,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tree.h" #include "rtl.h" #include "hard-reg-set.h" -#include "basic-block.h" #include "regs.h" #include "flags.h" #include "output.h" @@ -60,13 +59,13 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "except.h" #include "toplev.h" #include "tm_p.h" -#include "obstack.h" #include "alloc-pool.h" #include "timevar.h" #include "ggc.h" /* The obstack on which the flow graph components are allocated. */ +struct bitmap_obstack reg_obstack; struct obstack flow_obstack; static char *flow_firstobj; diff --git a/gcc/cfganal.c b/gcc/cfganal.c index b98459e..7732efa 100644 --- a/gcc/cfganal.c +++ b/gcc/cfganal.c @@ -25,6 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "coretypes.h" #include "tm.h" #include "rtl.h" +#include "obstack.h" #include "hard-reg-set.h" #include "basic-block.h" #include "insn-config.h" diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 7f7a07b..373be91 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -37,7 +37,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm.h" #include "rtl.h" #include "hard-reg-set.h" -#include "basic-block.h" +#include "regs.h" #include "timevar.h" #include "output.h" #include "insn-config.h" @@ -48,7 +48,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "params.h" #include "tm_p.h" #include "target.h" -#include "regs.h" #include "cfglayout.h" #include "emit-rtl.h" diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c index 4ca4c1b..287a139 100644 --- a/gcc/cfglayout.c +++ b/gcc/cfglayout.c @@ -25,11 +25,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tree.h" #include "rtl.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" #include "insn-config.h" #include "output.h" #include "function.h" -#include "obstack.h" #include "cfglayout.h" #include "cfgloop.h" #include "target.h" @@ -37,10 +37,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "alloc-pool.h" #include "flags.h" -/* The contents of the current function definition are allocated - in this obstack, and all are freed at the end of the function. */ -extern struct obstack flow_obstack; - /* Holds the interesting trailing notes for the function. */ rtx cfg_layout_function_footer, cfg_layout_function_header; @@ -1120,8 +1116,8 @@ cfg_layout_duplicate_bb (basic_block bb) if (bb->global_live_at_start) { - new_bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack); - new_bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack); + new_bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (®_obstack); + new_bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (®_obstack); COPY_REG_SET (new_bb->global_live_at_start, bb->global_live_at_start); COPY_REG_SET (new_bb->global_live_at_end, bb->global_live_at_end); } diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c index c85d053..d985a2c 100644 --- a/gcc/cfgloop.c +++ b/gcc/cfgloop.c @@ -24,6 +24,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm.h" #include "rtl.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" #include "toplev.h" #include "cfgloop.h" diff --git a/gcc/cfgloopanal.c b/gcc/cfgloopanal.c index 87c85e3..6c625d6 100644 --- a/gcc/cfgloopanal.c +++ b/gcc/cfgloopanal.c @@ -24,6 +24,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm.h" #include "rtl.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" #include "cfgloop.h" #include "expr.h" diff --git a/gcc/cfgloopmanip.c b/gcc/cfgloopmanip.c index ab78203..a370e38 100644 --- a/gcc/cfgloopmanip.c +++ b/gcc/cfgloopmanip.c @@ -24,6 +24,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm.h" #include "rtl.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" #include "cfgloop.h" #include "cfglayout.h" diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 47f5330..8ac7087 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -489,8 +489,8 @@ rtl_split_block (basic_block bb, void *insnp) if (bb->global_live_at_start) { - new_bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack); - new_bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack); + new_bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (®_obstack); + new_bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (®_obstack); COPY_REG_SET (new_bb->global_live_at_end, bb->global_live_at_end); /* We now have to calculate which registers are live at the end @@ -1095,9 +1095,9 @@ force_nonfallthru_and_redirect (edge e, basic_block target) if (target->global_live_at_start) { jump_block->global_live_at_start - = OBSTACK_ALLOC_REG_SET (&flow_obstack); + = OBSTACK_ALLOC_REG_SET (®_obstack); jump_block->global_live_at_end - = OBSTACK_ALLOC_REG_SET (&flow_obstack); + = OBSTACK_ALLOC_REG_SET (®_obstack); COPY_REG_SET (jump_block->global_live_at_start, target->global_live_at_start); COPY_REG_SET (jump_block->global_live_at_end, @@ -1383,8 +1383,8 @@ rtl_split_edge (edge edge_in) /* ??? This info is likely going to be out of date very soon. */ if (edge_in->dest->global_live_at_start) { - bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack); - bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack); + bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (®_obstack); + bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (®_obstack); COPY_REG_SET (bb->global_live_at_start, edge_in->dest->global_live_at_start); COPY_REG_SET (bb->global_live_at_end, @@ -1459,8 +1459,7 @@ bool safe_insert_insn_on_edge (rtx insn, edge e) { rtx x; - regset_head killed_head; - regset killed = INITIALIZE_REG_SET (killed_head); + regset killed; rtx save_regs = NULL_RTX; unsigned regno; int noccmode; @@ -1473,6 +1472,8 @@ safe_insert_insn_on_edge (rtx insn, edge e) noccmode = false; #endif + killed = OBSTACK_ALLOC_REG_SET (®_obstack); + for (x = insn; x; x = NEXT_INSN (x)) if (INSN_P (x)) note_stores (PATTERN (x), mark_killed_regs, killed); @@ -2854,8 +2855,8 @@ cfg_layout_split_edge (edge e) create it to avoid getting an ICE later. */ if (e->dest->global_live_at_start) { - new_bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack); - new_bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack); + new_bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (®_obstack); + new_bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (®_obstack); COPY_REG_SET (new_bb->global_live_at_start, e->dest->global_live_at_start); COPY_REG_SET (new_bb->global_live_at_end, @@ -24,11 +24,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "system.h" #include "coretypes.h" #include "tm.h" - #include "rtl.h" #include "tm_p.h" -#include "regs.h" #include "hard-reg-set.h" +#include "regs.h" #include "basic-block.h" #include "flags.h" #include "real.h" @@ -29,7 +29,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "rtl.h" #include "tm_p.h" #include "hard-reg-set.h" -#include "basic-block.h" #include "regs.h" #include "function.h" #include "flags.h" diff --git a/gcc/dominance.c b/gcc/dominance.c index 47cb405..7970e24 100644 --- a/gcc/dominance.c +++ b/gcc/dominance.c @@ -39,6 +39,7 @@ #include "tm.h" #include "rtl.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" #include "errors.h" #include "et-forest.h" @@ -567,15 +567,15 @@ verify_local_live_at_start (regset new_live_at_start, basic_block bb) unless the caller resets it to zero. */ int -update_life_info (sbitmap blocks, enum update_life_extent extent, int prop_flags) +update_life_info (sbitmap blocks, enum update_life_extent extent, + int prop_flags) { regset tmp; - regset_head tmp_head; unsigned i; int stabilized_prop_flags = prop_flags; basic_block bb; - tmp = INITIALIZE_REG_SET (tmp_head); + tmp = OBSTACK_ALLOC_REG_SET (®_obstack); ndead = 0; if ((prop_flags & PROP_REG_INFO) && !reg_deaths) @@ -1016,8 +1016,6 @@ calculate_global_regs_live (sbitmap blocks_in, sbitmap blocks_out, int flags) { basic_block *queue, *qhead, *qtail, *qend, bb; regset tmp, new_live_at_end, invalidated_by_call; - regset_head tmp_head, invalidated_by_call_head; - regset_head new_live_at_end_head; /* The registers that are modified within this in block. */ regset *local_sets; @@ -1035,9 +1033,9 @@ calculate_global_regs_live (sbitmap blocks_in, sbitmap blocks_out, int flags) gcc_assert (!bb->aux); #endif - tmp = INITIALIZE_REG_SET (tmp_head); - new_live_at_end = INITIALIZE_REG_SET (new_live_at_end_head); - invalidated_by_call = INITIALIZE_REG_SET (invalidated_by_call_head); + tmp = OBSTACK_ALLOC_REG_SET (®_obstack); + new_live_at_end = OBSTACK_ALLOC_REG_SET (®_obstack); + invalidated_by_call = OBSTACK_ALLOC_REG_SET (®_obstack); /* Inconveniently, this is only readily available in hard reg set form. */ for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i) @@ -1438,11 +1436,11 @@ allocate_bb_life_data (void) FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb) { - bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (&flow_obstack); - bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (&flow_obstack); + bb->global_live_at_start = OBSTACK_ALLOC_REG_SET (®_obstack); + bb->global_live_at_end = OBSTACK_ALLOC_REG_SET (®_obstack); } - regs_live_at_setjmp = OBSTACK_ALLOC_REG_SET (&flow_obstack); + regs_live_at_setjmp = OBSTACK_ALLOC_REG_SET (®_obstack); } void @@ -1845,8 +1843,7 @@ init_propagate_block_info (basic_block bb, regset live, regset local_set, if (JUMP_P (BB_END (bb)) && any_condjump_p (BB_END (bb))) { - regset_head diff_head; - regset diff = INITIALIZE_REG_SET (diff_head); + regset diff = OBSTACK_ALLOC_REG_SET (®_obstack); basic_block bb_true, bb_false; unsigned i; diff --git a/gcc/gengtype.c b/gcc/gengtype.c index dd9ab09..6ed8931 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -1081,13 +1081,11 @@ open_base_files (void) /* The order of files here matters very much. */ static const char *const ifiles [] = { "config.h", "system.h", "coretypes.h", "tm.h", "varray.h", - "hashtab.h", "splay-tree.h", "bitmap.h", "input.h", "tree.h", "rtl.h", - "function.h", "insn-config.h", "expr.h", "hard-reg-set.h", - "basic-block.h", "cselib.h", "insn-addr.h", "optabs.h", - "libfuncs.h", "debug.h", "ggc.h", "cgraph.h", - "tree-flow.h", "reload.h", - "cpp-id-data.h", - "tree-chrec.h", + "hashtab.h", "splay-tree.h", "obstack.h", "bitmap.h", "input.h", + "tree.h", "rtl.h", "function.h", "insn-config.h", "expr.h", + "hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h", + "optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h", + "tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h", NULL }; const char *const *ifp; diff --git a/gcc/global.c b/gcc/global.c index 80caac9..e1b6f60 100644 --- a/gcc/global.c +++ b/gcc/global.c @@ -24,13 +24,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "system.h" #include "coretypes.h" #include "tm.h" - #include "machmode.h" #include "hard-reg-set.h" #include "rtl.h" #include "tm_p.h" #include "flags.h" -#include "basic-block.h" #include "regs.h" #include "function.h" #include "insn-config.h" @@ -1806,9 +1804,8 @@ build_insn_chain (rtx first) struct insn_chain **p = &reload_insn_chain; struct insn_chain *prev = 0; basic_block b = ENTRY_BLOCK_PTR->next_bb; - regset_head live_relevant_regs_head; - live_relevant_regs = INITIALIZE_REG_SET (live_relevant_regs_head); + live_relevant_regs = OBSTACK_ALLOC_REG_SET (®_obstack); for (; first; first = NEXT_INSN (first)) { diff --git a/gcc/graph.c b/gcc/graph.c index e60e2f6..c0e9043 100644 --- a/gcc/graph.c +++ b/gcc/graph.c @@ -24,12 +24,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "system.h" #include "coretypes.h" #include "tm.h" - #include "rtl.h" #include "flags.h" #include "output.h" #include "function.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" #include "toplev.h" #include "graph.h" diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index ad782cc..d413137 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -132,7 +132,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "rtl.h" #include "tm_p.h" #include "hard-reg-set.h" -#include "basic-block.h" #include "regs.h" #include "function.h" #include "flags.h" diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index b2275d0..6cc6e6c 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -3124,7 +3124,6 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, that any registers modified are dead at the branch site. */ rtx insn, cond, prev; - regset_head merge_set_head, tmp_head, test_live_head, test_set_head; regset merge_set, tmp, test_live, test_set; struct propagate_block_info *pbi; unsigned i, fail = 0; @@ -3166,10 +3165,10 @@ dead_or_predicable (basic_block test_bb, basic_block merge_bb, TEST_SET = set of registers set between EARLIEST and the end of the block. */ - tmp = INITIALIZE_REG_SET (tmp_head); - merge_set = INITIALIZE_REG_SET (merge_set_head); - test_live = INITIALIZE_REG_SET (test_live_head); - test_set = INITIALIZE_REG_SET (test_set_head); + tmp = OBSTACK_ALLOC_REG_SET (®_obstack); + merge_set = OBSTACK_ALLOC_REG_SET (®_obstack); + test_live = OBSTACK_ALLOC_REG_SET (®_obstack); + test_set = OBSTACK_ALLOC_REG_SET (®_obstack); /* ??? bb->local_set is only valid during calculate_global_regs_live, so we must recompute usage for MERGE_BB. Not so bad, I suppose, diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c index 42b9838..a940ba4 100644 --- a/gcc/local-alloc.c +++ b/gcc/local-alloc.c @@ -67,7 +67,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "rtl.h" #include "tm_p.h" #include "flags.h" -#include "basic-block.h" #include "regs.h" #include "function.h" #include "insn-config.h" diff --git a/gcc/loop-init.c b/gcc/loop-init.c index 8db45ec..5aa0db1 100644 --- a/gcc/loop-init.c +++ b/gcc/loop-init.c @@ -24,6 +24,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm.h" #include "rtl.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" #include "cfgloop.h" #include "cfglayout.h" diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c index 21dc8b8..03f8c67 100644 --- a/gcc/loop-invariant.c +++ b/gcc/loop-invariant.c @@ -41,6 +41,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm.h" #include "rtl.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" #include "cfgloop.h" #include "expr.h" diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c index ed0defb..9eb0f2e 100644 --- a/gcc/loop-iv.c +++ b/gcc/loop-iv.c @@ -53,6 +53,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm.h" #include "rtl.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" #include "cfgloop.h" #include "expr.h" @@ -1716,7 +1717,6 @@ simplify_using_initial_values (struct loop *loop, enum rtx_code op, rtx *expr) rtx head, tail, insn; rtx neutral, aggr; regset altered; - regset_head altered_head; edge e; if (!*expr) @@ -1778,7 +1778,7 @@ simplify_using_initial_values (struct loop *loop, enum rtx_code op, rtx *expr) if (e->src == ENTRY_BLOCK_PTR) return; - altered = INITIALIZE_REG_SET (altered_head); + altered = OBSTACK_ALLOC_REG_SET (®_obstack); while (1) { diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 6b61814..4c7f6e2 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -24,6 +24,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm.h" #include "rtl.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" #include "cfgloop.h" #include "cfglayout.h" diff --git a/gcc/loop-unswitch.c b/gcc/loop-unswitch.c index d1d49b2..f307dc1 100644 --- a/gcc/loop-unswitch.c +++ b/gcc/loop-unswitch.c @@ -24,6 +24,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm.h" #include "rtl.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" #include "cfgloop.h" #include "cfglayout.h" diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index b05fa19..14f006a 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -29,7 +29,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "rtl.h" #include "tm_p.h" #include "hard-reg-set.h" -#include "basic-block.h" #include "regs.h" #include "function.h" #include "flags.h" diff --git a/gcc/passes.c b/gcc/passes.c index e634372..cb81eb7 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -313,9 +313,6 @@ rest_of_handle_final (void) /* Release all memory allocated by flow. */ free_basic_block_vars (); - - /* Release all memory held by regsets now. */ - regset_release_memory (); } /* Write DBX symbols if requested. */ diff --git a/gcc/ra-debug.c b/gcc/ra-debug.c index d060e04..8431534 100644 --- a/gcc/ra-debug.c +++ b/gcc/ra-debug.c @@ -27,12 +27,11 @@ #include "recog.h" #include "function.h" #include "hard-reg-set.h" -#include "basic-block.h" +#include "regs.h" #include "df.h" #include "output.h" #include "ra.h" #include "tm_p.h" -#include "regs.h" /* This file contains various dumping and debug functions for the graph coloring register allocator. */ diff --git a/gcc/recog.c b/gcc/recog.c index eeb37af..d39bb84 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -2975,7 +2975,6 @@ peep2_find_free_register (int from, int to, const char *class_str, void peephole2_optimize (FILE *dump_file ATTRIBUTE_UNUSED) { - regset_head rs_heads[MAX_INSNS_PER_PEEP2 + 2]; rtx insn, prev; regset live; int i; @@ -2989,8 +2988,8 @@ peephole2_optimize (FILE *dump_file ATTRIBUTE_UNUSED) /* Initialize the regsets we're going to use. */ for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i) - peep2_insn_data[i].live_before = INITIALIZE_REG_SET (rs_heads[i]); - live = INITIALIZE_REG_SET (rs_heads[i]); + peep2_insn_data[i].live_before = OBSTACK_ALLOC_REG_SET (®_obstack); + live = OBSTACK_ALLOC_REG_SET (®_obstack); #ifdef HAVE_conditional_execution blocks = sbitmap_alloc (last_basic_block); diff --git a/gcc/regclass.c b/gcc/regclass.c index c3abadd..3fd8281 100644 --- a/gcc/regclass.c +++ b/gcc/regclass.c @@ -293,9 +293,6 @@ init_reg_sets (void) memcpy (call_used_regs, initial_call_used_regs, sizeof call_used_regs); memset (global_regs, 0, sizeof global_regs); - /* Do any additional initialization regsets may need. */ - INIT_ONCE_REG_SET (); - #ifdef REG_ALLOC_ORDER for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) inv_reg_alloc_order[reg_alloc_order[i]] = i; @@ -2181,7 +2178,6 @@ allocate_reg_info (size_t num_regs, int new_p, int renumber_p) reg_pref_buffer = xmalloc (regno_allocated * sizeof (struct reg_pref)); } - else { VARRAY_GROW (reg_n_info, regno_allocated); @@ -2257,9 +2253,6 @@ allocate_reg_info (size_t num_regs, int new_p, int renumber_p) if (renumber_p) reg_renumber = renumber; - - /* Tell the regset code about the new number of registers. */ - MAX_REGNO_REG_SET (num_regs, new_p, renumber_p); } /* Free up the space allocated by allocate_reg_info. */ @@ -2583,14 +2576,6 @@ reg_classes_intersect_p (enum reg_class c1, enum reg_class c2) return 0; } -/* Release any memory allocated by register sets. */ - -void -regset_release_memory (void) -{ - bitmap_release_memory (); -} - #ifdef CANNOT_CHANGE_MODE_CLASS struct subregs_of_mode_node @@ -23,6 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #define GCC_REGS_H #include "varray.h" +#include "obstack.h" #include "hard-reg-set.h" #include "basic-block.h" diff --git a/gcc/resource.c b/gcc/resource.c index 08e940c..9881293 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -27,7 +27,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "rtl.h" #include "tm_p.h" #include "hard-reg-set.h" -#include "basic-block.h" #include "function.h" #include "regs.h" #include "flags.h" diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index de54788..3ffd063 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -33,7 +33,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "output.h" #include "tm_p.h" #include "flags.h" -#include "basic-block.h" #include "real.h" #include "regs.h" #include "function.h" diff --git a/gcc/sbitmap.c b/gcc/sbitmap.c index e53c60a..fe7a995 100644 --- a/gcc/sbitmap.c +++ b/gcc/sbitmap.c @@ -25,6 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "rtl.h" #include "flags.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" /* Bitmap manipulation routines. */ diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index 0d916c6..5e23a93 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -30,7 +30,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "rtl.h" #include "tm_p.h" #include "hard-reg-set.h" -#include "basic-block.h" #include "regs.h" #include "function.h" #include "flags.h" @@ -45,10 +44,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "df.h" -static regset_head reg_pending_sets_head; -static regset_head reg_pending_clobbers_head; -static regset_head reg_pending_uses_head; - static regset reg_pending_sets; static regset reg_pending_clobbers; static regset reg_pending_uses; @@ -1596,9 +1591,9 @@ free_dependency_caches (void) void init_deps_global (void) { - reg_pending_sets = INITIALIZE_REG_SET (reg_pending_sets_head); - reg_pending_clobbers = INITIALIZE_REG_SET (reg_pending_clobbers_head); - reg_pending_uses = INITIALIZE_REG_SET (reg_pending_uses_head); + reg_pending_sets = OBSTACK_ALLOC_REG_SET (®_obstack); + reg_pending_clobbers = OBSTACK_ALLOC_REG_SET (®_obstack); + reg_pending_uses = OBSTACK_ALLOC_REG_SET (®_obstack); reg_pending_barrier = NOT_A_BARRIER; } diff --git a/gcc/sched-ebb.c b/gcc/sched-ebb.c index 4f97b7c..4643478 100644 --- a/gcc/sched-ebb.c +++ b/gcc/sched-ebb.c @@ -29,7 +29,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "rtl.h" #include "tm_p.h" #include "hard-reg-set.h" -#include "basic-block.h" #include "regs.h" #include "function.h" #include "flags.h" diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c index dcff0b5..c478b77 100644 --- a/gcc/sched-rgn.c +++ b/gcc/sched-rgn.c @@ -53,7 +53,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "rtl.h" #include "tm_p.h" #include "hard-reg-set.h" -#include "basic-block.h" #include "regs.h" #include "function.h" #include "flags.h" diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 489613c..3c2a1d0 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -1014,7 +1014,7 @@ get_loop_body_in_if_conv_order (const struct loop *loop) if (bb->flags & BB_IRREDUCIBLE_LOOP) { free (blocks_in_bfs_order); - BITMAP_FREE (visited); + BITMAP_XFREE (visited); free (blocks); return NULL; } diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index 53356b9..87c73ad 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -636,12 +636,21 @@ tree_rest_of_compilation (tree fndecl) while (node->callees) cgraph_remove_edge (node->callees); - if (!vars_to_rename) - vars_to_rename = BITMAP_XMALLOC (); + /* Initialize the default bitmap obstack. */ + bitmap_obstack_initialize (NULL); + bitmap_obstack_initialize (®_obstack); /* FIXME, only at RTL generation*/ + + vars_to_rename = BITMAP_XMALLOC (); + /* Perform all tree transforms and optimizations. */ execute_pass_list (all_passes); + + bitmap_obstack_release (®_obstack); + /* Release the default bitmap obstack. */ + bitmap_obstack_release (NULL); + /* Restore original body if still needed. */ if (cfun->saved_tree) { diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index d051868..86ba542 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -2233,11 +2233,7 @@ perform_edge_inserts (FILE *dump_file) /* Clear out any tables which were created. */ edge_leader = NULL; - if (leader_has_match != NULL) - { - free (leader_has_match); - leader_has_match = NULL; - } + BITMAP_XFREE (leader_has_match); if (changed) { diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 0137373..26ecf2e 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1361,12 +1361,12 @@ decide_instantiations (void) { unsigned int i; bool cleared_any; - struct bitmap_head_def done_head; + bitmap_head done_head; bitmap_iterator bi; /* We cannot clear bits from a bitmap we're iterating over, so save up all the bits to clear until the end. */ - bitmap_initialize (&done_head, 1); + bitmap_initialize (&done_head, &bitmap_default_obstack); cleared_any = false; EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi) diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index 589fc5b..502117c 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -54,6 +54,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "rtl.h" #include "tm_p.h" #include "hard-reg-set.h" +#include "obstack.h" #include "basic-block.h" #include "tree.h" diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 113ec83..38d5d2b 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -306,7 +306,7 @@ static alloc_pool value_set_node_pool; static alloc_pool binary_node_pool; static alloc_pool unary_node_pool; static alloc_pool reference_node_pool; -static struct obstack grand_bitmap_obstack; +static bitmap_obstack grand_bitmap_obstack; /* Set of blocks with statements that have had its EH information cleaned up. */ @@ -462,10 +462,7 @@ value_insert_into_set_bitmap (value_set_t set, tree v) gcc_assert (set->indexed); if (set->values == NULL) - { - set->values = BITMAP_OBSTACK_ALLOC (&grand_bitmap_obstack); - bitmap_clear (set->values); - } + set->values = BITMAP_OBSTACK_ALLOC (&grand_bitmap_obstack); bitmap_set_bit (set->values, VALUE_HANDLE_ID (v)); } @@ -479,8 +476,6 @@ bitmap_set_new (void) bitmap_set_t ret = pool_alloc (bitmap_set_pool); ret->expressions = BITMAP_OBSTACK_ALLOC (&grand_bitmap_obstack); ret->values = BITMAP_OBSTACK_ALLOC (&grand_bitmap_obstack); - bitmap_clear (ret->expressions); - bitmap_clear (ret->values); return ret; } @@ -1927,7 +1922,7 @@ init_pre (void) FOR_ALL_BB (bb) bb->aux = xcalloc (1, sizeof (struct bb_value_sets)); - gcc_obstack_init (&grand_bitmap_obstack); + bitmap_obstack_initialize (&grand_bitmap_obstack); phi_translate_table = htab_create (511, expr_pred_trans_hash, expr_pred_trans_eq, free); value_set_pool = create_alloc_pool ("Value sets", @@ -1966,7 +1961,7 @@ fini_pre (void) bsi_commit_edge_inserts (); - obstack_free (&grand_bitmap_obstack, NULL); + bitmap_obstack_release (&grand_bitmap_obstack); free_alloc_pool (value_set_pool); free_alloc_pool (bitmap_set_pool); free_alloc_pool (value_set_node_pool); diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c index c9215f3..db6717c 100644 --- a/gcc/tree-ssanames.c +++ b/gcc/tree-ssanames.c @@ -62,7 +62,7 @@ Boston, MA 02111-1307, USA. */ varray_type ssa_names; /* Bitmap of ssa names marked for rewriting. */ -bitmap ssa_names_to_rewrite; +static bitmap ssa_names_to_rewrite; /* Free list of SSA_NAMEs. This list is wiped at the end of each function after we leave SSA form. */ @@ -82,11 +82,7 @@ unsigned int ssa_name_nodes_created; bool marked_for_rewrite_p (tree var) { - if (ssa_names_to_rewrite - && bitmap_bit_p (ssa_names_to_rewrite, SSA_NAME_VERSION (var))) - return true; - - return false; + return bitmap_bit_p (ssa_names_to_rewrite, SSA_NAME_VERSION (var)); } /* Returns true if any ssa name is marked for rewrite. */ @@ -105,9 +101,6 @@ any_marked_for_rewrite_p (void) void mark_for_rewrite (tree var) { - if (!ssa_names_to_rewrite) - ssa_names_to_rewrite = BITMAP_XMALLOC (); - bitmap_set_bit (ssa_names_to_rewrite, SSA_NAME_VERSION (var)); } @@ -116,9 +109,6 @@ mark_for_rewrite (tree var) void unmark_all_for_rewrite (void) { - if (!ssa_names_to_rewrite) - return; - bitmap_clear (ssa_names_to_rewrite); } @@ -129,8 +119,8 @@ bitmap marked_ssa_names (void) { bitmap ret = BITMAP_XMALLOC (); - if (ssa_names_to_rewrite) - bitmap_copy (ret, ssa_names_to_rewrite); + + bitmap_copy (ret, ssa_names_to_rewrite); return ret; } @@ -148,6 +138,7 @@ init_ssanames (void) large. */ VARRAY_PUSH_TREE (ssa_names, NULL_TREE); free_ssanames = NULL; + ssa_names_to_rewrite = BITMAP_XMALLOC (); } /* Finalize management of SSA_NAMEs. */ @@ -155,6 +146,7 @@ init_ssanames (void) void fini_ssanames (void) { + BITMAP_XFREE (ssa_names_to_rewrite); ggc_free (ssa_names); ssa_names = NULL; free_ssanames = NULL; @@ -51,6 +51,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "rtl.h" #include "hard-reg-set.h" #include "flags.h" +#include "obstack.h" #include "basic-block.h" #include "output.h" #include "df.h" |