This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH for sibcalls on i386
> int
> i386_function_ok_for_sibcall (decl, exp)
> tree decl, exp;
> {
> /* If we are generating position-independent code, we cannot sibcall
> optimize any indirect call, or a direct call to a global
> function, as the PLT requires %ebx be live. */
> if (flag_pic && (!decl || !TREE_PUBLIC (decl)))
> return 0;
>
> [...]
>
> /* Otherwise okay. */
> return 1;
> }
I agree, indeed this is much nicer. I will incorporate the change into
my next series of patches.
> Andreas, may I suggest that you split the patch? It will be easier
> for people to review it, which means it will get committed faster, if
> you make these changes in three separate stages.
Yes, I will try to come up with smaller patches. (I'm still somewhat new
to the gcc business, sorry.)
> First make the mechanical changes necessary to add the 'exp' parameter
> to FUNCTION_OK_FOR_SIBCALL, and update the documentation. Do not
> change calls.c or any of the definitions at this stage. Please
> consider turning FUNCTION_OK_FOR_SIBCALL into a "target hook" with
> this patch, too.
>
> Second, change all the definitions of FUNCTION_OK_FOR_SIBCALL to
> return false if fndecl is null, remove the hardwired 'decl != 0' check
> from calls.c, and again update the documentation.
>
> Third, change the i386 machine description and FUNCTION_OK_FOR_SIBCALL
> hook to accept indirect sibcalls when possible.
Sounds all good to me. Thank you a lot for the useful comments.
Cheers,
Andi.