This is the mail archive of the gcc-bugs@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]

[Bug middle-end/44492] auto-inc-dec pushes PRE_MODIFY/PRE_INC into inline asm operands



------- Comment #11 from jakub at gcc dot gnu dot org  2010-06-10 12:24 -------
I believe for GCC it shouldn't be hard to at least easily detect the used zero
times case which happens very often in lost of code.
asm ("... %2 ... " : "=m" (*p) : "m" (*p), "r" (p));
is just very common, the "=m" and "m" just tells gcc that the memory is used
and might change.
It would be even possible using a target hook to check whether it is used
exactly once, furthermore in target specific proper way (say, on powerpc64 the
check would
be that there is exactly one use of the operand with U modifier, at most one
with X modifier and exactly one another use, on ia64 it could be that there is
exactly one use with P modifier and exactly one use another use, on the targets
which print incdec in *print_*address it could be by default check for exactly
one use of the operand.
This is not going to be perfect, it would count uses in comments and also
doesn't cover e.g. a single use in not always executed code (say the asm has
conditional jump around a few insns and uses the mem in there), but could fix
up significant amount of code in the wild.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44492


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