This is the mail archive of the
mailing list for the GCC project.
Re: The nvptx port [8/11+] Write undefined decls.
- From: Jeff Law <law at redhat dot com>
- To: Bernd Schmidt <bernds at codesourcery dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 22 Oct 2014 12:11:40 -0600
- Subject: Re: The nvptx port [8/11+] Write undefined decls.
- Authentication-results: sourceware.org; auth=none
- References: <54451994 dot 9070209 at codesourcery dot com> <54451C9F dot 2080503 at codesourcery dot com> <5446D8A6 dot 7060407 at redhat dot com> <5446DAF0 dot 5070600 at codesourcery dot com>
On 10/21/14 16:15, Bernd Schmidt wrote:
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.
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.
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.