[LLVMdev] .so file creation for new passes

Andrew Lenharth andrewl at lenharth.org
Sun Apr 18 16:10:20 PDT 2010


On Sun, Apr 18, 2010 at 11:19 AM, kalyan ponnala
<ponnala.kalyan at gmail.com> wrote:
> Thanks a lot for the reply guys. So, does that mean that I cant write my own
> passes if I work on Windows side of the LLVM? Is there any other way to use
> a new pass. How are windows users supposed to work?

It is pretty easy to link in a project pass into opt.  You will need
to replicate LinkAllPasses for your pass and fiddle with makefile for
opt.  See below for an example of most of the work you would need to
do.  Note that this only matters if you want to work in a project for
your new pass rather than just working in the tree.

Andrew

Index: ../../tools/bugpoint/bugpoint.cpp
===================================================================
--- ../../tools/bugpoint/bugpoint.cpp   (revision 99812)
+++ ../../tools/bugpoint/bugpoint.cpp   (working copy)
@@ -28,6 +28,12 @@
 #include "llvm/LinkAllVMCore.h"
 using namespace llvm;

+#include "dsa/DSGraph.h"
+#include "dsa/DataStructure.h"
+#include "poolalloc/RunTimeAssociate.h"
+#include "LinkDSA.h"
+
+
 // AsChild - Specifies that this invocation of bugpoint is being
generated
 // from a parent process. It is not intended to be used by users so
the
 // option is hidden.
Index: ../../tools/bugpoint/Makefile
===================================================================
--- ../../tools/bugpoint/Makefile       (revision 99812)
+++ ../../tools/bugpoint/Makefile       (working copy)
@@ -15,3 +15,8 @@
 REQUIRES_EH := 1

 include $(LEVEL)/Makefile.common
+
+CPP.Flags += -I../../projects/poolalloc/include
+
+ExtraLibs := ../../projects/poolalloc/$(BuildMode)/lib/libpoolalloc.a
\
+       ../../projects/poolalloc/$(BuildMode)/lib/libLLVMDataStructure.a
Index: ../../tools/opt/opt.cpp
===================================================================
--- ../../tools/opt/opt.cpp     (revision 99812)
+++ ../../tools/opt/opt.cpp     (working copy)
@@ -38,6 +38,12 @@
 #include "llvm/LinkAllVMCore.h"
 #include <memory>
 #include <algorithm>
+
+#include "dsa/DSGraph.h"
+#include "dsa/DataStructure.h"
+#include "poolalloc/RunTimeAssociate.h"
+#include "LinkDSA.h"
+
 using namespace llvm;

 // The OptimizationList is automatically populated with registered
Passes by the
Index: ../../tools/opt/Makefile
===================================================================
--- ../../tools/opt/Makefile    (revision 99812)
+++ ../../tools/opt/Makefile    (working copy)
@@ -12,3 +12,8 @@
 LINK_COMPONENTS := bitreader bitwriter asmparser instrumentation scalaropts ipo

 include $(LEVEL)/Makefile.common
+
+CPP.Flags += -I../../projects/poolalloc/include
+
+ExtraLibs := ../../projects/poolalloc/$(BuildMode)/lib/libpoolalloc.a \
+       ../../projects/poolalloc/$(BuildMode)/lib/libLLVMDataStructure.a


> Thanks again.
>
>
> On Sun, Apr 18, 2010 at 7:16 AM, Anton Korobeynikov
> <anton at korobeynikov.info> wrote:
>>
>> > If you compile llvm, the Hello library will be compiled too. It's not
>> > installed but it's in build_directory/Debug/lib/LLVMHello.so (or in
>> > build_directory/Release/lib/LLVMHello.so)
>> Loadable passes are not supported on windows due to lack of OS dynamic
>> linking support (and I doubt they will be supported ever).
>>
>> --
>> With best regards, Anton Korobeynikov
>> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>
>
>
> --
> Kalyan Ponnala
> phone: 8163772059
>
> _______________________________________________
> 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