[LLVMdev] Aliasing on bitcode.

Eli Friedman eli.friedman at gmail.com
Mon Jul 13 16:03:24 PDT 2009

On Mon, Jul 13, 2009 at 3:28 PM, saman aliari<samy_442 at yahoo.com> wrote:
> I am working on a LLVM bitcode based project in which we do static lockset
> analysis. I need to get Aliasing information statically given the .bc file
> of the application. Is there any library in LLVM which already implements
> the aliasing?

There's an alias analysis interface that comes standard with LLVM; see
include/llvm/Analysis/AliasAnalysis.h.  The standard alias analysis
pass isn't particularly powerful, though.

> (does it support multi-threaded apps?)

I'm not quite sure how alias analysis would be affected by whether an
app is multi-threaded...

> What is the best way of
> doing it (I want to extract aliasing information in runOnModule() function
> in the pass I am working on)?

See http://llvm.org/docs/WritingAnLLVMPass.html#interaction .
Something like "AU.addRequired<AliasAnalysis>()" in the
getAnalysisUsage method of your pass plus a call to
"getAnalysis<AliasAnalysis>()" in runOnModule will do the trick.


More information about the llvm-dev mailing list