This is the mail archive of the 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: [ipa-branch] Devirtualization

On Fri, 2005-09-16 at 15:32 +0300, Mircea Namolaru wrote:
> This patch implements a simple variant of RTA (see "Fast Static Analysis
> of C++ Virtual Function Call" by Bacon & Sweeney - OOPSLA'96) for 
> devirtualization of C++ function calls. The interprocedural analysis done 
> may infer the type of the object  upon which a virtual method is invoked. 
> If this happens the virtual call may be transformed in a direct call, this 
> making possible the inlining  of the method afterward. 
> The current patch contains the analysis part. For transforming a virtual 
> call in a direct call it uses already existent GCC code that works only 
> in limited cases. This means that currently, even if we infer the type of 
> the object for a virtual call, not always this virtual call is transformed 
> in a direct one. This will be fixed by a further patch with support for 
> transformation of a virtual call in a direct one in the general case. 
> This optimization works only for C++ code. To enable it use the option 
> -fipa-cha. It is assumes that all the application files are compiled 
> together. 

You probably shouldn't assume this, and instead check -fwhole-program is
set to be sure.

If it isn't, you should be restricting yourself to only those types that
don't escape (which, in C++, is probably not very many).  The ipa type
escape info can give you that information very easily.

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