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]

RFC: Make TARGET_MD_ASM_CLOBBERS take input and output lists as well


Subject says it mostly.  Everybody knows that this is
compatibility stuff, where clobbers for registers are
automatically added to asms, where presumably previous GCC
versions had no means to name the register and so they couldn't
be in the clobber list.

The proposed change means that code adding the clobbers can then
check the input and output lists to e.g. not add a clobber if
the register is mentioned as an asm-declared register in the
input or output lists.  For old asm usage, this means they still
work; usage of registers not accessible by name in previous GCC
versions, but where the asm used it as temp or other usage (in
the case of CRIS, parameter register for the kernel ABI) works.
New asms can use it as input or output, and no clobber will be
added, which would be flagged as an invalid overlap as would
happen presently.

This doesn't apply to the only current user of this machinery,
the i386 port, which has no constraint letter that matches any
of the added clobbers.  It'd just ignore the input and output
lists; new function parameters marked ATTRIBUTE_UNUSED added.

An alternative is to tweak the TARGET_MD_ASM_CLOBBERS semantics
to mean "these clobbers will be added only if not mentioned by
name or singleton-register-class-letter constraint in input or
output lists".  No change at all to i386.c but would also not
let the port control details it supposedly can handle better
than the generic GCC parts.


To wit, the corresponding doc change for this proposal:

Index: tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.411
diff -c -p -u -p -r1.411 tm.texi
cvs diff: conflicting specifications of output style
--- tm.texi     30 Jan 2005 15:36:09 -0000      1.411
+++ tm.texi     15 Feb 2005 20:30:51 -0000
@@ -9285,11 +9285,13 @@ from shared libraries (DLLs).
 You need not define this macro if it would always evaluate to zero.
 @end defmac

-@deftypefn {Target Hook} tree TARGET_MD_ASM_CLOBBERS (tree @var{clobbers})
+@deftypefn {Target Hook} tree TARGET_MD_ASM_CLOBBERS (tree @var{outputs}, tree @var{inputs}, tree @var{clobbers})
 This target hook should add to @var{clobbers} @code{STRING_CST} trees for
-any hard regs the port wishes to automatically clobber for all asms.
+any hard regs the port wishes to automatically clobber for an asm.
 It should return the result of the last @code{tree_cons} used to add a
-clobber.
+clobber.  The @var{outputs}, @var{inputs} and @var{clobber} lists are the
+corresponding parameters to the asm and may be inspected to avoid
+clobbering a register that is an input or output of the asm.
 @end deftypefn

 @defmac MATH_LIBRARY


All 4.1 material of course.

brgds, H-P


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