This is the mail archive of the gcc-patches@gcc.gnu.org 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: [PATCH 0/2] Require that constraints are used to reference global regs


On Mon, 23 Apr 2018, Michael Matz wrote:
> In your follow-up patches you actually change the very documentation that 
> makes the above valid and supported ...

I don't see how a user reading the documentation could infer that asms and
global reg vars interact like you say. I am particularly unsure if all asms
or only volatile ones are supposed to.

(indications to the contrary can be found on the other hand, e.g.
"It also does not know about side effects of the assembler code, such as
modifications to memory or registers. Unlike some compilers, GCC assumes that no
changes to general purpose registers occur. " in Basic Asm section)

What am I missing?

> Sure, so the other scanners need fixing as well.  An alternative is to 
> massage the asms while constructing them (e.g. gimplification time) to 
> read and write all global reg var registers.  Then all scanners will 
> automatically work.

Yes, but that is problematic since on some backends global_regs is non-empty
(e.g. rs6000, tile*) so it would tie all asms (it's also a problem with the
current DF behavior).

> > So this never worked anywhere near reliably
> 
> I think you're exaggerating this, it worked fine in old compilers, in 
> particular before DF, and it still works fine mostly, when you aren't 
> knowning compiler internals to construct counter examples.

By what mechanism was it supposed to work in old compilers, i.e. how did
they ensure that asms touch some registers not present in their constraints?
Sorry about the exaggeration.

> > and we should simply adjust the documentation to say that asms must use 
> > constraints to say how they are accessing global reg vars.
> 
> IMHO we can't define our bugs away in this way, after saying for 
> decades how something is supposed to work.  Especially not rushing it in a 
> couple days before release.

I honestly don't see where GCC was indicating how it's supposed to work.

At the moment I'm quite confused as it seems that

 * the docs are unclear and the implementation is internally inconsistent
 * the docs cannot be changed to admit issues that are currently present.

The latter doesn't seem quite right.

(by the way, patch 1 has other changes beside the requirement for constraints,
could they be useful on their own?)

Thanks.
Alexander


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