From patchwork Thu Nov 6 14:32:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 407554 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 90E531400D5 for ; Fri, 7 Nov 2014 01:44:34 +1100 (AEDT) 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=n1IO2w3rV4Qo/2E27tA4W9q6P7/6iS0Bzc0yxyTtKGoEMFINyWXb2 yImOfbG5PFuR16yp0TZBVCDbZhSZd+LF73pA5/kqeS13ZAIrm84U0Oa2xbHJisbf 1AjJERrKFiyHoiSVbCGz3UF2aonp2OXrQFAPNdxll3KLjJx7ychVxo= 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=6gay+knynZHovgJDEj/JuXW32B0=; b=AC9++meJNaV6F/ErVU2W EiKPt8ij2wY0SnwzG+NcUCkMWzSlz1xyI+VcWLsEbT+DZdxdD2qtdeEOH/MM5KAv 9vBfNFhwCunUwABrSkbMPxKLdR1rBMimgCQycxRrbC02VN37y7TU/DnIqWWNjCNm gNWO2l5MhFVzOKrAk0lPkdk= Received: (qmail 29228 invoked by alias); 6 Nov 2014 14:37:37 -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 29169 invoked by uid 89); 6 Nov 2014 14:37:36 -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, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 06 Nov 2014 14:37:35 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA6Eb2ap026951 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 6 Nov 2014 09:37:02 -0500 Received: from surprise.redhat.com (vpn-235-14.phx2.redhat.com [10.3.235.14]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sA6Eag88016497; Thu, 6 Nov 2014 09:37:01 -0500 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [gimple-classes, committed 30/44] gimple-walk.c: Use gassign Date: Thu, 6 Nov 2014 09:32:06 -0500 Message-Id: <1415284340-14186-31-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1415284340-14186-1-git-send-email-dmalcolm@redhat.com> References: <1415284340-14186-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes gcc/ChangeLog.gimple-classes: * gimple-walk.c (walk_gimple_op): Within case GIMPLE_ASSIGN, introduce local gassign * "assign_stmt" and use it in place of "stmt" for typesafety. --- gcc/ChangeLog.gimple-classes | 6 ++++ gcc/gimple-walk.c | 74 +++++++++++++++++++++++--------------------- 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 9b455c3..8e18adc 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,11 @@ 2014-11-03 David Malcolm + * gimple-walk.c (walk_gimple_op): Within case GIMPLE_ASSIGN, + introduce local gassign * "assign_stmt" and use it in place of + "stmt" for typesafety. + +2014-11-03 David Malcolm + * tree-ssa-dse.c (dse_optimize_stmt): Add checked cast. Replace is_gimple_assign with dyn_cast, introducing local gassign * "assign_stmt", using it in place of "stmt" for typesafety. diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c index 9a800e2..d74e66a 100644 --- a/gcc/gimple-walk.c +++ b/gcc/gimple-walk.c @@ -195,46 +195,50 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op, switch (gimple_code (stmt)) { case GIMPLE_ASSIGN: - /* Walk the RHS operands. If the LHS is of a non-renamable type or - is a register variable, we may use a COMPONENT_REF on the RHS. */ - if (wi) - { - tree lhs = gimple_assign_lhs (stmt); - wi->val_only - = (is_gimple_reg_type (TREE_TYPE (lhs)) && !is_gimple_reg (lhs)) - || gimple_assign_rhs_class (stmt) != GIMPLE_SINGLE_RHS; - } + { + gassign *assign_stmt = as_a (stmt); - for (i = 1; i < gimple_num_ops (stmt); i++) - { - ret = walk_tree (gimple_op_ptr (stmt, i), callback_op, wi, - pset); - if (ret) - return ret; - } + /* Walk the RHS operands. If the LHS is of a non-renamable type or + is a register variable, we may use a COMPONENT_REF on the RHS. */ + if (wi) + { + tree lhs = gimple_assign_lhs (assign_stmt); + wi->val_only + = (is_gimple_reg_type (TREE_TYPE (lhs)) && !is_gimple_reg (lhs)) + || gimple_assign_rhs_class (assign_stmt) != GIMPLE_SINGLE_RHS; + } - /* Walk the LHS. If the RHS is appropriate for a memory, we - may use a COMPONENT_REF on the LHS. */ - if (wi) - { - /* If the RHS is of a non-renamable type or is a register variable, - we may use a COMPONENT_REF on the LHS. */ - tree rhs1 = gimple_assign_rhs1 (stmt); - wi->val_only - = (is_gimple_reg_type (TREE_TYPE (rhs1)) && !is_gimple_reg (rhs1)) - || gimple_assign_rhs_class (stmt) != GIMPLE_SINGLE_RHS; - wi->is_lhs = true; + for (i = 1; i < gimple_num_ops (assign_stmt); i++) + { + ret = walk_tree (gimple_op_ptr (assign_stmt, i), callback_op, wi, + pset); + if (ret) + return ret; + } + + /* Walk the LHS. If the RHS is appropriate for a memory, we + may use a COMPONENT_REF on the LHS. */ + if (wi) + { + /* If the RHS is of a non-renamable type or is a register variable, + we may use a COMPONENT_REF on the LHS. */ + tree rhs1 = gimple_assign_rhs1 (assign_stmt); + wi->val_only + = (is_gimple_reg_type (TREE_TYPE (rhs1)) && !is_gimple_reg (rhs1)) + || gimple_assign_rhs_class (assign_stmt) != GIMPLE_SINGLE_RHS; + wi->is_lhs = true; } - ret = walk_tree (gimple_op_ptr (stmt, 0), callback_op, wi, pset); - if (ret) - return ret; + ret = walk_tree (gimple_op_ptr (assign_stmt, 0), callback_op, wi, pset); + if (ret) + return ret; - if (wi) - { - wi->val_only = true; - wi->is_lhs = false; - } + if (wi) + { + wi->val_only = true; + wi->is_lhs = false; + } + } break; case GIMPLE_CALL: