[llvm-dev] Get Num of Uses in only dominated blocks?
Tianyu Cheng via llvm-dev
llvm-dev at lists.llvm.org
Thu Jan 19 22:32:42 PST 2017
Thanks Daniel, I did not take SSA form into consideration.
Tianyu
On Fri, Jan 20, 2017 at 12:28 AM, Daniel Berlin <dberlin at dberlin.org> wrote:
> 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/20170120/a7a3b9e8/attachment.html>
More information about the llvm-dev
mailing list