This is the mail archive of the gcc@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: vtable optimization (was Re: TREE_UNCHANGING?)


On Fri, 10 May 2002, Jason Merrill wrote:

> Another tangent: if we know the static type of the object, we can do even
> better: we can skip the vtable lookup entirely and call the function
> directly.  There is some simple code in the C++ frontend to handle this,
> mostly in fixed_type_or_null; a more C++-aware optimizer could track the
> static type information as well as the alias set, so that we could perform
> this optimization for code like
> 
>   A a;
>   A *ap = &a;
>   ...
>   ap->f();
> 
> as well as the simpler
> 
>   A a;
>   ...
>   a.f();
> 
> This stuff is probably better suited for an AST-level optimization pass.
> 

Yup.
These are generally language specific in some degree, but i've been 
looking at doing it for C++.

On my list of things, however, devirtualization is pretty far down.
--Dan

> Jason
> 


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