diff options
author | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-01 12:39:32 +0000 |
---|---|---|
committer | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-01 12:39:32 +0000 |
commit | f7d27fdc7ca08642d3988de5d9e479fa0e1b1a2f (patch) | |
tree | 4922b6bf881981c194eb73f9f372392f87c87165 /gcc/cselib.h | |
parent | f56b5538467bc4da531184520e86673c52821d83 (diff) | |
download | gcc-f7d27fdc7ca08642d3988de5d9e479fa0e1b1a2f.tar.gz |
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
Diffstat (limited to 'gcc/cselib.h')
-rw-r--r-- | gcc/cselib.h | 33 |
1 files changed, 32 insertions, 1 deletions
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<cselib_val> 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<elt_loc_list> pool; }; /* Describe a single set that is part of an insn. */ |