[LLVMdev] Accessing Dominator Tree
criswell at illinois.edu
Fri Jul 29 07:56:20 PDT 2011
On 7/29/11 9:43 AM, david.dewey at comcast.net wrote:
> I am working on a project that requires me to perform some analysis on
> a bitcode file outside the existing LLVM analysis frameworks (opt,
> etc.). In what I am doing, I need to be able to access the dominator
> tree for a given function. Is there a way I can instantiate a
> DominatorTree object outside the existing analysis frameworks?
If you use a PassManager object to run passes, then you can simply have
your analysis be an LLVM pass and use the standard getAnalysis<>()
template function to get access to the dominator tree analysis. Any
program can create a PassManager to run LLVM passes to perform analysis
and transformation; the clang C/C++ front-end and the sc tool in
SAFECode do this.
I don't know if using a PassManager is what you consider to be "outside
the existing LLVM framework." I'm hoping your only objection is to
using the opt tool to run LLVM passes.
-- John T.
> I have tried several things all along the lines of:
> DominatorTree DT;
> Everything I have tried results in an assertion failure when trying to
> access the front() of what I assume is the DominatorTree:
> Assertion failed: !empty() && "Called front() on empty list!"
> If anyone has an example of how to do this, I would really appreciate it.
> 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