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: 477152 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 D9CB914016A for ; Thu, 28 May 2015 00:18:40 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ClnYVRkD; 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= OWKRe56/Qva3UqpFd/b0voy+VckgHHKZDEG7t+BeboFPcbJTkMsXDOgxmQSRRbid QKfI3wXY0Xx1zK8c21ERwfFqAORq6sjROulwlUYn6Hr5IpTSF1nkQyfwHo7R/ZRh LSHDKBsw90AEPfq3tI6TNqv1Fy1vVqeGGwuMhd5FrYc= 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=zhYS dMR68L2EWazJZK1BF46dM+g=; b=ClnYVRkDFBKj2GH+uMybHpZRETDxHLnR+YcB jU4UvY4PdhF+h8lGufqlzFbXOZndi7S4ZsPyQI8Tci1uEd+Jgey2dfBkxVgbW7a7 gzRCOVbnofKrqkI5cYLE7IRoHQmsQLrCJG62H3YmQHUF6/slWLBMuGf1ZEarmWFD pbqUxLs= Received: (qmail 93501 invoked by alias); 27 May 2015 14:17:48 -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 93457 invoked by uid 89); 27 May 2015 14:17:47 -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:37 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxbsJ-0007Hw-6U for gcc-patches@gcc.gnu.org; Wed, 27 May 2015 10:00:09 -0400 Received: from cantor2.suse.de ([195.135.220.15]:57518 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxbsI-0007Bg-Sh for gcc-patches@gcc.gnu.org; Wed, 27 May 2015 10:00:03 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CF2F2AE00 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.3000601@suse.cz> Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 Message-Id: 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 24/35] Change use to type-based pool allocator in tree-ssa-reassoc.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-reassoc.c (add_to_ops_vec): Use new type-based pool allocator. (add_repeat_to_ops_vec): Likewise. (get_ops): Likewise. (maybe_optimize_range_tests): Likewise. (init_reassoc): Likewise. (fini_reassoc): Likewise. --- gcc/tree-ssa-reassoc.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 0c67379..c1a7f4b9 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c @@ -235,7 +235,8 @@ typedef struct operand_entry unsigned int count; } *operand_entry_t; -static alloc_pool operand_entry_pool; +static pool_allocator operand_entry_pool ("operand entry pool", + 30); /* This is used to assign a unique ID to each struct operand_entry so that qsort results are identical on different hosts. */ @@ -619,7 +620,7 @@ sort_by_operand_rank (const void *pa, const void *pb) static void add_to_ops_vec (vec *ops, tree op) { - operand_entry_t oe = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe->op = op; oe->rank = get_rank (op); @@ -635,7 +636,7 @@ static void add_repeat_to_ops_vec (vec *ops, tree op, HOST_WIDE_INT repeat) { - operand_entry_t oe = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe->op = op; oe->rank = get_rank (op); @@ -2990,7 +2991,7 @@ get_ops (tree var, enum tree_code code, vec *ops, && !get_ops (rhs[i], code, ops, loop) && has_single_use (rhs[i])) { - operand_entry_t oe = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe->op = rhs[i]; oe->rank = code; @@ -3223,8 +3224,7 @@ maybe_optimize_range_tests (gimple stmt) && has_single_use (rhs)) { /* Otherwise, push the _234 range test itself. */ - operand_entry_t oe - = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe->op = rhs; oe->rank = code; @@ -3256,8 +3256,7 @@ maybe_optimize_range_tests (gimple stmt) loop_containing_stmt (stmt)))) { /* Or push the GIMPLE_COND stmt itself. */ - operand_entry_t oe - = (operand_entry_t) pool_alloc (operand_entry_pool); + operand_entry_t oe = operand_entry_pool.allocate (); oe->op = NULL; oe->rank = (e->flags & EDGE_TRUE_VALUE) @@ -5035,8 +5034,6 @@ init_reassoc (void) memset (&reassociate_stats, 0, sizeof (reassociate_stats)); - operand_entry_pool = create_alloc_pool ("operand entry pool", - sizeof (struct operand_entry), 30); next_operand_entry_id = 0; /* Reverse RPO (Reverse Post Order) will give us something where @@ -5085,7 +5082,7 @@ fini_reassoc (void) reassociate_stats.pows_created); delete operand_rank; - free_alloc_pool (operand_entry_pool); + operand_entry_pool.release (); free (bb_rank); plus_negates.release (); free_dominance_info (CDI_POST_DOMINATORS);