From patchwork Thu Jun 25 13:21:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 488452 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 2EAC41402DE for ; Thu, 25 Jun 2015 23:21:31 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=shnocJui; dkim-atps=neutral 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:subject:content-type; q= dns; s=default; b=oMZ5ZPYGXnnkBcq3b+DXHmx3/3nvigWJjasVrVx2MhKPM1 voezY1c/XMqjcZ+gbQwyq60gf7oF4REaW/zjG1ajdtBYNMZ1O1RiC+nnZOMcZ+te 54e6Kdip3sqGqKqOQrTCOFLVb1YI/ZEew7RKVP0qkqw16mFyqFUCaOoPQ6nNg= 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:subject:content-type; s= default; bh=rIH6FFrgKLBIs69CWjY4ZFOn/Ns=; b=shnocJuiaEoLj0n+0qjm 5yXV2dHsKoXxn5tkqck7ZKvNtaDwL3KCq/8hLZeVOM0oE71wioID1dijEFn25T8u dK+4K6cbUxY68dQS27uvNfaoqj6wobETxeBCKWwypp0zONWU6srrRFHOGsRNgfgv WIvLDuOayZT8bDCyiGBtZEk= Received: (qmail 97755 invoked by alias); 25 Jun 2015 13:21:24 -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 97743 invoked by uid 89); 25 Jun 2015 13:21:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no 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, 25 Jun 2015 13:21:21 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id E84083627C5 for ; Thu, 25 Jun 2015 13:21:19 +0000 (UTC) Received: from [10.10.51.143] (unused [10.10.51.143] (may be forged)) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t5PDLITT015059 for ; Thu, 25 Jun 2015 09:21:19 -0400 Message-ID: <558C004E.2070809@redhat.com> Date: Thu, 25 Jun 2015 09:21:18 -0400 From: Andrew MacLeod User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: gcc-patches Subject: [patch 2/4] Remove tm.h and options.h as dependencies for function.h X-IsSubscribed: yes This patch finally removes tm.h as a compile dependency for function.h struct incoming_args was declared in function.h, and had an instance of CUMULATIVE_ARGS from tm.h The only consumer of incoming_args is rtl-data which is now located in emit-rtl.h, so I moved the decl to there. The remaining dependencies were pointers to CUMULATIVE_ARGS being used as parameters to 2 functions pass_by_reference and reference_callee_copied. I moved these 2 functions to calls.[ch]. The vast majority of consumers are in the backend, and already include/need calls.h, so it seemed a sensible location. This allows tm.h and hard-reg-set.h to be removed from cfgloop.h. On my flattened branch, compiler back-end files requiring hard-reg-set.h dropped from 270ish to 98, and it ought to have a decent impact on the front end files when I get to them. Bootstraps on x86_64-unknown-linux-gnu with no new regressions. Also builds stage 1 on all the targets in config-list.mk. OK for trunk? Andrew * function.h (struct incoming_args): Move struct. (pass_by_reference, reference_callee_copied): Remove prototypes. * emit-rtl.h (struct incoming_args): Relocate struct here. * calls.h (pass_by_reference, reference_callee_copied): Relocate prototypes here. * function.c (pass_by_reference, reference_callee_copied): Move. * calls.c (pass_by_reference, reference_callee_copied): Relocate here. * cfgloop.h: Don't include tm.h or hard-reg-set.h. * ipa-chkp.c: Include calls.h. * ada/gcc-interface/misc.c: Include calls.h not function.h. * c-family/cilk.c: Move calls.h after tm.h in the include chain. Index: function.h =================================================================== *** function.h (revision 224602) --- function.h (working copy) *************** struct GTY(()) varasm_status { *** 169,202 **** unsigned int deferred_constants; }; - /* Information mainlined about RTL representation of incoming arguments. */ - struct GTY(()) incoming_args { - /* Number of bytes of args popped by function being compiled on its return. - Zero if no bytes are to be popped. - May affect compilation of return insn or of function epilogue. */ - int pops_args; - - /* If function's args have a fixed size, this is that size, in bytes. - Otherwise, it is -1. - May affect compilation of return insn or of function epilogue. */ - int size; - - /* # bytes the prologue should push and pretend that the caller pushed them. - The prologue must do this, but only if parms can be passed in - registers. */ - int pretend_args_size; - - /* This is the offset from the arg pointer to the place where the first - anonymous arg can be found, if there is one. */ - rtx arg_offset_rtx; - - /* Quantities of various kinds of registers - used for the current function's args. */ - CUMULATIVE_ARGS info; - - /* The arg pointer hard register, or the pseudo into which it was copied. */ - rtx internal_arg_pointer; - }; /* Data for function partitioning. */ struct GTY(()) function_subsections { --- 169,174 ---- *************** extern bool initial_value_entry (int i, *** 610,619 **** extern void instantiate_decl_rtl (rtx x); extern int aggregate_value_p (const_tree, const_tree); extern bool use_register_for_decl (const_tree); - extern bool pass_by_reference (CUMULATIVE_ARGS *, machine_mode, - tree, bool); - extern bool reference_callee_copied (CUMULATIVE_ARGS *, machine_mode, - tree, bool); extern gimple_seq gimplify_parameters (void); extern void locate_and_pad_parm (machine_mode, tree, int, int, int, tree, struct args_size *, --- 582,587 ---- Index: emit-rtl.h =================================================================== *** emit-rtl.h (revision 224602) --- emit-rtl.h (working copy) *************** along with GCC; see the file COPYING3. *** 23,28 **** --- 23,58 ---- struct temp_slot; typedef struct temp_slot *temp_slot_p; + /* Information mainlined about RTL representation of incoming arguments. */ + struct GTY(()) incoming_args { + /* Number of bytes of args popped by function being compiled on its return. + Zero if no bytes are to be popped. + May affect compilation of return insn or of function epilogue. */ + int pops_args; + + /* If function's args have a fixed size, this is that size, in bytes. + Otherwise, it is -1. + May affect compilation of return insn or of function epilogue. */ + int size; + + /* # bytes the prologue should push and pretend that the caller pushed them. + The prologue must do this, but only if parms can be passed in + registers. */ + int pretend_args_size; + + /* This is the offset from the arg pointer to the place where the first + anonymous arg can be found, if there is one. */ + rtx arg_offset_rtx; + + /* Quantities of various kinds of registers + used for the current function's args. */ + CUMULATIVE_ARGS info; + + /* The arg pointer hard register, or the pseudo into which it was copied. */ + rtx internal_arg_pointer; + }; + + /* Datastructures maintained for currently processed function in RTL form. */ struct GTY(()) rtl_data { struct expr_status expr; Index: calls.h =================================================================== *** calls.h (revision 224602) --- calls.h (working copy) *************** extern bool shift_return_value (machine_ *** 32,37 **** --- 32,42 ---- extern rtx expand_call (tree, rtx, int); extern void fixup_tail_calls (void); + extern bool pass_by_reference (CUMULATIVE_ARGS *, machine_mode, + tree, bool); + extern bool reference_callee_copied (CUMULATIVE_ARGS *, machine_mode, + tree, bool); + #endif // GCC_CALLS_H Index: function.c =================================================================== *** function.c (revision 224602) --- function.c (working copy) *************** use_register_for_decl (const_tree decl) *** 2169,2217 **** return true; } - /* Return true if TYPE should be passed by invisible reference. */ - - bool - pass_by_reference (CUMULATIVE_ARGS *ca, machine_mode mode, - tree type, bool named_arg) - { - if (type) - { - /* If this type contains non-trivial constructors, then it is - forbidden for the middle-end to create any new copies. */ - if (TREE_ADDRESSABLE (type)) - return true; - - /* GCC post 3.4 passes *all* variable sized types by reference. */ - if (!TYPE_SIZE (type) || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) - return true; - - /* If a record type should be passed the same as its first (and only) - member, use the type and mode of that member. */ - if (TREE_CODE (type) == RECORD_TYPE && TYPE_TRANSPARENT_AGGR (type)) - { - type = TREE_TYPE (first_field (type)); - mode = TYPE_MODE (type); - } - } - - return targetm.calls.pass_by_reference (pack_cumulative_args (ca), mode, - type, named_arg); - } - - /* Return true if TYPE, which is passed by reference, should be callee - copied instead of caller copied. */ - - bool - reference_callee_copied (CUMULATIVE_ARGS *ca, machine_mode mode, - tree type, bool named_arg) - { - if (type && TREE_ADDRESSABLE (type)) - return false; - return targetm.calls.callee_copies (pack_cumulative_args (ca), mode, type, - named_arg); - } - /* Structures to communicate between the subroutines of assign_parms. The first holds data persistent across all parameters, the second is cleared out for each parameter. */ --- 2169,2174 ---- Index: calls.c =================================================================== *** calls.c (revision 224602) --- calls.c (working copy) *************** call_expr_flags (const_tree t) *** 858,863 **** --- 858,907 ---- return flags; } + /* Return true if TYPE should be passed by invisible reference. */ + + bool + pass_by_reference (CUMULATIVE_ARGS *ca, machine_mode mode, + tree type, bool named_arg) + { + if (type) + { + /* If this type contains non-trivial constructors, then it is + forbidden for the middle-end to create any new copies. */ + if (TREE_ADDRESSABLE (type)) + return true; + + /* GCC post 3.4 passes *all* variable sized types by reference. */ + if (!TYPE_SIZE (type) || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST) + return true; + + /* If a record type should be passed the same as its first (and only) + member, use the type and mode of that member. */ + if (TREE_CODE (type) == RECORD_TYPE && TYPE_TRANSPARENT_AGGR (type)) + { + type = TREE_TYPE (first_field (type)); + mode = TYPE_MODE (type); + } + } + + return targetm.calls.pass_by_reference (pack_cumulative_args (ca), mode, + type, named_arg); + } + + /* Return true if TYPE, which is passed by reference, should be callee + copied instead of caller copied. */ + + bool + reference_callee_copied (CUMULATIVE_ARGS *ca, machine_mode mode, + tree type, bool named_arg) + { + if (type && TREE_ADDRESSABLE (type)) + return false; + return targetm.calls.callee_copies (pack_cumulative_args (ca), mode, type, + named_arg); + } + + /* Precompute all register parameters as described by ARGS, storing values into fields within the ARGS array. Index: cfgloop.h =================================================================== *** cfgloop.h (revision 224602) --- cfgloop.h (working copy) *************** along with GCC; see the file COPYING3. *** 22,29 **** #include "bitmap.h" #include "sbitmap.h" - #include "tm.h" - #include "hard-reg-set.h" #include "function.h" #include "cfgloopmanip.h" --- 22,27 ---- Index: ipa-chkp.c =================================================================== *** ipa-chkp.c (revision 224602) --- ipa-chkp.c (working copy) *************** along with GCC; see the file COPYING3. *** 34,39 **** --- 34,40 ---- #include "tm.h" #include "hard-reg-set.h" #include "function.h" + #include "calls.h" #include "tree-ssa-alias.h" #include "predict.h" #include "basic-block.h" Index: ada/gcc-interface/misc.c =================================================================== *** ada/gcc-interface/misc.c (revision 224602) --- ada/gcc-interface/misc.c (working copy) *************** *** 48,54 **** #include "plugin.h" #include "hashtab.h" #include "hard-reg-set.h" ! #include "function.h" /* For pass_by_reference. */ #include "dwarf2out.h" #include "ada.h" --- 48,54 ---- #include "plugin.h" #include "hashtab.h" #include "hard-reg-set.h" ! #include "calls.h" /* For pass_by_reference. */ #include "dwarf2out.h" #include "ada.h" Index: c-family/cilk.c =================================================================== *** c-family/cilk.c (revision 224602) --- c-family/cilk.c (working copy) *************** along with GCC; see the file COPYING3. *** 29,35 **** #include "tree.h" #include "fold-const.h" #include "stringpool.h" - #include "calls.h" #include "langhooks.h" #include "gimple-expr.h" #include "gimplify.h" --- 29,34 ---- *************** along with GCC; see the file COPYING3. *** 41,46 **** --- 40,46 ---- #include "tm.h" #include "hard-reg-set.h" #include "function.h" + #include "calls.h" #include "ipa-ref.h" #include "cgraph.h" #include "diagnostic.h"