From patchwork Mon Sep 30 15:48:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 279179 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8AB2B2C00C1 for ; Tue, 1 Oct 2013 01:48:50 +1000 (EST) 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:content-type; q= dns; s=default; b=Wfl4pLJTeF/S85+0kyDFSAA4ZnkxlYL9d+kLPJJ6GQBNrg tWMniBjxuUAKbSJCdByauZ9qV7kl6+pwMzS/dmcmmdgBK0vbMnwwAVfTxRMpAqPs RdZEP0cxL/807HR29/7NrMj+pRPw4vyCCJgfRdDzLLsbreHGWhdx+G9Tz8Sw0= 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:content-type; s= default; bh=qhSGhfekEA5ME+4TXlKZo7SEvas=; b=d+lT0/m1WWTFpDGeVEs7 d37nwW0L5j8D44DlbC4i+Cllrp+g+SKMxoIdksPEQV6xrKqbtJdfNLrUHHq2Cjqq c+h87czo+gWIzdeOt0Xa6PVl1CYvjy+436dEoXr2XMGMZV2ILHpBnSwbxirww8RK QWE6wOQU/fcAGdfsGKokKgc= Received: (qmail 23004 invoked by alias); 30 Sep 2013 15:48:38 -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 22961 invoked by uid 89); 30 Sep 2013 15:48:37 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 30 Sep 2013 15:48:37 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8UFmZ0Y028512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 30 Sep 2013 11:48:35 -0400 Received: from [10.10.55.194] (vpn-55-194.rdu2.redhat.com [10.10.55.194]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r8UFmY96019610; Mon, 30 Sep 2013 11:48:34 -0400 Message-ID: <52499D51.4050502@redhat.com> Date: Mon, 30 Sep 2013 11:48:33 -0400 From: Andrew MacLeod User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: gcc-patches , Richard Biener Subject: [patch] Add tree-ssa-coalesce.h X-IsSubscribed: yes Move the prototype for coalesce_ssa_name() out of tree-ssa-live.h and put it in a new tree-ssa-coalesce.h file. Include tree-ssa-coalesce.h from tree-outof-ssa.h as it forms part of the out-of-ssa module. Also move gimple_can_coalesce_p from tree-ssa-coalesce.c to gimple.h as it operates on gimple structures and is also used a couple of other places. The prototype is already in gimple.h. Bootstraps on build/x86_64-unknown-linux-gnu with no new regressions. OK? Andrew * tree-ssa-live.h (coalesce_ssa_name): Move Prototype to... * tree-ssa-coalesce.h: New. Move prototype to here. * tree-outof-ssa.h: Include tree-ssa-coalesce.h. * tree-ssa-coalesce.c: Include tree-outof-ssa.h. (gimple_can_coalesce_p): Move to... * gimple.c (gimple_can_coalesce_p): Here. *** a1/tree-ssa-live.h 2013-09-30 10:52:14.833172626 -0400 --- tree-ssa-live.h 2013-09-30 11:10:59.161620552 -0400 *************** make_live_on_entry (tree_live_info_p liv *** 321,328 **** bitmap_set_bit (live->global, p); } - - /* From tree-ssa-coalesce.c */ - extern var_map coalesce_ssa_name (void); - #endif /* _TREE_SSA_LIVE_H */ --- 321,324 ---- *** a1/tree-ssa-coalesce.h 2013-09-30 11:22:12.566295821 -0400 --- tree-ssa-coalesce.h 2013-09-30 11:10:59.162614148 -0400 *************** *** 1 **** --- 1,26 ---- + /* Header file for tree-ssa-coalesce.c exports. + Copyright (C) 2013 Free Software Foundation, Inc. + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + GCC is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + + #ifndef GCC_TREE_SSA_COALESCE_H + #define GCC_TREE_SSA_COALESCE_H + + extern var_map coalesce_ssa_name (void); + + + #endif /* GCC_TREE_SSA_COALESCE_H */ *** a1/tree-outof-ssa.h 2013-09-30 10:52:14.827173820 -0400 --- tree-outof-ssa.h 2013-09-30 11:10:59.163608763 -0400 *************** along with GCC; see the file COPYING3. *** 23,28 **** --- 23,29 ---- #include "tree-ssa-live.h" #include "tree-ssa-ter.h" + #include "tree-ssa-coalesce.h" /* This structure (of which only a singleton SA exists) is used to pass around information between the outof-SSA functions, cfgexpand *** a1/tree-ssa-coalesce.c 2013-09-30 10:52:14.831172590 -0400 --- tree-ssa-coalesce.c 2013-09-30 11:14:41.572345761 -0400 *************** along with GCC; see the file COPYING3. *** 29,35 **** #include "dumpfile.h" #include "tree-ssa.h" #include "hash-table.h" ! #include "tree-ssa-live.h" #include "diagnostic-core.h" --- 29,35 ---- #include "dumpfile.h" #include "tree-ssa.h" #include "hash-table.h" ! #include "tree-outof-ssa.h" #include "diagnostic-core.h" *************** coalesce_ssa_name (void) *** 1333,1374 **** return map; } - - /* Given SSA_NAMEs NAME1 and NAME2, return true if they are candidates for - coalescing together, false otherwise. - - This must stay consistent with var_map_base_init in tree-ssa-live.c. */ - - bool - gimple_can_coalesce_p (tree name1, tree name2) - { - /* First check the SSA_NAME's associated DECL. We only want to - coalesce if they have the same DECL or both have no associated DECL. */ - tree var1 = SSA_NAME_VAR (name1); - tree var2 = SSA_NAME_VAR (name2); - var1 = (var1 && (!VAR_P (var1) || !DECL_IGNORED_P (var1))) ? var1 : NULL_TREE; - var2 = (var2 && (!VAR_P (var2) || !DECL_IGNORED_P (var2))) ? var2 : NULL_TREE; - if (var1 != var2) - return false; - - /* Now check the types. If the types are the same, then we should - try to coalesce V1 and V2. */ - tree t1 = TREE_TYPE (name1); - tree t2 = TREE_TYPE (name2); - if (t1 == t2) - return true; - - /* If the types are not the same, check for a canonical type match. This - (for example) allows coalescing when the types are fundamentally the - same, but just have different names. - - Note pointer types with different address spaces may have the same - canonical type. Those are rejected for coalescing by the - types_compatible_p check. */ - if (TYPE_CANONICAL (t1) - && TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2) - && types_compatible_p (t1, t2)) - return true; - - return false; - } --- 1333,1335 ---- *** a1/gimple.c 2013-09-30 10:52:14.721172704 -0400 --- gimple.c 2013-09-30 11:14:44.074494494 -0400 *************** dump_decl_set (FILE *file, bitmap set) *** 4106,4109 **** --- 4106,4147 ---- fprintf (file, "NIL"); } + /* Given SSA_NAMEs NAME1 and NAME2, return true if they are candidates for + coalescing together, false otherwise. + + This must stay consistent with var_map_base_init in tree-ssa-live.c. */ + + bool + gimple_can_coalesce_p (tree name1, tree name2) + { + /* First check the SSA_NAME's associated DECL. We only want to + coalesce if they have the same DECL or both have no associated DECL. */ + tree var1 = SSA_NAME_VAR (name1); + tree var2 = SSA_NAME_VAR (name2); + var1 = (var1 && (!VAR_P (var1) || !DECL_IGNORED_P (var1))) ? var1 : NULL_TREE; + var2 = (var2 && (!VAR_P (var2) || !DECL_IGNORED_P (var2))) ? var2 : NULL_TREE; + if (var1 != var2) + return false; + + /* Now check the types. If the types are the same, then we should + try to coalesce V1 and V2. */ + tree t1 = TREE_TYPE (name1); + tree t2 = TREE_TYPE (name2); + if (t1 == t2) + return true; + + /* If the types are not the same, check for a canonical type match. This + (for example) allows coalescing when the types are fundamentally the + same, but just have different names. + + Note pointer types with different address spaces may have the same + canonical type. Those are rejected for coalescing by the + types_compatible_p check. */ + if (TYPE_CANONICAL (t1) + && TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2) + && types_compatible_p (t1, t2)) + return true; + + return false; + } #include "gt-gimple.h"