From 23ba1e4faa8317e762eb95aecd786e9600e9f834 Mon Sep 17 00:00:00 2001
From: Oscar Fuentes It is possible to develop LLVM passes against installed LLVM.
+ An example of project layout provided below: Contents of <project dir>/CMakeLists.txt: Contents of <project dir>/<pass name>/CMakeLists.txt: When you are done developing your pass, you may wish to integrate it
+ into LLVM source tree. You can achieve it in two easy steps:
+ <project dir>/
+ |
+ CMakeLists.txt
+ <pass name>/
+ |
+ CMakeLists.txt
+ Pass.cpp
+ ...
+
+
+ find_package(LLVM)
+
+ # Define add_llvm_* macro's.
+ include(AddLLVM)
+
+ add_definitions(${LLVM_DEFINITIONS})
+ include_directories(${LLVM_INCLUDE_DIRS})
+ link_directories(${LLVM_LIBRARY_DIRS})
+
+ add_subdirectory(<pass name>)
+
+
+ add_llvm_loadable_module(LLVMPassname
+ Pass.cpp
+ )
+
+
+ 1. Copying <pass name> folder into <LLVM root>/lib/Transform directory.
+ 2. Adding "add_subdirectory(<pass name>)" line into <LLVM root>/lib/Transform/CMakeLists.txt
If you are used CMake to build LLVM, see +Developing an LLVM pass with CMake.
+Now that we have the build scripts set up, we just need to write the code for the pass itself.
-- 2.34.1