This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Extend thunk support and use it in Ada
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Martin Jambor <mjambor at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 25 Sep 2018 23:55:03 +0200
- Subject: Re: [patch] Extend thunk support and use it in Ada
- References: <3718088.xjsADOAp9u@polaris> <ri6lg7phi6e.fsf@suse.cz>
> I think you should also handle duplicate_thunk_for_node in
> cgraphclones.c. That function clones thunks when the function they
> belong to gets cloned. If you think you don't need to handle it for one
> reason or another, at the very least put an assert there that
> indirect_offset is zero.
Thanks for the heads up, now done, as well as in ipa-icf.c.
> does this mean you can have thunks in one compilation unit that belong
> to a function in another compilation unit? Interesting...
Yes, we can in Ada because the compilation model is different.
> If I read this correctly (and the offset is an int), nowadays you might
> just want to do simple
>
> stmt = gimple_build_assign (offset_tree,
> fold_build2 (MEM_REF,
> integer_type_node,
> ptr,
> build_int_cst
> (build_pointer_type (integer_type_node), indirect_offset)));
>
> instead of all of the above? You might then also leave the creation of
> vtable_entry_type where it is now.
The new code uses the same pattern as the existing code just above though.
--
Eric Botcazou