<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dear Craig and Bevin,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    THANKS for your information! I get it!</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    Sorry that I ignore the callee and thanks for your suggestion!!!!</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    ^_^<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<span id="ms-rterangepaste-start"></span>
<div><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">Best regards,</span></font><span style="font-size:12pt">
</span><span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">------------------------------------------</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">Tingyuan LIANG</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">MPhil Student</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">Department of Electronic and Computer Engineering</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">The Hong Kong University of Science and Technology</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span><span style="font-size:12pt"></span><span id="ms-rterangepaste-end"></span></div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Craig Topper <craig.topper@gmail.com><br>
<b>Sent:</b> Wednesday, May 29, 2019 10:21 PM<br>
<b>To:</b> Bevin Hansson<br>
<b>Cc:</b> llvm-dev@lists.llvm.org; Tingyuan LIANG<br>
<b>Subject:</b> Re: [llvm-dev] Problem of getNumOperands() for CallInst</font>
<div> </div>
</div>
<div>
<div dir="ltr">There's a getNumArgOperands() that counts just arguments to the function and not the callee itself. 
<div><br clear="all">
<div>
<div dir="ltr" class="x_gmail_signature">~Craig</div>
</div>
<br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Wed, May 29, 2019 at 3:53 AM Bevin Hansson via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>Hi Tingyuan,</p>
<blockquote type="cite">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
    For example,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
             call void @_Z2f2PA100_i([100 x i32]* nonnull %arraydecay)<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
    If I use getNumOperands(), it will return 2.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
    However, if I use getCalledFunction()->getNumParams(), it will return 1.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
    According to the IR, I think the number of operands of the call instruction should be 1.</div>
</blockquote>
<p>I think you'll find that the first operand of the 'call' instruction is the callee (the function being called) itself. So two operands makes sense in your case: one callee and one parameter.</p>
<p>/ Bevin<br>
</p>
</div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote>
</div>
</div>
</body>
</html>