[llvm-dev] Find loops in LLVM bytecode
John Criswell via llvm-dev
llvm-dev at lists.llvm.org
Tue Sep 22 20:50:04 PDT 2015
On 9/22/15 8:22 PM, Jia-Ju Bai via llvm-dev wrote:
> Hi,
> I want to find simple loops in LLVM bytecode, and extract the basic
> information of the loop.
>
> For example:
> for (i=0; i<1000; i++)
> sum += i;
>
> I want to extract the bound [0, 1000), the loop variable "i" and the
> loop body (sum += i).
> What should I do?
>
> I read the LLVM API document, and find some useful classes like
> "Loop", "LoopInfo".
> But I do not know how to use them in detail.
>
> Could you please give me some help? A detailed usage may be more helpful.
I think you want to look at the LoopInfoWrapperPass (see the doxygen at
http://llvm.org/doxygen/classllvm_1_1LoopInfoWrapperPass.html). Your
pass will use the analysis results from LoopInfoWrapperPass to get
references to LoopInfo objects which can then be used to find loops (if
memory serves me correctly).
Regards,
John Criswell
> Thanks!
>
>
> Best wishes,
> Jia-Ju Bai
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
--
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell
More information about the llvm-dev
mailing list