This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Const/libcall function calling tweeks
> On Thu, Mar 09, 2000 at 11:50:10PM +0100, Jan Hubicka wrote:
> > Do you have something like this in the mind?:
> > int a(int, int) __attribute__ ((const));
> > main()
> > {
> > return a(b(1),b(1));
> > }
>
> Not quite -- make b const, not a. We should then make only
> one call to b.
I believe there is noting to do with the NO_DEFER_POP in question.
CSE ought to do the trick.
>
> > Emit_call_1 takes case to not use pending_stack_adjust for const calls.
>
> Does it? I thought that's what the NO_DEFER_POP frobbing was for.
It does:
if (rounded_stack_size != 0)
{
if (flag_defer_pop && inhibit_defer_pop == 0 && !is_const)
pending_stack_adjust += rounded_stack_size;
else
adjust_stack (rounded_stack_size_rtx);
}
The inhibit_defer_pop is to avoid using pending_stack_adjust in nested calls
(where some data are already pushed).
This is quite ill, I would like to redesign it to "push" pending_stack_adjust
after first pushed argument (save it's value and set it to zero)
and call do_pedning_stack_adjust before each push. Emit_call_1 then can "pop"
the old pending_stack_adjust.
This should enable the pending_stack_adjust optimization for the nested
function calls and remove some of inhibit_defer_pop uglyness.
Sane implementation ought to fix the problems with nested function all missalignments
as well.
So still hope that this patch is OK.
Honza
>
>
> r~