Data Structure Analysis

Hi, all

I just downloaded the latest version of llvm. I am interested in the
data structure analysis of llvm described in this year PLDI paper,
titled "Making Context-Sensitive Points-to Analysis with Heap Cloning
Practical For The Real World". However, I could not find any source
code that seem to do the analysis. I noticed that in llvm 1.9 release,
there is a subdirectory named "DataStructure" under "lib/Analysis" but
it was
removed in llvm 2.0 (the one I downloaded). Is there a reason for that?

Thanks

Haifeng

It was moved out to the poolalloc SVN repository.

-Chris

Thanks.

haifeng

A following question about how to install "poolalloc". I checked out
poolalloc from svn. But I had a problem of installing it. When I tried to run
"configure" with options "--with-llvmsrc" and "--with--llvmobj" pointing to
where the source of my llvm and objs dir are (/home/usr/Tools/llvm,
e.g.), "configure" complained error message
  "configure: error : cannot find install-sh or install.sh in
/home/usr/Tools/autoconf".
Am I doing something wrong here?

Haifeng

okay. I guess I figured it out. It seems "poolalloc" needs to be put
in llvm/projects/ directory.

Haifeng

Hi!

Haifeng He wrote:

okay. I guess I figured it out. It seems "poolalloc" needs to be put
in llvm/projects/ directory.

Yes, it will compile then. However, it seems the resulting shared
library LLVMDataStructure.so (I haven't checked the others) has some
undefined symbols. Trying to load it into the opt tool produces an error:

undefined symbol:
_ZN48_GLOBAL__N_DataStructureAA.cpp_00000000_8D4221C44DSAA2IDE

Static ID fields in pass classes seem to be lacking definitions (there
were some changes in LLVM core classes and poolalloc hasn't been yet
fully updated to reflect them). The attached patch fixes this for DSA
classes - LLVMDataStructure.so loads into opt and DSA can be performed.

Wojtek

poolalloc.patch (4.73 KB)

Thanks. I forgot to commit this change from my local tree.

Andrew

I updated the latest "poolalloc" code and the problem seems to have been fixed.
However, I am still having problem of running "poolalloc".

After compilation finished, there are several dynamic libraries
created (libpoolalloc_rt.so, libpoolalloc_fl_rt.so and
LLVMDataStructure.so). I was not sure which one I should use so I just
tried all of them with "opt -load". However, none of them seems to
work (by complaiing "-poolalloc" is unknown). When I ran test
in poolalloc directory, it gave me error complaining that
"poolalloc.so" was missing.
Am I missing anything here?

BTW, when I run llvm test, is there a flag that can turn on option to
print the test commands in details in addition to just show the test
is passed or failed?

Thank you

Haifeng

Haifeng He wrote:

I updated the latest "poolalloc" code and the problem seems to have been fixed.
However, I am still having problem of running "poolalloc".

After compilation finished, there are several dynamic libraries
created (libpoolalloc_rt.so, libpoolalloc_fl_rt.so and
LLVMDataStructure.so). I was not sure which one I should use so I just
tried all of them with "opt -load". However, none of them seems to
work (by complaiing "-poolalloc" is unknown). When I ran test
in poolalloc directory, it gave me error complaining that
"poolalloc.so" was missing.
Am I missing anything here?
  

First, you need to make sure you load LLVMDataStructure.so and
poolalloc.so into opt. You can specify the -load option multiple times,
so you use the first -load option to load LLVMDataStructure.so and the
second -load option to load poolalloc.so.

Second, you need make sure that opt can find both libraries. Either
specify the complete path to the shared library files or set
LD_LIBRARY_PATH to the directory containing LLVMDataStructure.so and
poolalloc.so.

FYI, libpoolalloc_*_rt.so are the runtime implementations of the pool
allocator memory allocator. These are linked into your program (either
at the LLVM bytecode or native code level) to provide the pool allocator
runtime functions.

BTW, when I run llvm test, is there a flag that can turn on option to
print the test commands in details in addition to just show the test
is passed or failed?
  

I believe using make VERBOSE=1 will do this.

-- John T.

Thanks.

DSA should be current against head, but poolalloc isn't. I've changed
DSA a bit so it may not compile with poolalloc as is. I haven't had
time to tackle updating poolalloc (either to head or to the dsa
changes). If you want the version from the paper, try checking out
llvm 1.8 or 1.9 and a dsa from around then. The dsa as used on the
linux kernel and in the OS work is in a branch (but we were not using
poolalloc in that work so I don't know it that one works).

Andrew

Hi, Andrew

DSA should be current against head, but poolalloc isn't. I've changed
DSA a bit so it may not compile with poolalloc as is. I haven't had
time to tackle updating poolalloc (either to head or to the dsa
changes). If you want the version from the paper, try checking out
llvm 1.8 or 1.9 and a dsa from around then. The dsa as used on the
linux kernel and in the OS work is in a branch (but we were not using
poolalloc in that work so I don't know it that one works).

Could you please let me know which branch of llvm contain DSA used on
the linux kernel? Is there any special procedure I should follow if I want
to run DSA on the linux kernel? Many thanks.

Haifeng