From patchwork Thu May 7 21:38:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 469802 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 5981414012C for ; Fri, 8 May 2015 07:39:56 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=gmMol4yI; 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:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=E1f3AecDEJjp/rAz5u3OL1XGs7fbH7cAXIYoT5mYRzumbJQkpVpxz b7C7/+J/2dtH0pPbNVpNPtnfK0edUG/Hc1CMg8ZMMGdXOchhxfWQGJkgx5cx9e4d VUspeJPFEf2WXEtAt5Vrx1USPnwKMmwXf41SvNRI46IIqveieJhxko= 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:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=Ukhr4EX+V1xbfDyC5kZbnZ4jrBU=; b=gmMol4yIFi6NrMww3LLR gEUuc1aRuDPSy9ifk4gDxPltawy6ba5m97CBYryyHFj+3/L6kZWQyGUN5ri92qog eKeYkm5SNx6Imuxy2AEdPl9cUzI1s0sfXupWl1XO4HJsR9m8QEAKYZhiY/E3QQkQ Sn6MZSZE1tPv98/gzXDOtQM= Received: (qmail 86743 invoked by alias); 7 May 2015 21:39:12 -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 86584 invoked by uid 89); 7 May 2015 21:39:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f178.google.com Received: from mail-pd0-f178.google.com (HELO mail-pd0-f178.google.com) (209.85.192.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 07 May 2015 21:39:10 +0000 Received: by pdea3 with SMTP id a3so52169828pde.3 for ; Thu, 07 May 2015 14:39:08 -0700 (PDT) X-Received: by 10.68.205.67 with SMTP id le3mr1131916pbc.94.1431034748629; Thu, 07 May 2015 14:39:08 -0700 (PDT) Received: from anchor.twiddle.net (50-194-63-110-static.hfc.comcastbusiness.net. [50.194.63.110]) by mx.google.com with ESMTPSA id ph4sm3091291pdb.43.2015.05.07.14.39.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2015 14:39:07 -0700 (PDT) From: Richard Henderson To: gcc-patches@gcc.gnu.org Cc: law@redhat.com, peterz@infradead.org, hpa@zytor.com, torvalds@linux-foundation.org, jakub@redhat.com Subject: [PATCH 3/6] Canonicalize asm volatility earlier Date: Thu, 7 May 2015 14:38:57 -0700 Message-Id: <1431034740-5375-4-git-send-email-rth@redhat.com> In-Reply-To: <1431034740-5375-1-git-send-email-rth@redhat.com> References: <1431034740-5375-1-git-send-email-rth@redhat.com> X-IsSubscribed: yes If gimple_asm_volatile_p is correct, no point re-checking. This is also done by the C and C++ front ends, but not Ada. So we can't yet trust ASM_VOLATILE_P from the front end. --- gcc/cfgexpand.c | 11 +++-------- gcc/gimplify.c | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index a5de512..fbd2101 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2587,8 +2587,6 @@ expand_asm_stmt (gasm *stmt) for (i = 0; i < noutputs; ++i) orig_outputs[i] = TREE_VALUE (gimple_asm_output_op (stmt, i)); - bool vol = gimple_asm_volatile_p (stmt); - rtvec argvec, constraintvec, labelvec; rtx body; int ninout; @@ -2603,10 +2601,6 @@ expand_asm_stmt (gasm *stmt) int old_generating_concat_p = generating_concat_p; rtx_code_label *fallthru_label = NULL; - /* An ASM with no outputs needs to be treated as volatile, for now. */ - if (noutputs == 0) - vol = 1; - if (! check_operand_nalternatives (outputs, inputs)) return; @@ -2815,7 +2809,7 @@ expand_asm_stmt (gasm *stmt) empty_string, 0, argvec, constraintvec, labelvec, locus); - MEM_VOLATILE_P (body) = vol; + MEM_VOLATILE_P (body) = gimple_asm_volatile_p (stmt); /* Eval the inputs and put them into ARGVEC. Put their constraints into ASM_INPUTs and store in CONSTRAINTS. */ @@ -2964,7 +2958,8 @@ expand_asm_stmt (gasm *stmt) ggc_strdup (constraints[i]), i, argvec, constraintvec, labelvec, locus)); - MEM_VOLATILE_P (SET_SRC (XVECEXP (body, 0, i))) = vol; + MEM_VOLATILE_P (SET_SRC (XVECEXP (body, 0, i))) + = gimple_asm_volatile_p (stmt); } /* If there are no outputs (but there are some clobbers) diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 9ce3dd9..623d33d 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5272,7 +5272,7 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) stmt = gimple_build_asm_vec (TREE_STRING_POINTER (ASM_STRING (expr)), inputs, outputs, clobbers, labels); - gimple_asm_set_volatile (stmt, ASM_VOLATILE_P (expr)); + gimple_asm_set_volatile (stmt, ASM_VOLATILE_P (expr) || noutputs == 0); gimple_asm_set_input (stmt, ASM_INPUT_P (expr)); gimplify_seq_add_stmt (pre_p, stmt);