From patchwork Wed May 27 13:56:52 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: 477154 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 8563A14029C for ; Thu, 28 May 2015 00:19:11 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=YwrGLuj0; 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 :resent-from:resent-to:resent-date:resent-message-id:message-id :in-reply-to:references:from:date:subject:to; q=dns; s=default; b= jyJkLNVNxTAhAQpuZGmr4eMWIoI3yWwfO61fDI9XJA/TNWSbXwJHfISBruqmoCxa 5ZJDjP1b6r6HtqRdH9UmgE7fOpeFylKm+WmVXfPzckYnQmsNEesWIo2Enu89Oif+ 2YIWgZw7C9Y4P8HjYRMdzdrZLFJaXAldnVwJvZSg1M4= 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 :resent-from:resent-to:resent-date:resent-message-id:message-id :in-reply-to:references:from:date:subject:to; s=default; bh=M2nw WfLRHyebup+yhWa07l/Bpl0=; b=YwrGLuj0ymnuZl20TeVHDMAzZ28UT9RwHZDZ MIDpypAuU/TMv5wNeHcRSdL/fBahAblsGqX0y1j1XeY/CImLXxrMTMBVVfu2A9d+ dZnL3WQFnHAYemf3fjBFCPIMf+++aDfW4rvv0oEDOQRJNOYhsvDSUcmykl+3X3db C9ge71k= Received: (qmail 94977 invoked by alias); 27 May 2015 14:18:01 -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 94875 invoked by uid 89); 27 May 2015 14:18:00 -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: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 27 May 2015 14:17:58 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxbsI-0007GV-UU for gcc-patches@gcc.gnu.org; Wed, 27 May 2015 10:00:12 -0400 Received: from cantor2.suse.de ([195.135.220.15]:57515 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxbsI-00078k-Ly for gcc-patches@gcc.gnu.org; Wed, 27 May 2015 10:00:02 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BC2DDAE02 for ; Wed, 27 May 2015 13:59:57 +0000 (UTC) Resent-From: =?UTF-8?B?TWFydGluIExpxaFrYQ==?= Resent-To: GCC Patches Resent-Date: Wed, 27 May 2015 15:59:57 +0200 Resent-Message-ID: <5565CDDD.3020509@suse.cz> Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 Message-Id: <9c38ca1354063663be7f89043ce7b49803bed2ad.1432735040.git.mliska@suse.cz> In-Reply-To: <83d59ba92a3c4b3ba831ebc2fce325f0416848d0.1432735040.git.mliska@suse.cz> References: <83d59ba92a3c4b3ba831ebc2fce325f0416848d0.1432735040.git.mliska@suse.cz> From: mliska Date: Wed, 27 May 2015 15:56:52 +0200 Subject: [PATCH 25/35] Change use to type-based pool allocator in tree-ssa-sccvn.c. To: gcc-patches@gcc.gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-IsSubscribed: yes gcc/ChangeLog: 2015-04-30 Martin Liska * tree-ssa-sccvn.c (vn_reference_insert): Use new type-based pool allocator. (vn_reference_insert_pieces): Likewise. (vn_phi_insert): Likewise. (visit_reference_op_call): Likewise. (copy_phi): Likewise. (copy_reference): Likewise. (process_scc): Likewise. (allocate_vn_table): Likewise. (free_vn_table): Likewise. --- gcc/tree-ssa-sccvn.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 03be480..98b0cc5 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -289,8 +289,8 @@ typedef struct vn_tables_s vn_phi_table_type *phis; vn_reference_table_type *references; struct obstack nary_obstack; - alloc_pool phis_pool; - alloc_pool references_pool; + pool_allocator *phis_pool; + pool_allocator *references_pool; } *vn_tables_t; @@ -2285,7 +2285,7 @@ vn_reference_insert (tree op, tree result, tree vuse, tree vdef) vn_reference_t vr1; bool tem; - vr1 = (vn_reference_t) pool_alloc (current_info->references_pool); + vr1 = current_info->references_pool->allocate (); if (TREE_CODE (result) == SSA_NAME) vr1->value_id = VN_INFO (result)->value_id; else @@ -2330,7 +2330,7 @@ vn_reference_insert_pieces (tree vuse, alias_set_type set, tree type, vn_reference_s **slot; vn_reference_t vr1; - vr1 = (vn_reference_t) pool_alloc (current_info->references_pool); + vr1 = current_info->references_pool->allocate (); vr1->value_id = value_id; vr1->vuse = vuse ? SSA_VAL (vuse) : NULL_TREE; vr1->operands = valueize_refs (operands); @@ -2756,7 +2756,7 @@ static vn_phi_t vn_phi_insert (gimple phi, tree result) { vn_phi_s **slot; - vn_phi_t vp1 = (vn_phi_t) pool_alloc (current_info->phis_pool); + vn_phi_t vp1 = current_info->phis_pool->allocate (); unsigned i; vec args = vNULL; @@ -2999,7 +2999,7 @@ visit_reference_op_call (tree lhs, gcall *stmt) changed |= set_ssa_val_to (vdef, vdef); if (lhs) changed |= set_ssa_val_to (lhs, lhs); - vr2 = (vn_reference_t) pool_alloc (current_info->references_pool); + vr2 = current_info->references_pool->allocate (); vr2->vuse = vr1.vuse; /* As we are not walking the virtual operand chain we know the shared_lookup_references are still original so we can re-use @@ -3873,7 +3873,7 @@ copy_nary (vn_nary_op_t onary, vn_tables_t info) static void copy_phi (vn_phi_t ophi, vn_tables_t info) { - vn_phi_t phi = (vn_phi_t) pool_alloc (info->phis_pool); + vn_phi_t phi = info->phis_pool->allocate (); vn_phi_s **slot; memcpy (phi, ophi, sizeof (*phi)); ophi->phiargs.create (0); @@ -3889,7 +3889,7 @@ copy_reference (vn_reference_t oref, vn_tables_t info) { vn_reference_t ref; vn_reference_s **slot; - ref = (vn_reference_t) pool_alloc (info->references_pool); + ref = info->references_pool->allocate (); memcpy (ref, oref, sizeof (*ref)); oref->operands.create (0); slot = info->references->find_slot_with_hash (ref, ref->hashcode, INSERT); @@ -3954,8 +3954,8 @@ process_scc (vec scc) optimistic_info->references->empty (); obstack_free (&optimistic_info->nary_obstack, NULL); gcc_obstack_init (&optimistic_info->nary_obstack); - empty_alloc_pool (optimistic_info->phis_pool); - empty_alloc_pool (optimistic_info->references_pool); + optimistic_info->phis_pool->release (); + optimistic_info->references_pool->release (); FOR_EACH_VEC_ELT (scc, i, var) VN_INFO (var)->expr = NULL_TREE; FOR_EACH_VEC_ELT (scc, i, var) @@ -4132,12 +4132,9 @@ allocate_vn_table (vn_tables_t table) table->references = new vn_reference_table_type (23); gcc_obstack_init (&table->nary_obstack); - table->phis_pool = create_alloc_pool ("VN phis", - sizeof (struct vn_phi_s), - 30); - table->references_pool = create_alloc_pool ("VN references", - sizeof (struct vn_reference_s), - 30); + table->phis_pool = new pool_allocator ("VN phis", 30); + table->references_pool = new pool_allocator ("VN references", + 30); } /* Free a value number table. */ @@ -4152,8 +4149,8 @@ free_vn_table (vn_tables_t table) delete table->references; table->references = NULL; obstack_free (&table->nary_obstack, NULL); - free_alloc_pool (table->phis_pool); - free_alloc_pool (table->references_pool); + delete table->phis_pool; + delete table->references_pool; } static void