Calling a llvm pass outside of a pass

  analysis, c++, llvm

I am new to LLVM and C++ and was trying to write some code to perform static analysis. My static analysis needs access to memory dependence info, which in LLVM can be obtained using MemoryDependenceAnalysis. This analysis generates an object of type MemoryDependenceResults, which is precisely what I need. The only ways I’ve seen this object being obtained though is through and LLVM pass and that’s not something I want. My impression is you have to write a pass to be able to use an existing pass. I was wondering is that true? Can I call a pass outside of a pass, i.e. regular code? Or alternatively can a llvm pass be invoked programmatically without needing to run the opt command?

What I need is a way to obtain this MemoryDependenceResults object in my program (which is not a pass) and then perform some more manipulations to it.

Source: Windows Questions C++