This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: The nvptx port [8/11+] Write undefined decls.

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]