[LLVMdev] Using basicaa alias analysis pass
Roel Jordans
r.jordans at tue.nl
Wed Jan 21 16:47:02 PST 2015
Hi Ahmed,
Yes, to do a new transformation using the alias analysis results you
would need to write a pass.
I'd suggest you look at the "Writing an LLVM Pass" document [1] for
information on how to get started with writing your pass and maybe have
a look at the AliasAnalysisEvaluater pass [2] for an example on how you
can extract information from the alias analysis.
Cheers,
Roel
[1] http://llvm.org/docs/WritingAnLLVMPass.html
[2]
http://llvm.org/docs/doxygen/html/AliasAnalysisEvaluator_8cpp_source.html
On 21/01/15 20:09, Sheng-Hsiu Lin wrote:
> Ahmed, Roel and Michael,
>
> Thank you so much for clarifying this for me.
>
> Now if I want to use the result of basicaa pass to do some
> transformation, I suppose I will need write a pass, correct? Is there a
> good document on this (specifically on writing a pass to act on alias
> analysis results) that I could refer to?
>
> Thanks again!
>
> Sheng-Hsiu
>
> On Wed, Jan 21, 2015 at 11:58 AM, Kuperstein, Michael M
> <michael.m.kuperstein at intel.com <mailto:michael.m.kuperstein at intel.com>>
> wrote:
>
> Specifying -basicaa only tells opt to run the basic alias analysis
> pass. ____
>
> However, since this is not a transformation pass, but, rather, an
> analysis that is meant to be used by transformations, you will not
> see any change in the bitcode.____
>
> __ __
>
> If you want to see the results in a human-readable form, you can try
> something like:____
>
> opt -basicaa -aa-eval -print-all-alias-modref-info < hello.bc____
>
> __ __
>
> Michael____
>
> __ __
>
> *From:*llvmdev-bounces at cs.uiuc.edu
> <mailto:llvmdev-bounces at cs.uiuc.edu>
> [mailto:llvmdev-bounces at cs.uiuc.edu
> <mailto:llvmdev-bounces at cs.uiuc.edu>] *On Behalf Of *Sheng-Hsiu Lin
> *Sent:* Wednesday, January 21, 2015 18:10
> *To:* llvmdev at cs.uiuc.edu <mailto:llvmdev at cs.uiuc.edu>
> *Subject:* [LLVMdev] Using basicaa alias analysis pass____
>
> __ __
>
> Hi____
>
> __ __
>
> I am completely new to LLVM, and I am trying to explore the alias
> analysis part of it. It seems to me that -basicaa is the most
> simple alias analysis pass in LLVM. So I would like to try and make
> it work (to see some alias analysis results of some sample bit
> code).____
>
> __ __
>
> What I have done is that I____
>
> __ __
>
> ---make lib/Analysis/BasicAliasAnalysis.cpp into a .so file____
>
> ---write a sample c program, hello.c, with the following code____
>
> __ __
>
> #include<stdio.h>____
>
> __ __
>
> int main()____
>
> {____
>
> int a;____
>
> int *p;____
>
> p = &a;____
>
> a = 10;____
>
> printf("Hello World");____
>
> return 0;____
>
> }____
>
> __ __
>
> ---compile the c program into bit code by doing____
>
> clang -c -emit-llvm hello.c -o hello.bc____
>
> __ __
>
> ---run the bit code through basicaa pass____
>
> opt -load lib/AliasAnalysis.so -basicaa < hello.bc > result.bc____
>
> __ __
>
> ---display the resulted bit code____
>
> llvm-dis result.bc -o -____
>
> __ __
>
> However, the resulted bit code result.bc is exactly the same as the
> original bit code hello.bc. That is no alias analysis information
> is printed on the screen or recorded in the resulting result.bc
> file.____
>
> __ __
>
> Could someone explain what I should do to get some results from
> basicaa alias analysis pass?____
>
> __ __
>
> Thank you very much. Your help is much appreciated!____
>
> __ __
>
> Sheng-Hsiu____
>
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
>
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
>
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
More information about the llvm-dev
mailing list