From patchwork Fri May 29 13:34:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 477887 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id F3F2D140F97 for ; Fri, 29 May 2015 23:34:48 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=sjnRbHCL; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; q=dns; s=default; b=bw1Le2vCQ+TKbvd3Q ngz6UH6QgQDpIDEh2vm9gAPidK2+7mZYw8S3+NEqDkFsuycgcr/2gxzyGNycbiUU OBSS+7SqPkbXKetCcijpzXEHMIuatM3GavYqqmPDVTIKatKZIS5uouzXV/2i4TKr JQGHAo48JLHBn7l4dU0OR3+nvo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; s=default; bh=LeHFCGsAadKXprcQ+7Hd3nl eyV0=; b=sjnRbHCLfvYbMfGAcmmB7q5853LLBjz2yUwjvLLP0r/7R9b8foNFbNg 1rCyVFcnMAgGSJFchLnk5YKv20uH2DI7YOvbt/6B97sRybGsKCx27jsfjtWsbr1T 20pvOl2NTBmNyJqFCtWsbXdcg6JbBaXwHvNJ1umptiS5ZEHMdxIE= 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-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@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 15:34:07 +0200 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> X-IsSubscribed: yes 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 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