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/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.


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