This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH for sibcalls on i386
On Wed, Sep 25, 2002 at 03:28:51PM +1000, Andreas Bauer wrote:
> * calls.c (expand_call): Removed the `no indirect check'
> for sibcall optimization, and replaced it by making use
> of the new target hook "function_ok_for_sibcall".
> * hooks.c: Added function hook_tree_tree_bool_false to
> disable all sibcall optimization on all targets by
> default, so that certain targets can later override this
> setting with their individual hooks.
> * hooks.h: Declared hook_tree_tree_bool_false.
> * target-def.h: Defined and added TARGET_FUNCTION_OK_FOR_SIBCALL
> to TARGET_INITIALIZER
> * target.h: Declared the function_ok_for_sibcall
> function.
Again, note that changelogs should describe "what" not "why". Thus
* calls.c (expand_call): Remove the `no indirect check'
for sibcall optimization; use function_ok_for_sibcall
target hook.
* hooks.c (hook_tree_tree_bool_false): New.
* hooks.h (hook_tree_tree_bool_false): Declare.
* target-def.h (TARGET_FUNCTION_OK_FOR_SIBCALL): New.
(TARGET_INITIALIZER): Add it.
* target.h (struct gcc_target): Add function_ok_for_sibcall.
"Why" belongs in comments inside the code.
> +/* Return true if a function is ok to be called as a sibcall. */
> +static int
> +frv_function_ok_for_sibcall (decl, exp)
> + tree decl;
> + tree exp;
> +{
> + return 0;
> }
Note that this is identical to the default hook.
> + /* TODO: Indirect sibcalls are not yet supported by the 64-bit call
> + patterns. */
> + if (!decl && TARGET_64BIT)
> + return 0;
They aren't implemented _anywhere_ yet. Your x86 code won't
have been merged yet.
> +++ pa/pa-linux.h 25 Sep 2002 04:01:52 -0000
> @@ -189,3 +185,7 @@ Boston, MA 02111-1307, USA. */
> /* Linux always uses gas. */
> #undef TARGET_GAS
> #define TARGET_GAS 1
> +
> +/* Sibcalls, stubs, and elf sections don't play well. */
> +#undef TARGET_FUNCTION_OK_FOR_SIBCALL
> +#define TARGET_FUNCTION_OK_FOR_SIBCALL hook_tree_tree_bool_false
[...]
> +++ pa/pa.c 25 Sep 2002 04:02:18 -0000
> @@ -194,6 +195,9 @@ static size_t n_deferred_plabels = 0;
> #undef TARGET_STRIP_NAME_ENCODING
> #define TARGET_STRIP_NAME_ENCODING pa_strip_name_encoding
>
> +#undef TARGET_FUNCTION_OK_FOR_SIBCALL
> +#define TARGET_FUNCTION_OK_FOR_SIBCALL pa_function_ok_for_sibcall
The pa-linux definition is no longer in effect.
> +static int
> +rs6000_function_ok_for_sibcall (fndecl, exp)
> tree fndecl;
> + tree exp;
Need ATTRIBUTE_UNUSED. Likewise for the other functions you added.
In general, you'll want to configure a cross-compiler for each target
you touch, build cc1 and look for warnings you may have introduced.
> +static int
> +xtensa_function_ok_for_sibcall (decl, exp)
> + tree decl;
> + tree exp;
> +{
> + return 0;
> +}
Default hook.
r~