[LTO] Fix C++ thunks
Wed Dec 17 19:02:00 GMT 2008
Diego Novillo wrote:
> [ CCing jason and mark, to make sure I'm not missing anything
> obvious in the C++ side. ]
> This patch is the initial step to make thunks work with LTO.
> Essentially, this forces cc1plus to always emit non-asm thunks,
> which is a performance problem, but I think I know how to address
I think your patch is plausible. Obviously, we need to get the asm
thunks back in to recover performance (and correctness, for varargs). I
think GIMPLE_THUNK_CALL is a plausible solution to that.
A few things you should think about:
1. Although we've never implemented it, one of the ideas with thunks was
that you could fall through into the main function body, rather than
jump to it. That avoids a costly, often mis-predicted branch. So, we
shouldn't do anything that makes that harder.
2. Thunks (whether or not implemented as fall-throughs) can be thought
of as alternate entry points. You might want to think about whether
GIMPLE_THUNK_CALL is the right long-term representation, or whether what
we should really be doing is adding alternate entry point support, which
is of course useful for other things as well.
(650) 331-3385 x713
More information about the Gcc-patches