From patchwork Thu Feb 19 10:59:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 441571 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 826841401E7 for ; Thu, 19 Feb 2015 21:59:37 +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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=GyMMYfBFN6kJDPg3G pmVObLtfc3iVQGKKpUDKibzq4ASiagq2D5QmrnAZulZIEYnvQCV9zNI0/fgwLOYv 6+w4U6JDP4gfFXRulk6iOL4txTHuC//3jOgu0AZrQX1Y8ZnRDY4KroyJ+NVqOHNm bEybAY19Dlrz0fj6TbbvKcVPi4= 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 :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=uymSjHqwRDXI4GtxHSJWQly JXMg=; b=pPoLucqHYmzpjk/+jE2FH5WoV0SQy5PvEXol9diPUN6x2io+hRUo3pW +qmKZmv1eGdQ1xywYDIB2ahTHKWwL3Xge7NogrMzh8hZErTmYHwB/rdNrSlBqtlA HnbPMeKkK2faXvDSQ8IgABmeVHkGtglElHOfoj2rayOLTNH87irE= Received: (qmail 3688 invoked by alias); 19 Feb 2015 10:59:30 -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 3675 invoked by uid 89); 19 Feb 2015 10:59:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Feb 2015 10:59:28 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-02.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1YOOpI-0004C6-BT from Tom_deVries@mentor.com ; Thu, 19 Feb 2015 02:59:24 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.3.224.2; Thu, 19 Feb 2015 10:59:22 +0000 Message-ID: <54E5C208.7070903@mentor.com> Date: Thu, 19 Feb 2015 11:59:20 +0100 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Jakub Jelinek , Richard Biener CC: GCC Patches , Michael Matz Subject: [PATCH][3/5] Factor optimize_va_list_gpr_fpr_size out of pass_stdarg::execute References: <54E5BB06.2080102@mentor.com> In-Reply-To: <54E5BB06.2080102@mentor.com> On 19-02-15 11:29, Tom de Vries wrote: > Hi, > > I'm posting this patch series for stage1: > - 0001-Disable-lang_hooks.gimplify_expr-in-free_lang_data.patch > - 0002-Add-gimple_find_sub_bbs.patch > - 0003-Factor-optimize_va_list_gpr_fpr_size-out-of-pass_std.patch > - 0004-Handle-internal_fn-in-operand_equal_p.patch > - 0005-Postpone-expanding-va_arg-until-pass_stdarg.patch > > The patch series - based on Michael's initial patch - postpones expanding va_arg > until pass_stdarg, which makes pass_stdarg more robust. > > Bootstrapped and reg-tested on x86_64 using all languages, with unix/ and > unix/-m32 testing. > > I'll post the patches in reply to this email. > This patch factors optimize_va_list_gpr_fpr_size out of pass_stdarg::execute. Now that we're adding more functionality in pass_stdarg, it's cleaner and clearer to move the optimization to its own function. OK for stage1? Thanks, - Tom 2015-02-17 Tom de Vries * tree-stdarg.c (optimize_va_list_gpr_fpr_size): Factor out of ... (pass_stdarg::execute): ... here. --- gcc/tree-stdarg.c | 80 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c index 17d51a2..5eac56a 100644 --- a/gcc/tree-stdarg.c +++ b/gcc/tree-stdarg.c @@ -678,43 +678,10 @@ check_all_va_list_escapes (struct stdarg_info *si) return false; } +/* Optimize FUN->va_list_gpr_size and FUN->va_list_fpr_size. */ -namespace { - -const pass_data pass_data_stdarg = -{ - GIMPLE_PASS, /* type */ - "stdarg", /* name */ - OPTGROUP_NONE, /* optinfo_flags */ - TV_NONE, /* tv_id */ - ( PROP_cfg | PROP_ssa ), /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0, /* todo_flags_finish */ -}; - -class pass_stdarg : public gimple_opt_pass -{ -public: - pass_stdarg (gcc::context *ctxt) - : gimple_opt_pass (pass_data_stdarg, ctxt) - {} - - /* opt_pass methods: */ - virtual bool gate (function *fun) - { - return (flag_stdarg_opt - /* This optimization is only for stdarg functions. */ - && fun->stdarg != 0); - } - - virtual unsigned int execute (function *); - -}; // class pass_stdarg - -unsigned int -pass_stdarg::execute (function *fun) +static void +optimize_va_list_gpr_fpr_size (function *fun) { basic_block bb; bool va_list_escapes = false; @@ -1047,6 +1014,47 @@ finish: fprintf (dump_file, "%d", cfun->va_list_fpr_size); fputs (" FPR units.\n", dump_file); } +} + +namespace { + +const pass_data pass_data_stdarg = +{ + GIMPLE_PASS, /* type */ + "stdarg", /* name */ + OPTGROUP_NONE, /* optinfo_flags */ + TV_NONE, /* tv_id */ + ( PROP_cfg | PROP_ssa ), /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ +}; + +class pass_stdarg : public gimple_opt_pass +{ +public: + pass_stdarg (gcc::context *ctxt) + : gimple_opt_pass (pass_data_stdarg, ctxt) + {} + + /* opt_pass methods: */ + virtual bool gate (function *fun) + { + return (flag_stdarg_opt + /* This optimization is only for stdarg functions. */ + && fun->stdarg != 0); + } + + virtual unsigned int execute (function *); + +}; // class pass_stdarg + +unsigned int +pass_stdarg::execute (function *fun) +{ + optimize_va_list_gpr_fpr_size (fun); + return 0; } -- 1.9.1