From patchwork Fri Jul 14 17:00:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 788643 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 3x8Jqb1HvZz9s76 for ; Sat, 15 Jul 2017 03:01:14 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="EL5BoTa8"; 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=LNlAnVX1+tzIZZMkg 3sfvLQ30RzslRXGPnQu1lUvg+O3IVmJn3OigXhOSjIyUumUwwymPciByqrkR9ZHQ kyuWyVXSBxosX4ZOcScUmIe7ciiBJl/3gz4Cv/55PmjVCEcDxXiNOc3ezKLw8hkc i+0BehRaV8D5MyalLIV0yVa+Js= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=AdHJdXMrSwOepWBZ+pmNDpi qT6Y=; b=EL5BoTa8FAsRDcC3fLrLnJso/Lz9iBOput1brI00xFSZpROJzj+KmUA SFGModSIZwBwPKlxJQ0RxoYQe2HU9+gdMJA1hKv7lJX3zCIR3Uvqm7DNrfoIVG+W wWm4kiFoiEpFVy1XAWbS57tqmuu8zuQIbCqTrPOw+L7AEiiGaZu8= Received: (qmail 97089 invoked by alias); 14 Jul 2017 17:01:06 -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 96944 invoked by uid 89); 14 Jul 2017 17:00:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-15.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-io0-f169.google.com Received: from mail-io0-f169.google.com (HELO mail-io0-f169.google.com) (209.85.223.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 14 Jul 2017 17:00:54 +0000 Received: by mail-io0-f169.google.com with SMTP id z62so17543660ioi.3 for ; Fri, 14 Jul 2017 10:00:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to; bh=xAxJN7okTo3toDzLS25tH+KfvlHo5F6PLdGMxB1Y30k=; b=QYd2ueyxTQVuR5/EMWgIgShFD06XvLxeQmWB785SHTj+lSPWXUD01uNQwyopFolWuo iOIjNeZCnGenbmYn8He5ijVc2T7l0xVKTTvk1WERypEjb0ptZZKEU2PHvoEtf5wsAJDp X1XSxTFucIQQe36cEIs8khcdpItTTwJCzNOqZHdHKlBX5FTHiMDj/V6fFgm456+7XsYA AEqpyYbgWUei6mE6a3kUFzafZUhy5jlDoxubAnJW1OcoqCW8vAoy+Y3siKPXagkKqvzA aHzeNt8QHiELamRsB9bRnbs9krGnGfbYidrVnB/w8jAqyHLwE10UNv7EMd5OjtqX3t9Y pIyA== X-Gm-Message-State: AIVw110Cpq6ELCrphXB19ThuXNiDMrmDrxw1FH4rYUoVU6Xt1ZXPrsLu +aYZE3dxNPtWHA== X-Received: by 10.107.8.14 with SMTP id 14mr8929147ioi.197.1500051648124; Fri, 14 Jul 2017 10:00:48 -0700 (PDT) Received: from [100.64.209.104] (public-120-7.nat.utoronto.ca. [138.51.120.7]) by smtp.googlemail.com with ESMTPSA id e77sm5071480ioi.32.2017.07.14.10.00.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jul 2017 10:00:47 -0700 (PDT) Subject: Re: [PATCH] Kill TYPE_METHODS misc 7/9 To: GCC Patches References: <8377f2cd-577c-60b2-63ac-f2619ebe63aa@acm.org> Cc: Jason Merrill , Richard Guenther , Jim Wilson , Jan Hubicka From: Nathan Sidwell Message-ID: Date: Fri, 14 Jul 2017 13:00:46 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <8377f2cd-577c-60b2-63ac-f2619ebe63aa@acm.org> This bit removes knowledge of TYPE_METHODS from the various tree dumpers, allocators and deleters. As mentioned before, the only reason we set TYPE_METHODS to error_mark_node when handing over to the middle end is for the RTL check about register allocation. But I'm deleting that check. nathan Index: gcc/tree-dump.c =================================================================== --- gcc/tree-dump.c (revision 250160) +++ gcc/tree-dump.c (working copy) @@ -490,7 +490,6 @@ dequeue_and_dump (dump_info_p di) dump_string_field (di, "tag", "union"); dump_child ("flds", TYPE_FIELDS (t)); - dump_child ("fncs", TYPE_METHODS (t)); queue_and_dump_index (di, "binf", TYPE_BINFO (t), DUMP_BINFO); break; Index: gcc/tree-pretty-print.c =================================================================== --- gcc/tree-pretty-print.c (revision 250160) +++ gcc/tree-pretty-print.c (working copy) @@ -1860,22 +1860,9 @@ dump_generic_node (pretty_printer *pp, t dump_decl_name (pp, node, flags); else if (TYPE_NAME (TREE_TYPE (node)) != node) { - if ((TREE_CODE (TREE_TYPE (node)) == RECORD_TYPE - || TREE_CODE (TREE_TYPE (node)) == UNION_TYPE) - && TYPE_METHODS (TREE_TYPE (node))) - { - /* The type is a c++ class: all structures have at least - 4 methods. */ - pp_string (pp, "class "); - dump_generic_node (pp, TREE_TYPE (node), spc, flags, false); - } - else - { - pp_string (pp, - (TREE_CODE (TREE_TYPE (node)) == UNION_TYPE + pp_string (pp, (TREE_CODE (TREE_TYPE (node)) == UNION_TYPE ? "union" : "struct ")); - dump_generic_node (pp, TREE_TYPE (node), spc, flags, false); - } + dump_generic_node (pp, TREE_TYPE (node), spc, flags, false); } else pp_string (pp, ""); Index: gcc/tree.c =================================================================== --- gcc/tree.c (revision 250160) +++ gcc/tree.c (working copy) @@ -5221,13 +5221,15 @@ free_lang_data_in_type (tree type) if (TYPE_VFIELD (type) && TREE_CODE (TYPE_VFIELD (type)) != FIELD_DECL) TYPE_VFIELD (type) = NULL_TREE; - /* Remove TYPE_METHODS list. While it would be nice to keep it - to enable ODR warnings about different method lists, doing so - seems to impractically increase size of LTO data streamed. - Keep the information if TYPE_METHODS was non-NULL. This is used - by function.c and pretty printers. */ - if (TYPE_METHODS (type)) - TYPE_METHODS (type) = error_mark_node; + /* Splice out FUNCTION_DECLS and TEMPLATE_DECLS from + TYPE_FIELDS. So LTO doesn't grow. */ + for (tree probe, *prev= &TYPE_FIELDS (type); (probe = *prev); ) + if (TREE_CODE (probe) == FUNCTION_DECL + || TREE_CODE (probe) == TEMPLATE_DECL) + *prev = probe; + else + prev = &DECL_CHAIN (probe); + if (TYPE_BINFO (type)) { free_lang_data_in_binfo (TYPE_BINFO (type)); @@ -5422,9 +5424,10 @@ free_lang_data_in_decl (tree decl) At this point, it is not needed anymore. */ DECL_SAVED_TREE (decl) = NULL_TREE; - /* Clear the abstract origin if it refers to a method. Otherwise - dwarf2out.c will ICE as we clear TYPE_METHODS and thus the - origin will not be output correctly. */ + /* Clear the abstract origin if it refers to a method. + Otherwise dwarf2out.c will ICE as we splice functions out of + TYPE_FIELDS and thus the origin will not be output + correctly. */ if (DECL_ABSTRACT_ORIGIN (decl) && DECL_CONTEXT (DECL_ABSTRACT_ORIGIN (decl)) && RECORD_OR_UNION_TYPE_P @@ -6692,12 +6695,6 @@ build_distinct_type_copy (tree type MEM_ TYPE_MAIN_VARIANT (t) = t; TYPE_NEXT_VARIANT (t) = 0; - /* We do not record methods in type copies nor variants - so we do not need to keep them up to date when new method - is inserted. */ - if (RECORD_OR_UNION_TYPE_P (t)) - TYPE_METHODS (t) = NULL_TREE; - /* Note that it is now possible for TYPE_MIN_VALUE to be a value whose TREE_TYPE is not t. This can also happen in the Ada frontend when using subtypes. */ @@ -13423,8 +13420,6 @@ verify_type_variant (const_tree t, tree - aggregates may have new TYPE_FIELDS list that list variants of the main variant TYPE_FIELDS. - vector types may differ by TYPE_VECTOR_OPAQUE - - TYPE_METHODS is always NULL for variant types and maintained for - main variant only. */ /* Convenience macro for matching individual fields. */ @@ -13525,12 +13520,6 @@ verify_type_variant (const_tree t, tree } if (TREE_CODE (t) == METHOD_TYPE) verify_variant_match (TYPE_METHOD_BASETYPE); - if (RECORD_OR_UNION_TYPE_P (t) && TYPE_METHODS (t)) - { - error ("type variant has TYPE_METHODS"); - debug_tree (tv); - return false; - } if (TREE_CODE (t) == OFFSET_TYPE) verify_variant_match (TYPE_OFFSET_BASETYPE); if (TREE_CODE (t) == ARRAY_TYPE) @@ -14042,14 +14031,6 @@ verify_type (const_tree t) /* Check various uses of TYPE_MAXVAL. */ if (RECORD_OR_UNION_TYPE_P (t)) { - if (TYPE_METHODS (t) && TREE_CODE (TYPE_METHODS (t)) != FUNCTION_DECL - && TREE_CODE (TYPE_METHODS (t)) != TEMPLATE_DECL - && TYPE_METHODS (t) != error_mark_node) - { - error ("TYPE_METHODS is not FUNCTION_DECL, TEMPLATE_DECL nor error_mark_node"); - debug_tree (TYPE_METHODS (t)); - error_found = true; - } } else if (TREE_CODE (t) == FUNCTION_TYPE || TREE_CODE (t) == METHOD_TYPE) { @@ -14188,6 +14169,8 @@ verify_type (const_tree t) ; else if (TREE_CODE (fld) == USING_DECL) ; + else if (TREE_CODE (fld) == FUNCTION_DECL) + ; else { error ("Wrong tree in TYPE_FIELDS list");