Hello everyone, Sorry to bother you. I'm an undergraduate, and I'm trying to finish my graduation project using LLVM. In this project, I hope to transform all loop in program to condition statement. For example, Before transformation: for (int i = 0; i < 5; i++) a++; After transformation: int i = 0; if (i < 5) a++; i++; The idea is very clear, however, I'm a newbie to LLVM. After read code of some LLVM's transformation, I still have no idea of how to implement this idea. Hope you can give me some hint. Thank you very much! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130417/d7850ae3/attachment.html>
Dmitry Mikushin
2013-Apr-17 11:16 UTC
[LLVMdev] How to transform loop to if-else using LLVM?
Hi, Zhiyuan Yang, Are you trying to replace the for-loop with equivalent if-goto loop? In this case, do you also need a goto after i++? LLVM IR in fact already contains exactly the goto-form of any loop, because IR has no high-level constructs like for or while. - D. 2013/4/17 zhiyuan yang <sjtu.yzy at gmail.com>> Hello everyone, > > Sorry to bother you. I'm an undergraduate, and I'm trying to finish my > graduation project using LLVM. In this project, I hope to transform all > loop in program to condition statement. For example, > Before transformation: for (int i = 0; i < 5; i++) a++; > After transformation: int i = 0; if (i < 5) a++; i++; > The idea is very clear, however, I'm a newbie to LLVM. After read code of > some LLVM's transformation, I still have no idea of how to implement this > idea. > Hope you can give me some hint. Thank you very much! > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130417/0f60fbd9/attachment.html>
Maybe Matching Threads
- [LLVMdev] How to avoid loopverify failures after replacing the backedge with an edge(latchBB to exitBB) in a looppass?
- [LLVMdev] How to avoid loopverify failures after replacing the backedge with an edge(latchBB to exitBB) in a looppass?
- [LLVMdev] How to avoid loopverify failures after replacing the backedge with an edge(latchBB to exitBB) in a looppass?
- [PATCH] kinit/nfsmount.c path from bootp
- Proper way to define cbind, rbind for s4 classes in package