On Tue, Dec 20, 2011 at 9:46 AM, Tristan Gingold <ging...@adacore.com> wrote: > 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 ?
Since no-one has answered yet, I'll just toss in my $0.02. (Hold on to them a bit, they may be worth a million Euro soon :-) I think that in general you cannot rely on cgraph in the backends, this has to be analyzed case-by-case. In your case I'm not sure, but I think it should be OK. Your patch uses cgraph in alpha_start_function, which is apparently only used for the target hook ASM_DECLARE_FUNCTION_NAME. This hook is called from varasm.c:assemble_start_function(), and this is in turn only called from final.c:rest_of_handle_final() to generate assembly from RTL, and from cgraphunit.c:assemble_thunk() to output assembly for MI thunks. AFAICT cgraph should be correct and complete at the stage when those two functions are called. Therefore your patch should be OK. Perhaps Honza can throw in his 0.02h? Ciao! Steven