From patchwork Thu Feb 9 23:05:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 140451 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]) by ozlabs.org (Postfix) with SMTP id 69160B6EF7 for ; Fri, 10 Feb 2012 10:06:20 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1329433581; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC: Subject:References:In-Reply-To:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=UTLCXBPA6Ln/+c4XX9ZNg803MRg=; b=G4XWtG+TqwZykxLCxVri2dWNo1mXLskiZGf88jQD4ib6IEI9te4HR2e58yoHfd M8uR+G9wBDNd7GXvBncNCyOstr9+ChATDVdF776N5filnk4bSVK2rDoW8bUUgT59 krONSqB+EG/pnIXFWgkA/Okplp4+5+kI5f/7Ey/ao09cU= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:X-Forwarded-Message-Id:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=tBbb7RxfMxcKWAv5LO5L/OWsKB4kln7BAjwQMRBp7k/V3OrSNKP940phd/aash r+ee3cXMBRkk1BpqggxBHhOjyJYDxrpM9Fq9IH7gnOi5U4UToe2VIasFPV1lVTh7 hE3ByEHw8Wvvyqk2uy3rF22JPNNlxJVzOayaLqWH6HPFw=; Received: (qmail 1352 invoked by alias); 9 Feb 2012 23:06:14 -0000 Received: (qmail 1340 invoked by uid 22791); 9 Feb 2012 23:06:12 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-qy0-f175.google.com (HELO mail-qy0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Feb 2012 23:05:59 +0000 Received: by qcso7 with SMTP id o7so1306793qcs.20 for ; Thu, 09 Feb 2012 15:05:58 -0800 (PST) Received: by 10.229.77.147 with SMTP id g19mr2468903qck.39.1328828758555; Thu, 09 Feb 2012 15:05:58 -0800 (PST) Received: from anchor.twiddle.home ([173.160.232.49]) by mx.google.com with ESMTPS id fd1sm8758392qab.1.2012.02.09.15.05.57 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 09 Feb 2012 15:05:57 -0800 (PST) Message-ID: <4F345153.8090602@redhat.com> Date: Thu, 09 Feb 2012 15:05:55 -0800 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20120131 Thunderbird/10.0 MIME-Version: 1.0 To: GCC Patches CC: rguenther@suse.de, Diego Novillo , Aldy Hernandez Subject: trans-mem: virtual ops for gimple_transaction References: In-Reply-To: X-Forwarded-Message-Id: X-IsSubscribed: yes 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 > From: rguenth at gcc dot gnu.org > the __transaction_atomic // SUBCODE=[ GTMA_HAVE_STORE ] statement > looks like an overly optimistic way to start a transaction in my quick view. Indeed. At some point this worked, but this may have gotten lost during one of the merges. Now, # .MEM_8 = VDEF <.MEM_7(D)> __transaction_relaxed // SUBCODE=[ ... ] Bootstrapped and tested on x86_64. Ok? r~ * tree-ssa-dce.c (propagate_necessity): Handle GIMPLE_TRANSACTION. * tree-ssa-operands.c (parse_ssa_operands): Add virtual operands for GIMPLE_TRANSACTION. Tidy if's into a switch. diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index ccdf14a..ace9ef9 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -965,6 +965,13 @@ propagate_necessity (struct edge_list *el) mark_aliased_reaching_defs_necessary (stmt, op); } } + else if (gimple_code (stmt) == GIMPLE_TRANSACTION) + { + /* The beginning of a transaction is a memory barrier. */ + /* ??? If we were really cool, we'd only be a barrier + for the memories touched within the transaction. */ + mark_all_reaching_defs_necessary (stmt); + } else gcc_unreachable (); diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 0045dd8..ed0d34d 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -1043,35 +1043,46 @@ static void parse_ssa_operands (gimple stmt) { enum gimple_code code = gimple_code (stmt); + size_t i, n, start = 0; - if (code == GIMPLE_ASM) - get_asm_expr_operands (stmt); - else if (is_gimple_debug (stmt)) + switch (code) { + case GIMPLE_ASM: + get_asm_expr_operands (stmt); + break; + + case GIMPLE_TRANSACTION: + /* The start of a transaction is a memory barrier. */ + add_virtual_operand (stmt, opf_def | opf_use); + break; + + case GIMPLE_DEBUG: if (gimple_debug_bind_p (stmt) && gimple_debug_bind_has_value_p (stmt)) get_expr_operands (stmt, gimple_debug_bind_get_value_ptr (stmt), opf_use | opf_no_vops); - } - else - { - size_t i, start = 0; + break; - if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL) - { - get_expr_operands (stmt, gimple_op_ptr (stmt, 0), opf_def); - start = 1; - } - - for (i = start; i < gimple_num_ops (stmt); i++) - get_expr_operands (stmt, gimple_op_ptr (stmt, i), opf_use); + case GIMPLE_RETURN: + append_vuse (gimple_vop (cfun)); + goto do_default; + case GIMPLE_CALL: /* Add call-clobbered operands, if needed. */ - if (code == GIMPLE_CALL) - maybe_add_call_vops (stmt); + maybe_add_call_vops (stmt); + /* FALLTHRU */ - if (code == GIMPLE_RETURN) - append_vuse (gimple_vop (cfun)); + case GIMPLE_ASSIGN: + get_expr_operands (stmt, gimple_op_ptr (stmt, 0), opf_def); + start = 1; + /* FALLTHRU */ + + default: + do_default: + n = gimple_num_ops (stmt); + for (i = start; i < n; i++) + get_expr_operands (stmt, gimple_op_ptr (stmt, i), opf_use); + break; } }