<br><br><div class="gmail_quote">On Thu, Apr 24, 2008 at 12:25 AM, John Criswell <<a href="mailto:criswell@cs.uiuc.edu">criswell@cs.uiuc.edu</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Tianwei wrote:<br>
<div class="Ih2E3d">> On Wed, Apr 23, 2008 at 11:59 PM, John Criswell <<a href="mailto:criswell@cs.uiuc.edu">criswell@cs.uiuc.edu</a><mailto:<a href="mailto:criswell@cs.uiuc.edu">criswell@cs.uiuc.edu</a>>> wrote:<br>
> Dear Tianwei,<br>
><br>
> You can use the -analyze option to the opt tool to tell the DSA passes<br>
> to store their results in files. When you use the -analyze option, the<br>
> DSA passes will create a separate file for each function (and possible<br>
> one file to hold the globals graph). For this reason, I recommend<br>
> running opt in a special empty directory because DSA will generate *a<br>
> lot* of files.<br>
><br>
> Second, to look at these files, you run them through the dot command<br>
> from the GraphViz package to convert them into a graphic format. For<br>
> example, I use:<br>
><br>
> dot -Tpng file.dot > file.png<br>
><br>
> ... to convert the file into a PNG graphic which I can then examine<br>
> using my graphics program of choice.<br>
><br>
> John, thanks so much, but i tried the -analyze option, It didn't produce any .dot file in my working directory:<br>
> opt -analyze -load=/home/stw/llvm/install/lib/libLLVMDataStructure.so list.bc -o list-opt.bc<br>
><br>
</div>Sorry; I wasn't clear. The -analyze option is an option to opt to tell<br>
it to print analysis results instead of doing transformations. You still<br>
need to specify the analysis passes that you want run.<br>
<br>
For example, to see the local DSA results, do the following:<br>
<br>
opt -load <path to libLLVMDataStructure.so> -analyze -datastructure list.bc<br>
<br>
To get the Top-Down results, you would do:<br>
<br>
opt -load <path to libLLVMDataStructure.so> -analyze -tddatastructure<br>
list.bc<br>
<div class="Ih2E3d"><br>
</div></blockquote><div><br>thanks so much, it works:-). but in my version, i use the following pass flag:<br> -ds-aa - Data Structure Graph Based Alias Analysis<br> -ds-opt - DSA-based simple optimizations<br>
-dsa-bu - Bottom-up Data Structure Analysis<br> -dsa-local - Local Data Structure Analysis<br> -dsa-stdlib - Standard Library Local Data Structure Analysis<br>
-dsa-td - Top-down Data Structure Analysis<br><br><br>Tianwei<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
> also the -analyze option in "-help" result shows that:<br>
> -analyze - Only perform analysis, no optimization<br>
><br>
> did I misunderstand what your said, or my building problem?<br>
><br>
> Also, you're aware that the -datastructure pass is just the local<br>
> analysis pass, correct? The inter-procedural part is in the Bottom Up,<br>
> Complete Bottom Up, and Top Down passes.<br>
> Ok, I read Chris's thesis, and only knew the basic framework, so i want to debug the code to<br>
> learn that in more depth.<br>
><br>
</div>You can also get information on DSA from the PLDI 2007 paper<br>
(<a href="http://llvm.org/pubs/2007-06-10-PLDI-DSA.html" target="_blank">http://llvm.org/pubs/2007-06-10-PLDI-DSA.html</a>).<br>
<br>
-- John T.<br>
<div><div></div><div class="Wj3C7c"><br>
> -- John T.<br>
><br>
> Tianwei wrote:<br>
><br>
>> Hi, all:<br>
>> Recently I am debugging the DSA and want to learn how it work, and now I am checking the local datastructure analysis.<br>
>> I use the following command to print the graph:<br>
>> (gdb) p g.dump()<br>
>> digraph DataStructures {<br>
>> label="Function addG";<br>
>><br>
>> Node0xe1f3a0 [shape=record,shape=Mrecord,label="{ i32: MRE\n|{<g0>}}"];<br>
>> Node0xe1f4d0 [shape=record,shape=Mrecord,label="{ i32*: SMR\n|{<g0>|<g1>}}"];<br>
>> Node0xe1f4d0:g0 -> Node0xe1f3a0;<br>
>> Node0xe20900 [shape=record,shape=Mrecord,label="{ i32: GR\n @global\n|{<g0>}}"];<br>
>> Node0xe16530[ label =" %x_addr"];<br>
>> Node0xe16530 -> Node0xe1f4d0[arrowtail=tee,color=gray63];<br>
>> Node0xe162f0[ label =" %x"];<br>
>> Node0xe162f0 -> Node0xe1f3a0[arrowtail=tee,color=gray63];<br>
>> Node0xe16950[ label =" %tmp4"];<br>
>> Node0xe16950 -> Node0xe1f3a0[arrowtail=tee,color=gray63];<br>
>> Node0xe16730[ label =" %tmp"];<br>
>> Node0xe16730 -> Node0xe1f3a0[arrowtail=tee,color=gray63];<br>
>> }<br>
>><br>
>> then I had to copy these lines out into a .dot file and use dot to convert it into a ps file.<br>
>> I note that it also provide a lot print and dump functions in Printer.cpp, such as<br>
>> void DSGraph::writeGraphToFile(std::ostream &O,<br>
>> const std::string &GraphName) const {<br>
>><br>
>> but i don't know how to use it, also there are other functions:<br>
>> // print - Print out the analysis results...<br>
>> void LocalDataStructures::print(std::ostream &O, const Module *M) const {<br>
>> if (DontPrintAnything) return;<br>
>> printCollection(*this, O, M, "ds.");<br>
>> }<br>
>> ..........<br>
>> how these functions can be used in gdb? furthermore, are there any options which i can type in command line for DSA?, such as:<br>
>> opt -load=xxxxxx -print_the_local_analysis_result list.bc -o list-opt.bc<br>
>><br>
>> also any suggestions for how to debug DSA efficiently?<br>
>><br>
>> Thanks.<br>
>><br>
>> Tianwei<br>
>><br>
>><br>
>><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
</div></div>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a><mailto:<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<div><div></div><div class="Wj3C7c">> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
><br>
><br>
> --<br>
> Sheng, Tianwei<br>
> Inst. of High Performance Computing<br>
> Dept. of Computer Sci. & Tech.<br>
> Tsinghua Univ.<br>
><br>
><br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Sheng, Tianwei<br>Inst. of High Performance Computing<br>Dept. of Computer Sci. & Tech.<br>Tsinghua Univ.