[LLVMdev] using dsa from llvm-poolalloc

John T. Criswell criswell at cs.uiuc.edu
Tue Feb 13 07:53:46 PST 2007

Ryan M. Lefever wrote:

> I have a few questions on using dsa now that it has been moved out of 
> llvm.  I have llvm -r release_19 checked out from cvs, and 
> llvm-poolalloc -r release_19 checked out from cvs into the projects 
> directory, as John Criswell previously suggested.
> 1) I have some compiler transforms that I'm writing that use DSA. They 
> can no longer find the header files for DSA. My transforms are located 
> in their own directory, outside of llvm.  I have set everything up by 
> copying the autoconf directory from the sample project into the 
> directory for my transforms.  Is there a way that I can specify the 
> path to the DSA include files when I run AutoRegen.sh from the 
> autoconf directory or the configure script generated by AutoRegen.sh, 
> so that the DSA include files will be searched when compiling my code?

First, the DSA header files are within a different relative directory.  
In your source file, you should write:

#include <dsa/headerfilename.h>

instead of:

#include <llvm/Analysis/DataStructure/headerfilename.h>

Second, you need to pass a -I<directory> option to gcc so that it knows 
where to find these header files.  The easiest thing to do is to 
hard-code the path in your Makefile.  To do that, add the following 3 
lines to your Makefile.common in your project:

CFLAGS += -I<directory to llvm-poolalloc>/include
CXXFLAGS += -I<directory to llvm-poolalloc>/include
CPPFLAGS += -I<directory to llvm-poolalloc>/include

(Note: I don't know if all of these lines are strictly necessary, but it 
works for me.)

A better approach is to create --with-poolallocsrcdir and 
--with-poolallocobjdir options that can specify the path to the 
llvm-poolalloc source and object code at configuration time.  The 
autoconf/configure.ac file in the llvm-poolalloc project has an example 
of this (except it's the --with-safecodesrc option).  If you need help 
setting that up, please let me know, and I can help.

> 2) For those that work on llvm-poolalloc, is their a way to compile 
> doxygen for llvm-poolalloc?

Not that I'm aware of.

> 3) For those that work on llvm-poolalloc, John Criswell previously 
> suggested using cvs -r release_19 of llvm, and cvs -r release_19 of 
> llvm-poolalloc.  If I want to get the latest changes to llvm-poolalloc 
> which of the following should I do?  (A) Stick with cvs -r release_19 
> of llvm and update to the latest version of llvm-poolalloc using cvs 
> update -A inside the projects/llvm-poolalloc directory.  (B) Update 
> llvm and llvm-poolalloc both to the latest versions.  (C) Some other 
> option.

(C) Some other option.

I recommend that you stick with the release_19 branch of both llvm and 
llvm-poolalloc.  I and others are actively using these branches, so 
llvm-poolalloc bug fixes will most likely be made to this branch in 
addition to mainline CVS for the forseeable future.  The release_19 
branch of llvm-poolalloc is designed to always work with the release_19 
branch of LLVM, which has a fixed API and bytecode format.

Someday, the CVS HEAD llvm-poolalloc will compile against CVS HEAD llvm, 
but it doesn't at the moment.  LLVM has undergone major changes between 
1.9 and what will be 2.0, and I was spending more time updating 
llvm-poolalloc to handle the new API changes than I was using it for my 
project.  We plan to get llvm-poolalloc working with LLVM 2.0 once the 
new LLVM API stabilizes and we have the time to do the update.

-- John T.

> Thanks,
> Ryan

More information about the llvm-dev mailing list