This is the mail archive of the
mailing list for the GCC project.
Re: The nvptx port [8/11+] Write undefined decls.
- From: Bernd Schmidt <bernds at codesourcery dot com>
- To: Jeff Law <law at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 22 Oct 2014 00:15:12 +0200
- 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>
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.
Looking at the patch again I noticed there's still some unrelated code
in here - the patch used to be quite a lot larger and got shrunk due to
the failure mentioned above. get_fnname_for_decl is just a new function
broken out of rest_of_handle_final, it is used by the nvptx.c code.