This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Fix PR c/12372
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: ebotcazou at libertysurf dot fr (Eric Botcazou)
- Cc: jason at redhat dot com, rth at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Thu, 23 Oct 2003 10:50:13 -0400 (EDT)
- Subject: Re: [PATCH]: Fix PR c/12372
> > Yes, except that this code has no effect. The immediately preceding
> > line is
> >
> > flags &= ~(ECF_CONST | ECF_PURE | ECF_LIBCALL_BLOCK);
>
> Funny indeed.
I tend to think that line is in the wrong place, but I'm not completely
sure.
> Which leads to the obvious (and probably naive) question: why can we not do
> the same for sibcalls, stretching a bit the semantics of REG_RETVAL in the
> process?
It might work. I have done a little more work on the problem along the
lines suggested by Richard. The patch below fixes the PR. Probably,
we only need to do add this information for sibcalls but it didn't seem
that it would hurt to have this information available for normal const
calls as well.
I'm still pondering whether or not to clobber the slots. I believe
that functions are generally allowed to clobber their arguments. The
most serious problem that I have noticed with the patch is that reload
doesn't eliminate the occurences of the frame pointer in the call usage
information. So, the information is wrong after reload ;(
You might see if this resolves the sparc failure.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
Index: calls.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/calls.c,v
retrieving revision 1.304
diff -u -3 -p -r1.304 calls.c
--- calls.c 7 Oct 2003 19:48:17 -0000 1.304
+++ calls.c 11 Oct 2003 23:34:34 -0000
@@ -2971,6 +2971,12 @@ expand_call (tree exp, rtx target, int i
&& check_sibcall_argument_overlap (before_arg,
&args[i], 1)))
sibcall_failure = 1;
+
+ if (flags & ECF_CONST)
+ call_fusage = gen_rtx_EXPR_LIST (VOIDmode,
+ gen_rtx_USE (VOIDmode,
+ args[i].value),
+ call_fusage);
}
/* If we have a parm that is passed in registers but not in memory
@@ -2995,6 +3001,12 @@ expand_call (tree exp, rtx target, int i
&& check_sibcall_argument_overlap (before_arg,
&args[i], 1)))
sibcall_failure = 1;
+
+ if (flags & ECF_CONST)
+ call_fusage = gen_rtx_EXPR_LIST (VOIDmode,
+ gen_rtx_USE (VOIDmode,
+ args[i].value),
+ call_fusage);
}
/* If we pushed args in forward order, perform stack alignment