diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-20 20:36:18 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-01-20 20:36:18 +0000 |
commit | 69d7e1984cf4f8a26a9b0ca1e9fe1185cf59a43d (patch) | |
tree | 93365aa2d35a0194c9f8f14c0287163ab1463d7c /gcc | |
parent | b5f4a1603aa0a9df6740da7069ffb91e8dcf5f46 (diff) | |
download | gcc-69d7e1984cf4f8a26a9b0ca1e9fe1185cf59a43d.tar.gz |
* cselib.c: Include alloc-pool.h
(empty_vals, empty_elt_lists, empty_elt_loc_lists): Kill.
(elt_loc_list_pool, elt_list_pool, cselib_val_pool): Declare.
(new_elt_list, new_elt_loc_list, unchain_one_elt_list,
unchain_one_elt_loc_list_pool, unchain_one_value,
new_cselib_val): Simplify using allocpool.
(cselib_init): Initialize allocpools.
(cselib_finish): Finish allocpools.
* Makefile.in (cselib.o): Depend on alloc-pool.h
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@76226 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/Makefile.in | 3 | ||||
-rw-r--r-- | gcc/cselib.c | 58 |
3 files changed, 39 insertions, 34 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e0a1d511f7e..6a21f2ed007 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2004-01-20 Jan Hubicka <jh@suse.cz> + + * cselib.c: Include alloc-pool.h + (empty_vals, empty_elt_lists, empty_elt_loc_lists): Kill. + (elt_loc_list_pool, elt_list_pool, cselib_val_pool): Declare. + (new_elt_list, new_elt_loc_list, unchain_one_elt_list, + unchain_one_elt_loc_list_pool, unchain_one_value, + new_cselib_val): Simplify using allocpool. + (cselib_init): Initialize allocpools. + (cselib_finish): Finish allocpools. + * Makefile.in (cselib.o): Depend on alloc-pool.h + 2004-01-20 Richard Sandiford <rsandifo@redhat.com> * config/mips/mips.c (mips_load_call_address): Make the call insn diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 7ace8ce9c45..e162cb980e7 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1635,7 +1635,8 @@ coverage.o : coverage.c gcov-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ gt-coverage.h $(HASHTAB_H) cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \ - output.h function.h cselib.h $(GGC_H) $(TM_P_H) gt-cselib.h $(PARAMS_H) + output.h function.h cselib.h $(GGC_H) $(TM_P_H) gt-cselib.h $(PARAMS_H) \ + alloc-pool.h cse.o : cse.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_H) \ hard-reg-set.h flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h \ output.h function.h $(BASIC_BLOCK_H) $(GGC_H) $(TM_P_H) $(TIMEVAR_H) \ diff --git a/gcc/cselib.c b/gcc/cselib.c index c3a68726a2b..50cc0ff34c9 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -40,6 +40,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "hashtab.h" #include "cselib.h" #include "params.h" +#include "alloc-pool.h" static int entry_and_rtx_equal_p (const void *, const void *); static hashval_t get_value_hash (const void *); @@ -117,11 +118,6 @@ static GTY((deletable (""))) varray_type used_regs_old; memory for a non-const call instruction. */ static GTY(()) rtx callmem; -/* Caches for unused structures. */ -static GTY((deletable (""))) cselib_val *empty_vals; -static GTY((deletable (""))) struct elt_list *empty_elt_lists; -static GTY((deletable (""))) struct elt_loc_list *empty_elt_loc_lists; - /* Set by discard_useless_locs if it deleted the last location of any value. */ static int values_became_useless; @@ -134,20 +130,17 @@ static cselib_val dummy_val; May or may not contain the useless values - the list is compacted each time memory is invalidated. */ static cselib_val *first_containing_mem = &dummy_val; +static alloc_pool elt_loc_list_pool, elt_list_pool, cselib_val_pool; /* Allocate a struct elt_list and fill in its two elements with the arguments. */ -static struct elt_list * +static inline struct elt_list * new_elt_list (struct elt_list *next, cselib_val *elt) { - struct elt_list *el = empty_elt_lists; - - if (el) - empty_elt_lists = el->next; - else - el = ggc_alloc (sizeof (struct elt_list)); + struct elt_list *el; + el = pool_alloc (elt_list_pool); el->next = next; el->elt = elt; return el; @@ -156,15 +149,11 @@ new_elt_list (struct elt_list *next, cselib_val *elt) /* Allocate a struct elt_loc_list and fill in its two elements with the arguments. */ -static struct elt_loc_list * +static inline struct elt_loc_list * new_elt_loc_list (struct elt_loc_list *next, rtx loc) { - struct elt_loc_list *el = empty_elt_loc_lists; - - if (el) - empty_elt_loc_lists = el->next; - else - el = ggc_alloc (sizeof (struct elt_loc_list)); + struct elt_loc_list *el; + el = pool_alloc (elt_loc_list_pool); el->next = next; el->loc = loc; el->canon_loc = NULL; @@ -176,14 +165,13 @@ new_elt_loc_list (struct elt_loc_list *next, rtx loc) /* The elt_list at *PL is no longer needed. Unchain it and free its storage. */ -static void +static inline void unchain_one_elt_list (struct elt_list **pl) { struct elt_list *l = *pl; *pl = l->next; - l->next = empty_elt_lists; - empty_elt_lists = l; + pool_free (elt_list_pool, l); } /* Likewise for elt_loc_lists. */ @@ -194,8 +182,7 @@ unchain_one_elt_loc_list (struct elt_loc_list **pl) struct elt_loc_list *l = *pl; *pl = l->next; - l->next = empty_elt_loc_lists; - empty_elt_loc_lists = l; + pool_free (elt_loc_list_pool, l); } /* Likewise for cselib_vals. This also frees the addr_list associated with @@ -207,8 +194,7 @@ unchain_one_value (cselib_val *v) while (v->addr_list) unchain_one_elt_list (&v->addr_list); - v->u.next_free = empty_vals; - empty_vals = v; + pool_free (cselib_val_pool, v); } /* Remove all entries from the hash table. Also used during @@ -697,18 +683,15 @@ hash_rtx (rtx x, enum machine_mode mode, int create) /* Create a new value structure for VALUE and initialize it. The mode of the value is MODE. */ -static cselib_val * +static inline cselib_val * new_cselib_val (unsigned int value, enum machine_mode mode) { - cselib_val *e = empty_vals; - - if (e) - empty_vals = e->u.next_free; - else - e = ggc_alloc (sizeof (cselib_val)); + cselib_val *e = pool_alloc (cselib_val_pool); +#ifdef ENABLE_CHECKING if (value == 0) abort (); +#endif e->value = value; e->u.val_rtx = gen_rtx_VALUE (mode); @@ -1403,6 +1386,12 @@ cselib_update_varray_sizes (void) void cselib_init (void) { + elt_list_pool = create_alloc_pool ("elt_list", + sizeof (struct elt_list), 10); + elt_loc_list_pool = create_alloc_pool ("elt_loc_list", + sizeof (struct elt_loc_list), 10); + cselib_val_pool = create_alloc_pool ("cselib_val_list", + sizeof (cselib_val), 10); /* This is only created once. */ if (! callmem) callmem = gen_rtx_MEM (BLKmode, const0_rtx); @@ -1428,6 +1417,9 @@ cselib_init (void) void cselib_finish (void) { + free_alloc_pool (elt_list_pool); + free_alloc_pool (elt_loc_list_pool); + free_alloc_pool (cselib_val_pool); clear_table (); reg_values_old = reg_values; reg_values = 0; |