diff options
author | Martin Liska <mliska@suse.cz> | 2015-06-01 14:39:32 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2015-06-01 12:39:32 +0000 |
commit | a78a26f11e2e95d4bb43f1782f891d8210d03e0d (patch) | |
tree | 4922b6bf881981c194eb73f9f372392f87c87165 /gcc/cselib.h | |
parent | 533ab6c4c88206b3ea5fadca9894ddd3c8113ac8 (diff) | |
download | gcc-a78a26f11e2e95d4bb43f1782f891d8210d03e0d.zip gcc-a78a26f11e2e95d4bb43f1782f891d8210d03e0d.tar.gz gcc-a78a26f11e2e95d4bb43f1782f891d8210d03e0d.tar.bz2 |
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.
From-SVN: r223952
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 082bf54..cdd06ad 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. */ |