Hi,
currently alpha/vms backend emits a trampoline entry point for all nested
functions. This is a waste of code space, as although nested functions are
very common in Ada, address of nested functions are only seldom taken.
The fact that the address of a function is taken seems only be available in
cgraph. Is it OK to use cgraph in alpha.c ?
Tristan.
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index e3976ed..4f59fe8 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -7936,9 +7936,14 @@ alpha_start_function (FILE *file, const char *fnname,
&& !TYPE_P (DECL_CONTEXT (decl))
&& TREE_CODE (DECL_CONTEXT (decl)) != TRANSLATION_UNIT_DECL)
{
- fprintf (file, "%s..tr:\n", fnname);
- fprintf (file, "\tldq $1,24($27)\n");
- fprintf (file, "\tldq $27,16($27)\n");
+ struct cgraph_node *node = cgraph_get_node (decl);
+
+ if (node == NULL || node->address_taken)
+ {
+ fprintf (file, "%s..tr:\n", fnname);
+ fprintf (file, "\tldq $1,24($27)\n");
+ fprintf (file, "\tldq $27,16($27)\n");
+ }
}
if (TARGET_ABI_OPEN_VMS)