<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><span id="docs-internal-guid-8c79141e-ab20-a5a5-770c-b74769a63c9f"></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 11pt; font-family: Arial; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">Hi,</span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 11pt; font-family: Arial; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">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
</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-indent: 36pt;">
<span style="font-size: 11pt; font-family: Arial; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">. How identify virtual call sites in my pass?</span></p>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-indent: 36pt;">
<span style="font-size: 11pt; font-family: Arial; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">. How Identify candidate callees for the given virtual call site?</span></p>
<br>
<p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style="font-size: 11pt; font-family: Arial; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">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.</span></p>
<br>
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:11pt;margin-left: 40pt;margin-right: 4pt;">
<span style="font-size: 9pt; font-family: Consolas; color: rgb(0, 0, 136); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">class</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
B {</span></p>
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:11pt;margin-left: 40pt;margin-right: 4pt;">
<span style="font-size: 9pt; font-family: Consolas; color: rgb(0, 0, 136); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">virtual</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(0, 0, 136); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">void</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
F</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(102, 102, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">()</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(102, 102, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">{</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(136, 0, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">// do something }</span></p>
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:11pt;margin-left: 40pt;margin-right: 4pt;">
<span style="font-size: 9pt; font-family: Consolas; color: rgb(102, 102, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">};</span></p>
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:11pt;margin-left: 40pt;margin-right: 4pt;">
<span style="font-size: 9pt; font-family: Consolas; color: rgb(0, 0, 136); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">class</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
D </span><span style="font-size: 9pt; font-family: Consolas; color: rgb(102, 102, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">:</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(0, 0, 136); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">public</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
B {</span></p>
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:11pt;margin-left: 40pt;margin-right: 4pt;">
<span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;"></span><span style="font-size: 9pt; font-family: Consolas; color: rgb(0, 0, 136); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">void</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
F</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(102, 102, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">()</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(102, 102, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">{</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(136, 0, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">// do something else }</span></p>
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:11pt;margin-left: 40pt;margin-right: 4pt;">
<span style="font-size: 9pt; font-family: Consolas; color: rgb(102, 102, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">};
</span></p>
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:11pt;margin-left: 40pt;margin-right: 4pt;">
<span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">B</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(102, 102, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">*</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
d </span><span style="font-size: 9pt; font-family: Consolas; color: rgb(102, 102, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">=</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(0, 0, 136); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">new</span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">
D</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(102, 102, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">();</span></p>
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:11pt;margin-left: 40pt;margin-right: 4pt;">
<span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">d</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(102, 102, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">-></span><span style="font-size: 9pt; font-family: Consolas; background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">F</span><span style="font-size: 9pt; font-family: Consolas; color: rgb(102, 102, 0); background-color: rgb(239, 240, 241); vertical-align: baseline; white-space: pre-wrap;">();</span></p>
<br>
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:11pt;margin-right: 4pt;">
<span style="font-size: 11pt; font-family: Arial; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">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.</span></p>
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:11pt;margin-right: 4pt;">
<span style="font-size: 11pt; font-family: Arial; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;"><span>I would greatly appreciate any ideas or hints on how to solve these problems.</span><br>
</span></p>
<p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:11pt;margin-right: 4pt;">
<span style="font-size: 11pt; font-family: Arial; background-color: transparent; vertical-align: baseline; white-space: pre-wrap;">Anahit.</span></p>
<br>
</span><br>
<p></p>
</div>
</body>
</html>