(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
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91009
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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
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)
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)
/* 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 ()
/* 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
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),
#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"
#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
/* 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,
#include "bitmap.h"
/* Obstack to allocate bitmap elements from. */
-static struct obstack bitmap_obstack;
-static int bitmap_obstack_init = FALSE;
\f
#ifndef INLINE
#ifndef __GNUC__
#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 *);
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
{
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);
}
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;
+}
+\f
+/* 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);
+}
+
+\f
/* Return nonzero if all bits in an element are zero. */
static INLINE int
}
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;
- }
-}
-
-\f
-/* 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;
-}
\f
/* Copy a bitmap to another bitmap. */
{
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);
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);
return changed;
}
\f
-/* 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;
-}
-\f
/* Debugging function to print out the contents of a bitmap. */
void
#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
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);
/* 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)
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
#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"
#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"
#include "tree.h"
#include "rtl.h"
#include "hard-reg-set.h"
-#include "basic-block.h"
#include "regs.h"
#include "flags.h"
#include "output.h"
#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;
#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"
#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"
#include "params.h"
#include "tm_p.h"
#include "target.h"
-#include "regs.h"
#include "cfglayout.h"
#include "emit-rtl.h"
#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"
#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;
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);
}
#include "tm.h"
#include "rtl.h"
#include "hard-reg-set.h"
+#include "obstack.h"
#include "basic-block.h"
#include "toplev.h"
#include "cfgloop.h"
#include "tm.h"
#include "rtl.h"
#include "hard-reg-set.h"
+#include "obstack.h"
#include "basic-block.h"
#include "cfgloop.h"
#include "expr.h"
#include "tm.h"
#include "rtl.h"
#include "hard-reg-set.h"
+#include "obstack.h"
#include "basic-block.h"
#include "cfgloop.h"
#include "cfglayout.h"
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
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,
/* ??? 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,
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;
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);
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,
#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"
#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"
#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"
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)
{
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;
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)
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
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;
/* 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;
#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"
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))
{
#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"
#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"
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;
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,
#include "rtl.h"
#include "tm_p.h"
#include "flags.h"
-#include "basic-block.h"
#include "regs.h"
#include "function.h"
#include "insn-config.h"
#include "tm.h"
#include "rtl.h"
#include "hard-reg-set.h"
+#include "obstack.h"
#include "basic-block.h"
#include "cfgloop.h"
#include "cfglayout.h"
#include "tm.h"
#include "rtl.h"
#include "hard-reg-set.h"
+#include "obstack.h"
#include "basic-block.h"
#include "cfgloop.h"
#include "expr.h"
#include "tm.h"
#include "rtl.h"
#include "hard-reg-set.h"
+#include "obstack.h"
#include "basic-block.h"
#include "cfgloop.h"
#include "expr.h"
rtx head, tail, insn;
rtx neutral, aggr;
regset altered;
- regset_head altered_head;
edge e;
if (!*expr)
if (e->src == ENTRY_BLOCK_PTR)
return;
- altered = INITIALIZE_REG_SET (altered_head);
+ altered = OBSTACK_ALLOC_REG_SET (®_obstack);
while (1)
{
#include "tm.h"
#include "rtl.h"
#include "hard-reg-set.h"
+#include "obstack.h"
#include "basic-block.h"
#include "cfgloop.h"
#include "cfglayout.h"
#include "tm.h"
#include "rtl.h"
#include "hard-reg-set.h"
+#include "obstack.h"
#include "basic-block.h"
#include "cfgloop.h"
#include "cfglayout.h"
#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"
/* 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. */
#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. */
void
peephole2_optimize (FILE *dump_file ATTRIBUTE_UNUSED)
{
- regset_head rs_heads[MAX_INSNS_PER_PEEP2 + 2];
rtx insn, prev;
regset live;
int i;
/* 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);
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;
reg_pref_buffer = xmalloc (regno_allocated
* sizeof (struct reg_pref));
}
-
else
{
VARRAY_GROW (reg_n_info, regno_allocated);
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. */
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
#define GCC_REGS_H
#include "varray.h"
+#include "obstack.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#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"
#include "output.h"
#include "tm_p.h"
#include "flags.h"
-#include "basic-block.h"
#include "real.h"
#include "regs.h"
#include "function.h"
#include "rtl.h"
#include "flags.h"
#include "hard-reg-set.h"
+#include "obstack.h"
#include "basic-block.h"
/* Bitmap manipulation routines. */
#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"
#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;
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;
}
#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"
#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"
if (bb->flags & BB_IRREDUCIBLE_LOOP)
{
free (blocks_in_bfs_order);
- BITMAP_FREE (visited);
+ BITMAP_XFREE (visited);
free (blocks);
return NULL;
}
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)
{
/* 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)
{
{
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)
#include "rtl.h"
#include "tm_p.h"
#include "hard-reg-set.h"
+#include "obstack.h"
#include "basic-block.h"
#include "tree.h"
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. */
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));
}
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;
}
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",
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);
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. */
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. */
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));
}
void
unmark_all_for_rewrite (void)
{
- if (!ssa_names_to_rewrite)
- return;
-
bitmap_clear (ssa_names_to_rewrite);
}
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;
}
large. */
VARRAY_PUSH_TREE (ssa_names, NULL_TREE);
free_ssanames = NULL;
+ ssa_names_to_rewrite = BITMAP_XMALLOC ();
}
/* Finalize management of SSA_NAMEs. */
void
fini_ssanames (void)
{
+ BITMAP_XFREE (ssa_names_to_rewrite);
ggc_free (ssa_names);
ssa_names = NULL;
free_ssanames = NULL;
#include "rtl.h"
#include "hard-reg-set.h"
#include "flags.h"
+#include "obstack.h"
#include "basic-block.h"
#include "output.h"
#include "df.h"