From patchwork Sun Mar 24 00:24:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 230356 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 9871C2C00B2 for ; Sun, 24 Mar 2013 11:24:43 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=clWwFRWT2LqFr8M67SKPS2dpRv2GFrh1vtIrjVd9Edg+lc2c0t xLEVhP427TUeSSyPdXwfoMaHggE0NJXyPy2iPH6uJqDHd6blbBjimexl8SqPrHFm oJujgtnfa9hYE5AGcKgnjjllcUfuJ0uXnmCdbHdSYfVO38bknir5b5wKM= 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:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=JTlkZkSZ6D2bwBnGjq3kULpOSVA=; b=LDfTKJncxOyHjwIMc4ja P/WU7KmqteqH6FEKvxF8gfd76fsTOg2wQ2DZcTRdISpjdYEpbTu2QNY9fUIN5Mlz s67KE8b5j+9ikrnFR/uFJZW8/j4UH9PVDkLfqjOG0stJG6JJCf8VG/PuFrkl4TVT Ei6wN3dPF360DU9aPdDL4VE= Received: (qmail 4224 invoked by alias); 24 Mar 2013 00:24:34 -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 4206 invoked by uid 89); 24 Mar 2013 00:24:26 -0000 X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, TW_JF autolearn=ham version=3.3.1 Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 24 Mar 2013 00:24:23 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6AD25A3E1C; Sun, 24 Mar 2013 01:24:21 +0100 (CET) Date: Sun, 24 Mar 2013 01:24:20 +0100 From: Martin Jambor To: GCC Patches Cc: Jan Hubicka Subject: [PATCH] Make ipa_read_jump_function use ipa_set_jf_* helpers Message-ID: <20130324002420.GF16552@virgil.suse> Mail-Followup-To: GCC Patches , Jan Hubicka MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi, the following patch makes ipa_read_jump_function use the helper functions to set up jump functions instead of doing it itself. The main reason is that I plan to add some less-trivial code to one of the helpers but setting the functions always in one place is a good idea anyway. Because there are two types of pass-through functions (NOP and arithmetic) with two helpers to set them up, we also stream the two in separate ways with the added benefit of streaming slightly less. Bootstrapped and tested on x86_64-linux where it also passes LTO bootstrap. OK for trunk? Thanks, Martin 2013-03-20 Martin Jambor * ipa-prop.c (ipa_write_jump_function): Stream simple and aritmetic pass-through jump functions differently. (ipa_read_jump_function): Likewise. Also use setter functions to set up jump functions. Index: src/gcc/ipa-prop.c =================================================================== --- src.orig/gcc/ipa-prop.c +++ src/gcc/ipa-prop.c @@ -3277,12 +3277,19 @@ ipa_write_jump_function (struct output_b stream_write_tree (ob, jump_func->value.constant, true); break; case IPA_JF_PASS_THROUGH: - stream_write_tree (ob, jump_func->value.pass_through.operand, true); - streamer_write_uhwi (ob, jump_func->value.pass_through.formal_id); streamer_write_uhwi (ob, jump_func->value.pass_through.operation); - bp = bitpack_create (ob->main_stream); - bp_pack_value (&bp, jump_func->value.pass_through.agg_preserved, 1); - streamer_write_bitpack (&bp); + if (jump_func->value.pass_through.operation == NOP_EXPR) + { + streamer_write_uhwi (ob, jump_func->value.pass_through.formal_id); + bp = bitpack_create (ob->main_stream); + bp_pack_value (&bp, jump_func->value.pass_through.agg_preserved, 1); + streamer_write_bitpack (&bp); + } + else + { + stream_write_tree (ob, jump_func->value.pass_through.operand, true); + streamer_write_uhwi (ob, jump_func->value.pass_through.formal_id); + } break; case IPA_JF_ANCESTOR: streamer_write_uhwi (ob, jump_func->value.ancestor.offset); @@ -3317,45 +3324,63 @@ ipa_read_jump_function (struct lto_input struct ipa_jump_func *jump_func, struct data_in *data_in) { - struct bitpack_d bp; + enum jump_func_type jftype; + enum tree_code operation; int i, count; - jump_func->type = (enum jump_func_type) streamer_read_uhwi (ib); - switch (jump_func->type) + jftype = (enum jump_func_type) streamer_read_uhwi (ib); + switch (jftype) { case IPA_JF_UNKNOWN: + jump_func->type = IPA_JF_UNKNOWN; break; case IPA_JF_KNOWN_TYPE: - jump_func->value.known_type.offset = streamer_read_uhwi (ib); - jump_func->value.known_type.base_type = stream_read_tree (ib, data_in); - jump_func->value.known_type.component_type = stream_read_tree (ib, - data_in); - break; + { + HOST_WIDE_INT offset = streamer_read_uhwi (ib); + tree base_type = stream_read_tree (ib, data_in); + tree component_type = stream_read_tree (ib, data_in); + + ipa_set_jf_known_type (jump_func, offset, base_type, component_type); + break; + } case IPA_JF_CONST: - jump_func->value.constant = stream_read_tree (ib, data_in); + ipa_set_jf_constant (jump_func, stream_read_tree (ib, data_in)); break; case IPA_JF_PASS_THROUGH: - jump_func->value.pass_through.operand = stream_read_tree (ib, data_in); - jump_func->value.pass_through.formal_id = streamer_read_uhwi (ib); - jump_func->value.pass_through.operation - = (enum tree_code) streamer_read_uhwi (ib); - bp = streamer_read_bitpack (ib); - jump_func->value.pass_through.agg_preserved = bp_unpack_value (&bp, 1); + operation = (enum tree_code) streamer_read_uhwi (ib); + if (operation == NOP_EXPR) + { + int formal_id = streamer_read_uhwi (ib); + struct bitpack_d bp = streamer_read_bitpack (ib); + bool agg_preserved = bp_unpack_value (&bp, 1); + ipa_set_jf_simple_pass_through (jump_func, formal_id, agg_preserved); + } + else + { + tree operand = stream_read_tree (ib, data_in); + int formal_id = streamer_read_uhwi (ib); + ipa_set_jf_arith_pass_through (jump_func, formal_id, operand, + operation); + } break; case IPA_JF_ANCESTOR: - jump_func->value.ancestor.offset = streamer_read_uhwi (ib); - jump_func->value.ancestor.type = stream_read_tree (ib, data_in); - jump_func->value.ancestor.formal_id = streamer_read_uhwi (ib); - bp = streamer_read_bitpack (ib); - jump_func->value.ancestor.agg_preserved = bp_unpack_value (&bp, 1); - break; + { + HOST_WIDE_INT offset = streamer_read_uhwi (ib); + tree type = stream_read_tree (ib, data_in); + int formal_id = streamer_read_uhwi (ib); + struct bitpack_d bp = streamer_read_bitpack (ib); + bool agg_preserved = bp_unpack_value (&bp, 1); + + ipa_set_ancestor_jf (jump_func, offset, type, formal_id, agg_preserved); + break; + } } count = streamer_read_uhwi (ib); vec_alloc (jump_func->agg.items, count); if (count) { - bp = streamer_read_bitpack (ib); + struct bitpack_d bp = streamer_read_bitpack (ib); jump_func->agg.by_ref = bp_unpack_value (&bp, 1); } for (i = 0; i < count; i++)