From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16595 invoked by alias); 16 Feb 2015 20:46:32 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 16580 invoked by uid 89); 16 Feb 2015 20:46:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham 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; Mon, 16 Feb 2015 20:46:30 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1GKkTrA029823 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 16 Feb 2015 15:46:29 -0500 Received: from reynosa.quesejoda.com (vpn-63-211.rdu2.redhat.com [10.10.63.211]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1GKkRld016698; Mon, 16 Feb 2015 15:46:28 -0500 Message-ID: <54E25723.4010302@redhat.com> Date: Mon, 16 Feb 2015 20:46:00 -0000 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Jason Merrill CC: Richard Biener , gcc-patches Subject: Re: [debug-early] C++ clones and limbo DIEs References: <54B87E5B.1090502@redhat.com> <54B88149.1040906@redhat.com> <54B94F4D.4040009@redhat.com> <54B97854.7040007@redhat.com> <54C296B5.4050506@redhat.com> <54C7FA41.8010903@redhat.com> <54C92A59.4070401@redhat.com> <54C92A80.80306@redhat.com> <54C92FA8.9040005@redhat.com> <54CBEB69.3000401@redhat.com> <54CBFFE7.1010003@redhat.com> <54CC1885.5010105@redhat.com> <54CDC625.8070902@redhat.com> <54CEEBD5.7090608@redhat.com> <54CEF9FE.6020107@redhat.com> <54D2B907.1040309@redhat.com> <54D3CE5A.1000609@redhat.com> <54D4159F.4090601@redhat.com> <54D4C95D.8040000@redhat.com> <54D4EEDC.1070307@redhat.com> <54DCEB15.4030904@redhat.com> <54DCFEA3.3020801@redhat.com> In-Reply-To: <54DCFEA3.3020801@redhat.com> Content-Type: multipart/mixed; boundary="------------040501070901080201090606" X-SW-Source: 2015-02/txt/msg00981.txt.bz2 This is a multi-part message in MIME format. --------------040501070901080201090606 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 3358 On 02/12/2015 11:27 AM, Jason Merrill wrote: > On 02/12/2015 01:04 PM, Aldy Hernandez wrote: >> On 02/10/2015 02:52 AM, Richard Biener wrote: >>> On Fri, Feb 6, 2015 at 5:42 PM, Aldy Hernandez wrote: >> >>> Of course I wonder why you need to separate handling of functions and >>> variables >> >> The variables need to be handled earlier, else the call to >> analyze_functions() will remove some optimized global variables away, >> and we'll never see them. I believe that Jason said they were needed >> up-thread. >> >>> variables. What breaks if you emit debug info for functions before >>> the first analyze_functions () call? >> > >> > I also wonder why you restrict it to functions with a GIMPLE body. >> >> The functions, on the other hand, need to be handled after the second >> call to analyze_function (and with a GIMPLE body) else we get far more >> function DIEs than mainline currently does, especially wrt C++ clones. >> Otherwise, we get DIEs for base constructors, complete constructors, and >> what-have-yous. Jason wanted less DIEs, more attune to what mainline is >> currently doing. > > I think it makes sense to generate DIEs for everything defined in the TU > if we don't have -feliminate-unused-debug-symbols. But since clones are > artificial, emit them only if they're used. Ok, just so we're on the same page. I'm thinking that for -fNO-eliminate-unused-debug-symbols, we can iterate through FOR_EACH_DEFINED_FUNCTION before unreachable functions have been removed. There we can output all non-clones. Then for the -feliminate-unused-debug-symbols case, we can output reachable functions after the unreachable ones have been removed. Here we can also dump the clones we ignored for -fNO-eliminate-unused-debug-symbols above, since we only want to emit them if they're reachable (regardless of -feliminate-unused-debug-symbols). In either case, we always ignore those without a gimple body, otherwise we end up generating DIEs for the _ZN1AC2Ei constructor in the attached function unnecessarily. See how the bits end up in the attached testcase: (Oh, and we determine clonehood with DECL_ABSTRACT_ORIGIN) Before any calls to analyze_functions() --------------------------------------- Function: 'int main()' (Mangled: main) gimple_body=1 DECL_ABSTRACT_ORIGIN=0 Function: 'A::A(int)' (Mangled: _ZN1AC1Ei) gimple_body=0 DECL_ABSTRACT_ORIGIN=1 Function: 'A::A(int)' (Mangled: _ZN1AC2Ei) gimple_body=1 DECL_ABSTRACT_ORIGIN=1 Function: 'void foo(int)' (Mangled: _Z3fooi) gimple_body=1 DECL_ABSTRACT_ORIGIN=0 Function: 'int bar()' (Mangled: _Z3barv) gimple_body=1 DECL_ABSTRACT_ORIGIN=0 Function: 'void unreachable_func()' (Mangled: _ZL16unreachable_funcv) gimple_body=1 DECL_ABSTRACT_ORIGIN=0 After reachability analysis (after first call to analyze_functions()) ----------------------------------------- Function: 'int main()' (Mangled: main) gimple_body=1 DECL_ABSTRACT_ORIGIN=0 Function: 'A::A(int)' (Mangled: _ZN1AC1Ei) gimple_body=0 DECL_ABSTRACT_ORIGIN=1 Function: 'A::A(int)' (Mangled: _ZN1AC2Ei) gimple_body=1 DECL_ABSTRACT_ORIGIN=1 Function: 'void foo(int)' (Mangled: _Z3fooi) gimple_body=1 DECL_ABSTRACT_ORIGIN=0 Function: 'int bar()' (Mangled: _Z3barv) gimple_body=1 DECL_ABSTRACT_ORIGIN=0 Is this what you had in mind? I can provide a patch to make things clearer. Aldy --------------040501070901080201090606 Content-Type: text/plain; charset=UTF-8; name="b.ii" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="b.ii" Content-length: 554 ZXh0ZXJuICJDIiB2b2lkIGFib3J0ICgpOwpzdHJ1Y3QgQSB7IEEgKGludCk7 IGludCBhOyB9OwoKaW50IGk7CgpzdGF0aWMgdm9pZCB1bnJlYWNoYWJsZV9m dW5jKCkKewogIGkgPSA1Owp9CgoKX19hdHRyaWJ1dGVfXygobm9pbmxpbmUs IG5vY2xvbmUpKSBpbnQKYmFyICh2b2lkKQp7CiAgcmV0dXJuIDQwOwp9Cgpf X2F0dHJpYnV0ZV9fKChub2lubGluZSwgbm9jbG9uZSkpIHZvaWQKZm9vIChp bnQgeCkKewogIF9fYXNtIHZvbGF0aWxlICgiIiA6IDogInIiICh4KSA6ICJt ZW1vcnkiKTsKfQoKQTo6QSAoaW50IHgpCnsKICBzdGF0aWMgaW50IHAgPSBi YXIgKCk7CiAgZm9vIChwKTsKICBhID0gKytwOwp9CgppbnQKbWFpbiAoKQp7 CiAgQSBhICg0Mik7CiAgaWYgKGEuYSAhPSA0MSkKICAgIGFib3J0ICgpOwp9 Cg== --------------040501070901080201090606--