Commit 6a59927d by Jan Hubicka Committed by Jan Hubicka

cselib.c: Include alloc-pool.h


	* 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

From-SVN: r76226
parent 3c53850d
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> 2004-01-20 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips.c (mips_load_call_address): Make the call insn * config/mips/mips.c (mips_load_call_address): Make the call insn
......
...@@ -1635,7 +1635,8 @@ coverage.o : coverage.c gcov-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ ...@@ -1635,7 +1635,8 @@ coverage.o : coverage.c gcov-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
gt-coverage.h $(HASHTAB_H) gt-coverage.h $(HASHTAB_H)
cselib.o : cselib.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(REGS_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 \ 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) \ 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 \ 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) \ output.h function.h $(BASIC_BLOCK_H) $(GGC_H) $(TM_P_H) $(TIMEVAR_H) \
......
...@@ -40,6 +40,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -40,6 +40,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "hashtab.h" #include "hashtab.h"
#include "cselib.h" #include "cselib.h"
#include "params.h" #include "params.h"
#include "alloc-pool.h"
static int entry_and_rtx_equal_p (const void *, const void *); static int entry_and_rtx_equal_p (const void *, const void *);
static hashval_t get_value_hash (const void *); static hashval_t get_value_hash (const void *);
...@@ -117,11 +118,6 @@ static GTY((deletable (""))) varray_type used_regs_old; ...@@ -117,11 +118,6 @@ static GTY((deletable (""))) varray_type used_regs_old;
memory for a non-const call instruction. */ memory for a non-const call instruction. */
static GTY(()) rtx callmem; 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 /* Set by discard_useless_locs if it deleted the last location of any
value. */ value. */
static int values_became_useless; static int values_became_useless;
...@@ -134,20 +130,17 @@ static cselib_val dummy_val; ...@@ -134,20 +130,17 @@ static cselib_val dummy_val;
May or may not contain the useless values - the list is compacted May or may not contain the useless values - the list is compacted
each time memory is invalidated. */ each time memory is invalidated. */
static cselib_val *first_containing_mem = &dummy_val; 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 /* Allocate a struct elt_list and fill in its two elements with the
arguments. */ arguments. */
static struct elt_list * static inline struct elt_list *
new_elt_list (struct elt_list *next, cselib_val *elt) new_elt_list (struct elt_list *next, cselib_val *elt)
{ {
struct elt_list *el = empty_elt_lists; struct elt_list *el;
el = pool_alloc (elt_list_pool);
if (el)
empty_elt_lists = el->next;
else
el = ggc_alloc (sizeof (struct elt_list));
el->next = next; el->next = next;
el->elt = elt; el->elt = elt;
return el; return el;
...@@ -156,15 +149,11 @@ new_elt_list (struct elt_list *next, cselib_val *elt) ...@@ -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 /* Allocate a struct elt_loc_list and fill in its two elements with the
arguments. */ arguments. */
static struct elt_loc_list * static inline struct elt_loc_list *
new_elt_loc_list (struct elt_loc_list *next, rtx loc) new_elt_loc_list (struct elt_loc_list *next, rtx loc)
{ {
struct elt_loc_list *el = empty_elt_loc_lists; struct elt_loc_list *el;
el = pool_alloc (elt_loc_list_pool);
if (el)
empty_elt_loc_lists = el->next;
else
el = ggc_alloc (sizeof (struct elt_loc_list));
el->next = next; el->next = next;
el->loc = loc; el->loc = loc;
el->canon_loc = NULL; el->canon_loc = NULL;
...@@ -176,14 +165,13 @@ new_elt_loc_list (struct elt_loc_list *next, rtx loc) ...@@ -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 /* The elt_list at *PL is no longer needed. Unchain it and free its
storage. */ storage. */
static void static inline void
unchain_one_elt_list (struct elt_list **pl) unchain_one_elt_list (struct elt_list **pl)
{ {
struct elt_list *l = *pl; struct elt_list *l = *pl;
*pl = l->next; *pl = l->next;
l->next = empty_elt_lists; pool_free (elt_list_pool, l);
empty_elt_lists = l;
} }
/* Likewise for elt_loc_lists. */ /* Likewise for elt_loc_lists. */
...@@ -194,8 +182,7 @@ unchain_one_elt_loc_list (struct elt_loc_list **pl) ...@@ -194,8 +182,7 @@ unchain_one_elt_loc_list (struct elt_loc_list **pl)
struct elt_loc_list *l = *pl; struct elt_loc_list *l = *pl;
*pl = l->next; *pl = l->next;
l->next = empty_elt_loc_lists; pool_free (elt_loc_list_pool, l);
empty_elt_loc_lists = l;
} }
/* Likewise for cselib_vals. This also frees the addr_list associated with /* Likewise for cselib_vals. This also frees the addr_list associated with
...@@ -207,8 +194,7 @@ unchain_one_value (cselib_val *v) ...@@ -207,8 +194,7 @@ unchain_one_value (cselib_val *v)
while (v->addr_list) while (v->addr_list)
unchain_one_elt_list (&v->addr_list); unchain_one_elt_list (&v->addr_list);
v->u.next_free = empty_vals; pool_free (cselib_val_pool, v);
empty_vals = v;
} }
/* Remove all entries from the hash table. Also used during /* Remove all entries from the hash table. Also used during
...@@ -697,18 +683,15 @@ hash_rtx (rtx x, enum machine_mode mode, int create) ...@@ -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 /* Create a new value structure for VALUE and initialize it. The mode of the
value is MODE. */ value is MODE. */
static cselib_val * static inline cselib_val *
new_cselib_val (unsigned int value, enum machine_mode mode) new_cselib_val (unsigned int value, enum machine_mode mode)
{ {
cselib_val *e = empty_vals; cselib_val *e = pool_alloc (cselib_val_pool);
if (e)
empty_vals = e->u.next_free;
else
e = ggc_alloc (sizeof (cselib_val));
#ifdef ENABLE_CHECKING
if (value == 0) if (value == 0)
abort (); abort ();
#endif
e->value = value; e->value = value;
e->u.val_rtx = gen_rtx_VALUE (mode); e->u.val_rtx = gen_rtx_VALUE (mode);
...@@ -1403,6 +1386,12 @@ cselib_update_varray_sizes (void) ...@@ -1403,6 +1386,12 @@ cselib_update_varray_sizes (void)
void void
cselib_init (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. */ /* This is only created once. */
if (! callmem) if (! callmem)
callmem = gen_rtx_MEM (BLKmode, const0_rtx); callmem = gen_rtx_MEM (BLKmode, const0_rtx);
...@@ -1428,6 +1417,9 @@ cselib_init (void) ...@@ -1428,6 +1417,9 @@ cselib_init (void)
void void
cselib_finish (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 (); clear_table ();
reg_values_old = reg_values; reg_values_old = reg_values;
reg_values = 0; reg_values = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment