[LLVMdev] how to call opt tool from within interpreter
skye at cloudera.com
Mon Jan 20 14:27:41 PST 2014
Check out FunctionPassManager<http://llvm.org/docs/doxygen/html/classllvm_1_1FunctionPassManager.html>.
You can add passes to an FPM and then run it over a function, which will
cause the function to be transformed (you can use
you don't want to modify the original function). I just had to do this to
perform loop unrolling on a function, and the resulting code looked
Function* fn_copy = llvm::CloneFunction(fn, vmap, false);
bool change = fn_pass_manager.run(fn_copy);
You can also write your own passes to be run with the pass manager, see Writing
an LLVM Pass <http://llvm.org/docs/WritingAnLLVMPass.html>.
Hope that helps,
On Fri, Jan 17, 2014 at 10:18 AM, marwayusuf at feng.bu.edu.eg <
marwayusuf at feng.bu.edu.eg> wrote:
> Dear All
> Is there a way to call opt tool from within interpreter to transform some
> function's IR code?
> Note: not necessarily opt tool. What I need is to apply some arbitrary
> transformation on IR and get back the transformed IR for some function.
> Thanks in advance.
> Marwa Yusuf
> Teaching Assistant - Computer Engineering Department
> Faculty of Engineering - Benha University
> E-JUST MSc Student
> Computer Science & Engineering Dept.
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev