From patchwork Mon Oct 27 20:41:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 403912 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 C53B3140077 for ; Tue, 28 Oct 2014 07:46:50 +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=Vb/zBcTq5wtkL2B/nUqgJ+QO3FwEHpjDMcLyhqx8FslmQS/ZkL/nB hrWazMWs1GADRosdU9xnX/4SVBP462QqYXeB+O+KLotKNkaDRFN4KjmauT7gnyE0 jTTgRDrymrBYi98g1ofgfsI2yz0/gquKnbBqFfCSvWit6Rj062vPZk= 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=xVHNM7J9eVtROc0OY5SZk419lXk=; b=XtYblisccGFxdi9qoj4J 5WQm6TJBqo3IXEDFLcZcI3X73KdIlBKp81rfwea/B0umPy9kghElMVHztQqnCGrx FqqxDt2boaRJZ2g0Y28n+0j34qlFrPNFjWHNZAZle+On0HRO9rU8esjaOM8wyWBe 1vHv7HLXjydcPtrE0x9msNI= Received: (qmail 20104 invoked by alias); 27 Oct 2014 20:38:23 -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 8824 invoked by uid 89); 27 Oct 2014 20:36:19 -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; Mon, 27 Oct 2014 20:36:17 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9RKZjYs004723 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 27 Oct 2014 16:35:45 -0400 Received: from c64.redhat.com (vpn-236-51.phx2.redhat.com [10.3.236.51]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9RKYt68021050; Mon, 27 Oct 2014 16:35:44 -0400 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [gimple-classes, committed 84/92] Concretize gimple_call_copy_flags and ipa_modify_call_arguments Date: Mon, 27 Oct 2014 16:41:22 -0400 Message-Id: <1414442490-14841-85-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1414442490-14841-1-git-send-email-dmalcolm@redhat.com> References: <1414442490-14841-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes This corresponds to: [PATCH 86/89] Concretize gimple_call_copy_flags and ipa_modify_call_arguments https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01175.html from the original 89-patch kit That earlier patch was approved by Jeff: > OK when prereqs go in. in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00855.html gcc/ * gimple.h (gimple_call_copy_flags): Require gimple_calls. * ipa-prop.c (ipa_modify_call_arguments): Require a gimple_call. * ipa-prop.h (ipa_modify_call_arguments): Likewise. * tree-inline.c (copy_bb): Replace is_gimple_call with new local and call to dyn_cast, updating gimple_call_ uses to use the type-checked local. * tree-sra.c (convert_callers): Replace check for GIMPLE_CALL with a dyn_cast. --- gcc/ChangeLog.gimple-classes | 16 ++++++++++++++++ gcc/gimple.h | 4 +--- gcc/ipa-prop.c | 2 +- gcc/ipa-prop.h | 2 +- gcc/tree-inline.c | 20 +++++++++++--------- gcc/tree-sra.c | 5 +++-- 6 files changed, 33 insertions(+), 16 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 572fe5a..9255151 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,21 @@ 2014-10-24 David Malcolm + Concretize gimple_call_copy_flags and ipa_modify_call_arguments + + * gimple.h (gimple_call_copy_flags): Require gimple_calls. + + * ipa-prop.c (ipa_modify_call_arguments): Require a gimple_call. + * ipa-prop.h (ipa_modify_call_arguments): Likewise. + + * tree-inline.c (copy_bb): Replace is_gimple_call with new local + and call to dyn_cast, updating gimple_call_ uses to + use the type-checked local. + + * tree-sra.c (convert_callers): Replace check for GIMPLE_CALL with + a dyn_cast. + +2014-10-24 David Malcolm + Concretize gimple_assign_nontemporal_move_p * gimple.h (gimple_assign_nontemporal_move_p): Require a diff --git a/gcc/gimple.h b/gcc/gimple.h index 5570c54..1722b6c 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -2948,10 +2948,8 @@ gimple_call_alloca_for_var_p (gimple_call s) /* Copy all the GF_CALL_* flags from ORIG_CALL to DEST_CALL. */ static inline void -gimple_call_copy_flags (gimple dest_call, gimple orig_call) +gimple_call_copy_flags (gimple_call dest_call, gimple_call orig_call) { - GIMPLE_CHECK (dest_call, GIMPLE_CALL); - GIMPLE_CHECK (orig_call, GIMPLE_CALL); dest_call->subcode = orig_call->subcode; } diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 5a861f8..93fda45 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -4147,7 +4147,7 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments) contain the corresponding call graph edge. */ void -ipa_modify_call_arguments (struct cgraph_edge *cs, gimple stmt, +ipa_modify_call_arguments (struct cgraph_edge *cs, gimple_call stmt, ipa_parm_adjustment_vec adjustments) { struct cgraph_node *current_node = cgraph_node::get (current_function_decl); diff --git a/gcc/ipa-prop.h b/gcc/ipa-prop.h index 7a06af9..1beec51 100644 --- a/gcc/ipa-prop.h +++ b/gcc/ipa-prop.h @@ -705,7 +705,7 @@ typedef vec ipa_parm_adjustment_vec; vec ipa_get_vector_of_formal_parms (tree fndecl); vec ipa_get_vector_of_formal_parm_types (tree fntype); void ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec); -void ipa_modify_call_arguments (struct cgraph_edge *, gimple, +void ipa_modify_call_arguments (struct cgraph_edge *, gimple_call, ipa_parm_adjustment_vec); ipa_parm_adjustment_vec ipa_combine_adjustments (ipa_parm_adjustment_vec, ipa_parm_adjustment_vec); diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index a0a299b..faa4656 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1725,10 +1725,12 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, do { tree fn; + gimple_call call_stmt; stmt = gsi_stmt (copy_gsi); - if (is_gimple_call (stmt) - && gimple_call_va_arg_pack_p (as_a (stmt)) + call_stmt = dyn_cast (stmt); + if (call_stmt + && gimple_call_va_arg_pack_p (call_stmt) && id->gimple_call) { /* __builtin_va_arg_pack () should be replaced by @@ -1743,33 +1745,33 @@ copy_bb (copy_body_data *id, basic_block bb, int frequency_scale, nargs--; /* Create the new array of arguments. */ - n = nargs + gimple_call_num_args (stmt); + n = nargs + gimple_call_num_args (call_stmt); argarray.create (n); argarray.safe_grow_cleared (n); /* Copy all the arguments before '...' */ memcpy (argarray.address (), - gimple_call_arg_ptr (stmt, 0), - gimple_call_num_args (stmt) * sizeof (tree)); + gimple_call_arg_ptr (call_stmt, 0), + gimple_call_num_args (call_stmt) * sizeof (tree)); /* Append the arguments passed in '...' */ - memcpy (argarray.address () + gimple_call_num_args (stmt), + memcpy (argarray.address () + gimple_call_num_args (call_stmt), gimple_call_arg_ptr (id->gimple_call, 0) + (gimple_call_num_args (id->gimple_call) - nargs), nargs * sizeof (tree)); - new_call = gimple_build_call_vec (gimple_call_fn (stmt), + new_call = gimple_build_call_vec (gimple_call_fn (call_stmt), argarray); argarray.release (); /* Copy all GIMPLE_CALL flags, location and block, except GF_CALL_VA_ARG_PACK. */ - gimple_call_copy_flags (new_call, stmt); + gimple_call_copy_flags (new_call, call_stmt); gimple_call_set_va_arg_pack (new_call, false); gimple_set_location (new_call, gimple_location (stmt)); gimple_set_block (new_call, gimple_block (stmt)); - gimple_call_set_lhs (new_call, gimple_call_lhs (stmt)); + gimple_call_set_lhs (new_call, gimple_call_lhs (call_stmt)); gsi_replace (©_gsi, new_call, false); stmt = new_call; diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 50464f1..81e6f93 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -4884,9 +4884,10 @@ convert_callers (struct cgraph_node *node, tree old_decl, for (gsi = gsi_start_bb (this_block); !gsi_end_p (gsi); gsi_next (&gsi)) { - gimple stmt = gsi_stmt (gsi); + gimple_call stmt; tree call_fndecl; - if (gimple_code (stmt) != GIMPLE_CALL) + stmt = dyn_cast (gsi_stmt (gsi)); + if (!stmt) continue; call_fndecl = gimple_call_fndecl (stmt); if (call_fndecl == old_decl)