From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55039 invoked by alias); 29 May 2015 13:34:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 54899 invoked by uid 89); 29 May 2015 13:34:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.7 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Fri, 29 May 2015 13:34:11 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D6A23AC66; Fri, 29 May 2015 13:34:07 +0000 (UTC) Message-ID: <55686ACF.9040503@suse.cz> Date: Fri, 29 May 2015 13:37:00 -0000 From: =?windows-1252?Q?Martin_Li=9Aka?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Jeff Law , gcc-patches@gcc.gnu.org Subject: Re: [PATCH 11/35] Change use to type-based pool allocator in sh.c. References: <83d59ba92a3c4b3ba831ebc2fce325f0416848d0.1432735040.git.mliska@suse.cz> <556605FB.8000901@redhat.com> In-Reply-To: <556605FB.8000901@redhat.com> Content-Type: multipart/mixed; boundary="------------040409030001080402030702" X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg02765.txt.bz2 This is a multi-part message in MIME format. --------------040409030001080402030702 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-length: 271 On 05/27/2015 07:59 PM, Jeff Law wrote: > On 05/27/2015 07:56 AM, mliska wrote: >> gcc/ChangeLog: >> >> 2015-04-30 Martin Liska >> >> * config/sh/sh.c (add_constant):Use new type-based pool allocator. >> (sh_reorg) Likewise. > OK. > jeff > v2 --------------040409030001080402030702 Content-Type: text/x-patch; name="0010-Change-use-to-type-based-pool-allocator-in-sh.c.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0010-Change-use-to-type-based-pool-allocator-in-sh.c.patch" Content-length: 2910 >From 68f0b72993d882d5dfe4096806f2bb78c87a37c4 Mon Sep 17 00:00:00 2001 From: mliska Date: Wed, 27 May 2015 15:56:47 +0200 Subject: [PATCH 10/32] Change use to type-based pool allocator in sh.c. gcc/ChangeLog: 2015-04-30 Martin Liska * config/sh/sh.c (add_constant):Use new type-based pool allocator. (sh_reorg) Likewise. --- gcc/config/sh/sh.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) 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 pool; + } *label_ref_list_t; +pool_allocator 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); -- 2.1.4 --------------040409030001080402030702--