[llvm-dev] Identify virtual function call sites and candidate callees for it

Peter Collingbourne via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 26 10:01:05 PDT 2017


Hi Anahit,

You may find it useful to take a look at the WholeProgramDevirt pass, it
uses the type metadata that was introduced for CFI to identify virtual call
sites and candidate callees for devirtualization. See in particular
the scanTypeTestUsers and tryFindVirtualCallTargets functions.

Peter

On Wed, Apr 26, 2017 at 9:44 AM, Hayrapetyan, Anahit via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi,
>
> I have an analysis pass which collects information about functions based
> on their call sites. There are problems I’m facing with processing virtual
> function calls, namely
>
> . How identify virtual call sites in my pass?
>
> . How Identify candidate callees for the given virtual call site?
>
> For the following example, the information I want to get would be identify
> call of  F and as a possible callees have both B::F and D::F.
>
> class B {
>
> virtual void F() { // do something }
>
> };
>
> class D : public B {
>
> void F() { // do something else }
>
> };
>
> B* d = new D();
>
> d->F();
>
> While doing some investigation on my problem, I found about CFI and how it
> makes use of llvm type.test intrinsic to check validity of virtual table
> pointers. I thought it might be useful. But still am not sure if this would
> be the correct way to solve the problem and even if it is how extend this
> approach to get information about potential callees.
>
> I would greatly appreciate any ideas or hints on how to solve these
> problems.
>
> Anahit.
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>


-- 
-- 
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170426/31e7b743/attachment.html>


More information about the llvm-dev mailing list