diff options
author | Martin Liska <mliska@suse.cz> | 2015-06-01 14:38:48 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2015-06-01 12:38:48 +0000 |
commit | 533ab6c4c88206b3ea5fadca9894ddd3c8113ac8 (patch) | |
tree | 82f378af8c97fd9d2f810acfd75bfa2e5cd9e779 | |
parent | ac0539d7ac678bb4f7adbebb2e69ee96edf84523 (diff) | |
download | gcc-533ab6c4c88206b3ea5fadca9894ddd3c8113ac8.zip gcc-533ab6c4c88206b3ea5fadca9894ddd3c8113ac8.tar.gz gcc-533ab6c4c88206b3ea5fadca9894ddd3c8113ac8.tar.bz2 |
Change use to type-based pool allocator in sh.c.
* config/sh/sh.c (add_constant):Use new type-based pool allocator.
(sh_reorg) Likewise.
From-SVN: r223951
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/sh/sh.c | 30 |
2 files changed, 27 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ef7e40a..cf39571 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2015-06-01 Martin Liska <mliska@suse.cz> + * config/sh/sh.c (add_constant):Use new type-based pool allocator. + (sh_reorg) Likewise. + +2015-06-01 Martin Liska <mliska@suse.cz> + * cfg.c (initialize_original_copy_tables):Use new type-based pool allocator. (free_original_copy_tables) Likewise. (copy_original_table_clear) Likewise. diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index bc1ce24..285aa18 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -4648,14 +4648,31 @@ gen_datalabel_ref (rtx sym) } -static alloc_pool label_ref_list_pool; - typedef struct label_ref_list_d { rtx_code_label *label; struct label_ref_list_d *next; + + /* 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 ((label_ref_list_d *) ptr); + } + + /* Memory allocation pool. */ + static pool_allocator<label_ref_list_d> pool; + } *label_ref_list_t; +pool_allocator<label_ref_list_d> label_ref_list_d::pool + ("label references list", 30); + /* The SH cannot load a large constant into a register, constants have to come from a pc relative load. The reference of a pc relative load instruction must be less than 1k in front of the instruction. This @@ -4775,7 +4792,7 @@ add_constant (rtx x, machine_mode mode, rtx last_value) } if (lab && pool_window_label) { - newref = (label_ref_list_t) pool_alloc (label_ref_list_pool); + newref = new label_ref_list_d; newref->label = pool_window_label; ref = pool_vector[pool_window_last].wend; newref->next = ref; @@ -4804,7 +4821,7 @@ add_constant (rtx x, machine_mode mode, rtx last_value) pool_vector[pool_size].part_of_sequence_p = (lab == 0); if (lab && pool_window_label) { - newref = (label_ref_list_t) pool_alloc (label_ref_list_pool); + newref = new label_ref_list_d; newref->label = pool_window_label; ref = pool_vector[pool_window_last].wend; newref->next = ref; @@ -6359,9 +6376,6 @@ sh_reorg (void) /* Scan the function looking for move instructions which have to be changed to pc-relative loads and insert the literal tables. */ - label_ref_list_pool = create_alloc_pool ("label references list", - sizeof (struct label_ref_list_d), - 30); mdep_reorg_phase = SH_FIXUP_PCLOAD; for (insn = first, num_mova = 0; insn; insn = NEXT_INSN (insn)) { @@ -6553,7 +6567,7 @@ sh_reorg (void) insn = barrier; } } - free_alloc_pool (label_ref_list_pool); + label_ref_list_d::pool.release (); for (insn = first; insn; insn = NEXT_INSN (insn)) PUT_MODE (insn, VOIDmode); |