[llvm-dev] Problem of getNumOperands() for CallInst

Craig Topper via llvm-dev llvm-dev at lists.llvm.org
Wed May 29 07:21:30 PDT 2019


There's a getNumArgOperands() that counts just arguments to the function
and not the callee itself.

~Craig


On Wed, May 29, 2019 at 3:53 AM Bevin Hansson via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi Tingyuan,
>
>     For example,
>              call void @_Z2f2PA100_i([100 x i32]* nonnull %arraydecay)
>     If I use getNumOperands(), it will return 2.
>     However, if I use getCalledFunction()->getNumParams(), it will return
> 1.
>     According to the IR, I think the number of operands of the call
> instruction should be 1.
>
> 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.
>
> / Bevin
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190529/fe18d610/attachment.html>


More information about the llvm-dev mailing list