[llvm-commits] [llvm] r129381 - in /llvm/trunk/docs: CMake.html WritingAnLLVMPass.html
Oscar Fuentes
ofv at wanadoo.es
Tue Apr 12 12:40:35 PDT 2011
Author: ofv
Date: Tue Apr 12 14:40:35 2011
New Revision: 129381
URL: http://llvm.org/viewvc/llvm-project?rev=129381&view=rev
Log:
Document how to build a LLVM pass with CMake out of source.
Patch by arrowdodger!
Modified:
llvm/trunk/docs/CMake.html
llvm/trunk/docs/WritingAnLLVMPass.html
Modified: llvm/trunk/docs/CMake.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CMake.html?rev=129381&r1=129380&r2=129381&view=diff
==============================================================================
--- llvm/trunk/docs/CMake.html (original)
+++ llvm/trunk/docs/CMake.html Tue Apr 12 14:40:35 2011
@@ -22,6 +22,9 @@
<li><a href="#testing">Executing the test suite</a>
<li><a href="#cross">Cross compiling</a>
<li><a href="#embedding">Embedding LLVM in your project</a>
+ <ul>
+ <li><a href="#passdev">Developing LLVM pass out of source</a></li>
+ </ul></li>
<li><a href="#specifics">Compiler/Platform specific topics</a>
<ul>
<li><a href="#msvc">Microsoft Visual C++</a></li>
@@ -458,6 +461,61 @@
</div>
+<!-- ======================================================================= -->
+<div class="doc_subsection">
+ <a name="passdev">Developing LLVM pass out of source</a>
+</div>
+
+<div class="doc_text">
+
+ <p>It is possible to develop LLVM passes against installed LLVM.
+ An example of project layout provided below:</p>
+
+ <div class="doc_code">
+ <pre>
+ <project dir>/
+ |
+ CMakeLists.txt
+ <pass name>/
+ |
+ CMakeLists.txt
+ Pass.cpp
+ ...
+ </pre>
+ </div>
+
+ <p>Contents of <project dir>/CMakeLists.txt:</p>
+
+ <div class="doc_code">
+ <pre>
+ find_package(LLVM)
+
+ <b># Define add_llvm_* macro's.</b>
+ include(AddLLVM)
+
+ add_definitions(${LLVM_DEFINITIONS})
+ include_directories(${LLVM_INCLUDE_DIRS})
+ link_directories(${LLVM_LIBRARY_DIRS})
+
+ add_subdirectory(<pass name>)
+ </pre>
+ </div>
+
+ <p>Contents of <project dir>/<pass name>/CMakeLists.txt:</p>
+
+ <div class="doc_code">
+ <pre>
+ add_llvm_loadable_module(LLVMPassname
+ Pass.cpp
+ )
+ </pre>
+ </div>
+
+ <p>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:<br>
+ 1. Copying <pass name> folder into <LLVM root>/lib/Transform directory.<br>
+ 2. Adding "add_subdirectory(<pass name>)" line into <LLVM root>/lib/Transform/CMakeLists.txt</p>
+</div>
<!-- *********************************************************************** -->
<!-- *********************************************************************** -->
Modified: llvm/trunk/docs/WritingAnLLVMPass.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/WritingAnLLVMPass.html?rev=129381&r1=129380&r2=129381&view=diff
==============================================================================
--- llvm/trunk/docs/WritingAnLLVMPass.html (original)
+++ llvm/trunk/docs/WritingAnLLVMPass.html Tue Apr 12 14:40:35 2011
@@ -211,6 +211,9 @@
If your operating system uses a suffix other than .so (such as windows or
Mac OS/X), the appropriate extension will be used.</p>
+<p>If you are used CMake to build LLVM, see
+<a href="CMake.html#passdev">Developing an LLVM pass with CMake</a>.</p>
+
<p>Now that we have the build scripts set up, we just need to write the code for
the pass itself.</p>
More information about the llvm-commits
mailing list