[llvm-dev] Get Num of Uses in only dominated blocks?

Daniel Berlin via llvm-dev llvm-dev at lists.llvm.org
Thu Jan 19 22:28:03 PST 2017


LLVM is in SSA, which means that by definition, any uses are dominated by
the definition.

So getNumUses does, in fact, give you the answer of "what is the number of
uses that are dominated by this definition".

Unless i'm missing what you are really after?


On Thu, Jan 19, 2017 at 9:29 PM, Tianyu Cheng via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> Hi all,
>
> I am doing a project that requires counting the number of uses of a value
> only in all dominated blocks in a function. I checked the manual for
> llvm::User
> class, but only get this
>
> unsigned <http://llvm.org/test-doxygen/api/classunsigned.html>  getNumUses
> <http://llvm.org/test-doxygen/api/classllvm_1_1Value.html#a380559e99b47632a34f74de7c1d03cc0> ()
> const
> This gives me all the uses of a value.
>
> Is there any simple way, like an API to do this?
> Or I have to manually write a method to traverse dominated basic blocks
> and count
> the number of uses?
>
> Thanks,
> Tianyu Cheng
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://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/20170119/9eff94dc/attachment.html>


More information about the llvm-dev mailing list