From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23752 invoked by alias); 22 Oct 2014 18:23:14 -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 23743 invoked by uid 89); 22 Oct 2014 18:23:14 -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,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS 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; Wed, 22 Oct 2014 18:23:07 +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 s9MIN31Q017248 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 22 Oct 2014 14:23:05 -0400 Received: from [10.3.113.119] (ovpn-113-119.phx2.redhat.com [10.3.113.119]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9MIBeq2015635; Wed, 22 Oct 2014 14:11:40 -0400 Message-ID: <5447F35C.7030500@redhat.com> Date: Wed, 22 Oct 2014 18:23:00 -0000 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Bernd Schmidt , GCC Patches Subject: Re: The nvptx port [8/11+] Write undefined decls. References: <54451994.9070209@codesourcery.com> <54451C9F.2080503@codesourcery.com> <5446D8A6.7060407@redhat.com> <5446DAF0.5070600@codesourcery.com> In-Reply-To: <5446DAF0.5070600@codesourcery.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg02293.txt.bz2 On 10/21/14 16:15, Bernd Schmidt wrote: > On 10/22/2014 12:05 AM, Jeff Law wrote: >> On 10/20/14 14:30, Bernd Schmidt wrote: >>> ptx assembly requires that declarations are written for undefined >>> variables. This adds that functionality. >> Does this need to happen at the use site, or can it be deferred? > > This is independent of use sites. The patch just adds another walk over > the varpool to emit not just the defined vars. > > Ideally we'd maintain an order that declares or defines every variable > before it is referenced by an initializer, but the attempt to do that in > the compiler totally failed due to references between constant pools and > regular variables. The nvptx-as tool we have fixes up the order of > declarations after the first compilation stage. > >> THe PA had to do something similar. We built up a vector of every >> external object in ASM_OUTPUT_EXTERNAL, but did not emit anything. >> >> Then in ASM_FILE_END, we walked that vector and anything that was >> actually referenced (as opposed to just just declared) we would emit the >> magic .IMPORT lines. > > Sounds like the PA could use this hook to simplify its code quite a bit. The PA stuff is a trivial amount of code :-) But it is a bit awkward in that we're using a per-variable hook to stash, then the end-file hook to walk the stashed stuff. IIRC, the problem is tentative definitions. Otherwise we'd just emit the .import statements as we saw the declarations. I believe that was to properly interface with the HP assembler/linker. We also have to defer emitting plabels, but I can't recall the braindamage behind that. I'm not going to insist you do this in the same way as the PA. That was a different era -- we had significant motivation to make things work in such a way that everything could be buried in the pa specific files. That sometimes led to less than optimal approaches to fix certain problems. Jeff