This is the mail archive of the gcc@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] |
On 12/15/2015 2:43 PM, Joseph Myers wrote:
On Tue, 15 Dec 2015, David Wohlferd wrote:Unlike top level, using basic asm within a function is deprecated. No new code should use this feature, but should use extended asm instead. Existing code should begin replacing such usage. Instances of affected code can be found using -Wonly-top-basic-asm. For help making this conversion, see "How to convert Basic asm to Extended asm."I think the typical use of basic asm is: you want to manipulate I/O registers or other such state unknown to the compiler (not any registers the compiler might use itself), and you want to do it in a way that is maximally compatible with as many compilers as possible (hence limiting yourself to the syntax subset that's in the C++ standard, for example). Compatibility with a wide range of other compilers is the critical thing here; this is not a GCC-invented feature, and considerations for deprecating an externally defined feature are completely different from considerations for GCC-invented features.
Do you have evidence that it is now unusual for compilers to support basic asm without supporting GCC-compatible extended asm, or that other compiler providers generally consider basic asm deprecated?
On the contrary, I would be surprised to learn that there are ANY compilers (other than clang) that support gcc's extended asm format. And although there is no standard that seems to require it, I'm not certainly not prepared to say that basic asm is "generally deprecated."
But the fact that there is no standard may make "doing what other compilers do" challenging.
For example quoting from Bernd's email regarding the windriver diab compiler: "non-scratch registers must be preserved." Implying that scratch registers (which they apparently only list for ARM) are considered clobbered.
That seems like a sensible approach (and avoids the frame pointer problem). But I'm not prepared to extrapolate from that how all compilers do or should handle basic asm. However it does mean that the suggestion being proposed here to have basic asm only clobber memory would not be compatible with windriver's approach to basic asm. And Jeff's proposal for gcc to clobber "all registers" wouldn't be compatible with them either.
I agree that "oh, surprise! gcc does this differently than compiler X!" is a bad thing. But without standards, trying to be compatible with how "everyone else" does it may not be practical. You'll note that windriver made no particular effort to be compatible with gcc. And of course any change will make gcc v7 work differently than gcc v4, v5, v6.
If compatibility with other compilers is an important criteria when determining how gcc should handle basic asm, someone's going to need to do some research and some prioritizing.
In the meantime, raising awareness of this issue via docs and warnings seems a low-cost way to start.
dw
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |