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]

[RFA]: Fix emit_library_call_value_1() to emit a (clobber (mem))


Hi!

Richard Henderson <rth@redhat.com> wrote:
> On Tue, Feb 27, 2001 at 11:12:37PM +0100, Stephane Carrez wrote:
> > (call_insn "_libcall")
> > (set (reg M) (mem (reg/f virtual-stack-vars))
>
> This is likely a problem with emit_library_call_value.
>
> There was some discussion in moderately recent history about adding
> a (clobber (mem (reg virtual-stack-vars))) in CALL_INSN_FUNCTION_USAGE.
> I seem to recall that there were problems encountered with that wrt
> virtual register instantiation or somesuch.
>
> It appears that expand_call emits a standalone clobber before a 
> pure or const call, but emit_library_call_value_1 doesn't.

Thanks for you input!

I implemented what you suggest.  A (clobber (mem (reg virtual-stack-vars)))
is emitted when the library call returns its result in a stack slot.
It solves the problem that the (set (reg M) (mem (reg/f virtual-stack-vars)))
was removed by the CSE pass.
(See http://gcc.gnu.org/ml/gcc/2001-02/msg01372.html)


Can you approve or integrate the patch below in the 3.0 branch?

Thanks,
	Stephane

2001-03-04  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* calls.c (emit_library_call_value_1): Emit a clobber if the
	function returns its result in a stack slot.
Index: calls.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/calls.c,v
retrieving revision 1.175
diff -p -r1.175 calls.c
*** calls.c	2001/01/24 19:00:58	1.175
--- calls.c	2001/03/04 09:33:40
*************** emit_library_call_value_1 (retval, orgfu
*** 4120,4125 ****
--- 4120,4128 ----
      {
        if (mem_value)
  	{
+ 	  /* This function is returning into a stack slot,
+ 	     put a clobber to indicate the stack slot was modified.  */
+ 	  emit_insn (gen_rtx_CLOBBER (VOIDmode, mem_value));
  	  if (value == 0)
  	    value = mem_value;
  	  if (value != mem_value)

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