Hi Himanshu,
Passes in LLVM are performed on LLVM intermediate representation (IR)
level. Thus, your original C program should be first translated to IR
using one of available frontends. Next, if you work with LLVM at code
level, module class has method dump(), that could print its current
content:
// Wrap memory buffer around string containing *input* module source.
MemoryBuffer* buffer2 = MemoryBuffer::getMemBuffer(out);
auto_ptr<Module> m2;
// Load Module m2 from source
m2.reset(ParseIR(buffer2, diag, context));
{
// Setup pass manager containing instcombine pass
PassManager manager;
manager.add(createInstructionCombiningPass());
// Apply pass manager to module m2
manager.run(*m2.get());
}
// Dump *new* content of module m2 (after performing passes).
m2.get()->dump();
Or, if you work from the outside, using "opt" tool, then it has an
equivalent option -print-module
Hope it helps,
- D.
2011/10/31 Himanshu Shekhar <imhimanshu91 at
gmail.com>:> Hello,
>
> I am getting to know how the Runtime Optimization feature of LLVM works and
> how I can use it. I want to know how I could print the results of any
> analysis and transformation pass. Say, I have a program written in c and I
> ran the edge-profiling pass onto it. Now I want to see the result. How
could
> I do it?
>
> Also if I happen to change one of the passes inside folder
> /llvm/lib/Transforms/Instrumentation (say EdgeProfiling.cpp), then what all
> do I have to do to see the changes done in the pass. Please help me with
the
> required steps.
>
> And is there any tool available which I use to see the control flow(step by
> step execution of the code) when I execute say the -insert-edge-profiling
> pass on my bitecode. If there is one, it would help me a lot to understand
> how the pass works and also in writing a new pass for my purpose.
>
> Thanks
>
> Himanshu
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>