From patchwork Sun Nov 4 22:32:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 197111 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 7C8812C0168 for ; Mon, 5 Nov 2012 09:32:49 +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=1352673170; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:Message-ID:Mail-Followup-To:MIME-Version: Content-Type:Content-Disposition:User-Agent:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=jHGBLMq1B5LYyb8mj3Ri24FfxiQ=; b=echr7PdokI6UQh2Pg6vXGvWSjep6QfF3v17OPil6DQpwCN67udsByh/g8M923I qZKDpXV4n4MTODrN/lA/PtvYZrAqjdlli2lui0SczF/HpamHA6To7axsfn2ofQ78 D+uknlqCEm5e8q5jio5hKUx8VRqfhB4aReG2SkEyFGEeQ= 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:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=HV1U95+F9XM1T/qQ2MzQ+S19iuZpbfpfFdOb4WRDz/N3tOGwKVjKVOAv/aAZBv UAGNdX5NOFmEgcasrwaNCdyARvOzNNW29V1gsjM+vFNeMShP+iYvgNH30q8jlyv5 Zl/IR9sh6SotiuFR7cn7mp/NktwZfdPDVGoREyB/rHxOg=; Received: (qmail 30439 invoked by alias); 4 Nov 2012 22:32:44 -0000 Received: (qmail 30430 invoked by uid 22791); 4 Nov 2012 22:32:44 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 04 Nov 2012 22:32:33 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 6D8819D938; Sun, 4 Nov 2012 23:32:32 +0100 (CET) Date: Sun, 4 Nov 2012 23:32:31 +0100 From: Martin Jambor To: GCC Patches Cc: Jan Hubicka Subject: [PATCH] Minor ipa-prop.c internal interface tweak Message-ID: <20121104223231.GB5617@virgil.arch.suse.de> Mail-Followup-To: GCC Patches , Jan Hubicka MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi, in order to use a few functions in the transformation phase of IPA-CP without computing the whole struct ipa_node_params for the current function, the following patch makes those functions (or their _1 versions) use just the vector they need. Bootstrapped and tested on x86_64-linux, needed for the aggregate IPA-CP. OK for trunk? Thanks, Martin 2012-10-31 Martin Jambor * ipa-prop.c (ipa_get_param_decl_index_1): New function. (ipa_get_param_decl_index): Just call ipa_get_param_decl_index_1. (ipa_populate_param_decls): Accept descriptors parameter rather than the whole info. (load_from_unmodified_param): Likewise. (ipa_load_from_parm_agg_1): Likewise. (ipa_load_from_parm_agg): Extract descriptors from info. (compute_complex_assign_jump_func): Likewise. (ipa_analyze_indirect_call_uses): Likewise. Index: src/gcc/ipa-prop.c =================================================================== --- src.orig/gcc/ipa-prop.c +++ src/gcc/ipa-prop.c @@ -64,25 +64,35 @@ static struct cgraph_node_hook_list *fun /* Return index of the formal whose tree is PTREE in function which corresponds to INFO. */ -int -ipa_get_param_decl_index (struct ipa_node_params *info, tree ptree) +static int +ipa_get_param_decl_index_1 (VEC (ipa_param_descriptor_t, heap) *descriptors, + tree ptree) { int i, count; - count = ipa_get_param_count (info); + count = VEC_length (ipa_param_descriptor_t, descriptors); for (i = 0; i < count; i++) - if (ipa_get_param (info, i) == ptree) + if (VEC_index (ipa_param_descriptor_t, descriptors, i).decl == ptree) return i; return -1; } -/* Populate the param_decl field in parameter descriptors of INFO that - corresponds to NODE. */ +/* Return index of the formal whose tree is PTREE in function which corresponds + to INFO. */ + +int +ipa_get_param_decl_index (struct ipa_node_params *info, tree ptree) +{ + return ipa_get_param_decl_index_1 (info->descriptors, ptree); +} + +/* Populate the param_decl field in parameter DESCRIPTORS that correspond to + NODE. */ static void ipa_populate_param_decls (struct cgraph_node *node, - struct ipa_node_params *info) + VEC (ipa_param_descriptor_t, heap) *descriptors) { tree fndecl; tree fnargs; @@ -94,8 +104,7 @@ ipa_populate_param_decls (struct cgraph_ param_num = 0; for (parm = fnargs; parm; parm = DECL_CHAIN (parm)) { - VEC_index (ipa_param_descriptor_t, - info->descriptors, param_num).decl = parm; + VEC_index (ipa_param_descriptor_t, descriptors, param_num).decl = parm; param_num++; } } @@ -132,7 +141,7 @@ ipa_initialize_node_params (struct cgrap { VEC_safe_grow_cleared (ipa_param_descriptor_t, heap, info->descriptors, param_count); - ipa_populate_param_decls (node, info); + ipa_populate_param_decls (node, info->descriptors); } } } @@ -661,7 +670,7 @@ parm_preserved_before_stmt_p (struct par modified. Otherwise return -1. */ static int -load_from_unmodified_param (struct ipa_node_params *info, +load_from_unmodified_param (VEC (ipa_param_descriptor_t, heap) *descriptors, struct param_analysis_info *parms_ainfo, gimple stmt) { @@ -675,7 +684,7 @@ load_from_unmodified_param (struct ipa_n if (TREE_CODE (op1) != PARM_DECL) return -1; - index = ipa_get_param_decl_index (info, op1); + index = ipa_get_param_decl_index_1 (descriptors, op1); if (index < 0 || !parm_preserved_before_stmt_p (parms_ainfo ? &parms_ainfo[index] : NULL, stmt, op1)) @@ -749,7 +758,7 @@ parm_ref_data_pass_through_p (struct par reference respectively. */ static bool -ipa_load_from_parm_agg_1 (struct ipa_node_params *info, +ipa_load_from_parm_agg_1 (VEC (ipa_param_descriptor_t, heap) *descriptors, struct param_analysis_info *parms_ainfo, gimple stmt, tree op, int *index_p, HOST_WIDE_INT *offset_p, bool *by_ref_p) @@ -763,7 +772,7 @@ ipa_load_from_parm_agg_1 (struct ipa_nod if (DECL_P (base)) { - int index = ipa_get_param_decl_index (info, base); + int index = ipa_get_param_decl_index_1 (descriptors, base); if (index >= 0 && parm_preserved_before_stmt_p (parms_ainfo ? &parms_ainfo[index] : NULL, stmt, op)) @@ -783,7 +792,7 @@ ipa_load_from_parm_agg_1 (struct ipa_nod if (SSA_NAME_IS_DEFAULT_DEF (TREE_OPERAND (base, 0))) { tree parm = SSA_NAME_VAR (TREE_OPERAND (base, 0)); - index = ipa_get_param_decl_index (info, parm); + index = ipa_get_param_decl_index_1 (descriptors, parm); } else { @@ -803,7 +812,7 @@ ipa_load_from_parm_agg_1 (struct ipa_nod */ gimple def = SSA_NAME_DEF_STMT (TREE_OPERAND (base, 0)); - index = load_from_unmodified_param (info, parms_ainfo, def); + index = load_from_unmodified_param (descriptors, parms_ainfo, def); } if (index >= 0 @@ -825,8 +834,8 @@ ipa_load_from_parm_agg (struct ipa_node_ tree op, int *index_p, HOST_WIDE_INT *offset_p, bool *by_ref_p) { - return ipa_load_from_parm_agg_1 (info, NULL, stmt, op, index_p, offset_p, - by_ref_p); + return ipa_load_from_parm_agg_1 (info->descriptors, NULL, stmt, op, index_p, + offset_p, by_ref_p); } /* Given that an actual argument is an SSA_NAME (given in NAME) and is a result @@ -899,13 +908,13 @@ compute_complex_assign_jump_func (struct if (SSA_NAME_IS_DEFAULT_DEF (op1)) index = ipa_get_param_decl_index (info, SSA_NAME_VAR (op1)); else - index = load_from_unmodified_param (info, parms_ainfo, + index = load_from_unmodified_param (info->descriptors, parms_ainfo, SSA_NAME_DEF_STMT (op1)); tc_ssa = op1; } else { - index = load_from_unmodified_param (info, parms_ainfo, stmt); + index = load_from_unmodified_param (info->descriptors, parms_ainfo, stmt); tc_ssa = gimple_assign_lhs (stmt); } @@ -1648,7 +1657,7 @@ ipa_analyze_indirect_call_uses (struct c def = SSA_NAME_DEF_STMT (target); if (gimple_assign_single_p (def) - && ipa_load_from_parm_agg_1 (info, parms_ainfo, def, + && ipa_load_from_parm_agg_1 (info->descriptors, parms_ainfo, def, gimple_assign_rhs1 (def), &index, &offset, &by_ref)) {