From f7d27fdc7ca08642d3988de5d9e479fa0e1b1a2f Mon Sep 17 00:00:00 2001 From: marxin Date: Mon, 1 Jun 2015 12:39:32 +0000 Subject: Change use to type-based pool allocator in cselib.c. * cselib.c (new_elt_list):Use new type-based pool allocator. (new_elt_loc_list) Likewise. (unchain_one_elt_list) Likewise. (unchain_one_elt_loc_list) Likewise. (unchain_one_value) Likewise. (new_cselib_val) Likewise. (cselib_init) Likewise. (cselib_finish) Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223952 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cselib.h | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'gcc/cselib.h') diff --git a/gcc/cselib.h b/gcc/cselib.h index 082bf5490f2..cdd06ad952a 100644 --- a/gcc/cselib.h +++ b/gcc/cselib.h @@ -21,7 +21,8 @@ along with GCC; see the file COPYING3. If not see #define GCC_CSELIB_H /* Describe a value. */ -struct cselib_val { +struct cselib_val +{ /* The hash value. */ unsigned int hash; @@ -40,6 +41,21 @@ struct cselib_val { struct elt_list *addr_list; struct cselib_val *next_containing_mem; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { + return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { + pool.remove ((cselib_val *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocator pool; }; /* A list of rtl expressions that hold the same value. */ @@ -50,6 +66,21 @@ struct elt_loc_list { rtx loc; /* The insn that made the equivalence. */ rtx_insn *setting_insn; + + /* Pool allocation new operator. */ + inline void *operator new (size_t) + { + return pool.allocate (); + } + + /* Delete operator utilizing pool allocation. */ + inline void operator delete (void *ptr) + { + pool.remove ((elt_loc_list *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocator pool; }; /* Describe a single set that is part of an insn. */ -- cgit v1.2.1