This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC]: use cgraph to emit alpha vas trampoline entry point


On Sat, Dec 24, 2011 at 8:00 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
> On Tue, Dec 20, 2011 at 9:46 AM, Tristan Gingold <gingold@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?

Err - are not _all_ backends using trampolines to represent address-taken
nested functions?  At least I remeber to see them for x86 and plain C
nested functions as well.  So - is this really a target issue?  At the time
the address of a nested fn is taken the C frontend arranges to (dynamically?)
create the trampoline via some builtin.

Richard.

> Ciao!
> Steven


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]