[llvm-commits] [llvm] r43332 - in /llvm/trunk/docs/tutorial: JITTutorial1.html JITTutorial2.html
Owen Anderson
resistor at mac.com
Wed Oct 24 23:49:31 PDT 2007
Author: resistor
Date: Thu Oct 25 01:49:29 2007
New Revision: 43332
URL: http://llvm.org/viewvc/llvm-project?rev=43332&view=rev
Log:
More tutorial cleanups.
Modified:
llvm/trunk/docs/tutorial/JITTutorial1.html
llvm/trunk/docs/tutorial/JITTutorial2.html
Modified: llvm/trunk/docs/tutorial/JITTutorial1.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/JITTutorial1.html?rev=43332&r1=43331&r2=43332&view=diff
==============================================================================
--- llvm/trunk/docs/tutorial/JITTutorial1.html (original)
+++ llvm/trunk/docs/tutorial/JITTutorial1.html Thu Oct 25 01:49:29 2007
@@ -50,7 +50,18 @@
<p>If you're unsure what the above code says, skim through the <a href="../LangRef.html">LLVM Language Reference Manual</a> and convince yourself that the above LLVM IR is actually equivalent to the original function. Once youâre satisfied with that, letâs move on to actually generating it programmatically!</p>
-<p>... STUFF ABOUT HEADERS ... </p>
+<p>Of course, before we can start, we need to <code>#include</code> the appropriate LLVM header files:</p>
+
+<div class="doc_code">
+<pre>
+#include <llvm/Module.h>
+#include <llvm/Function.h>
+#include <llvm/PassManager.h>
+#include <llvm/Analysis/Verifier.h>
+#include <llvm/Assembly/PrintModulePass.h>
+#include <llvm/Support/LLVMBuilder.h>
+</pre>
+</div>
<p>Now, letâs get started on our real program. Hereâs what our basic <code>main()</code> will look like:</p>
@@ -153,9 +164,16 @@
<p>The final step in creating our function is to create the instructions that make it up. Our <code>mul_add</code> function is composed of just three instructions: a multiply, an add, and a return. <code>LLVMBuilder</code> gives us a simple interface for constructing these instructions and appending them to the âentryâ block. Each of the calls to <code>LLVMBuilder</code> returns a <code>Value*</code> that represents the value yielded by the instruction. Youâll also notice that, above, <code>x</code>, <code>y</code>, and <code>z</code> are also <code>Value*</code>âs, so itâs clear that instructions operate on <code>Value*</code>âs.</p>
-<p>And thatâs it! Now you can compile and run your code, and get a wonder textual print out of the LLVM IR we saw at the beginning.</p>
+<p>And thatâs it! Now you can compile and run your code, and get a wonderful textual print out of the LLVM IR we saw at the beginning. To compile, use the following commandline as a guide:</p>
+
+<div class="doc_code">
+<pre>
+# c++ -g tut2.cpp `llvm-config --cppflags --ldflags --libs core` -o tut2
+# ./tut2
+</pre>
+</div>
-<p> ... SECTION ABOUT USING llvm-config TO GET THE NECESSARY COMPILER FLAGS TO COMPILE YOUR CODE ... </p>
+<p>The <code>llvm-config</code> utility is used to obtain the necessary GCC-compatible compiler flags for linking with LLVM. For this example, we only need the 'core' library. We'll use others once we start adding optimizers and the JIT engine.</p>
</div>
Modified: llvm/trunk/docs/tutorial/JITTutorial2.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/tutorial/JITTutorial2.html?rev=43332&r1=43331&r2=43332&view=diff
==============================================================================
--- llvm/trunk/docs/tutorial/JITTutorial2.html (original)
+++ llvm/trunk/docs/tutorial/JITTutorial2.html Thu Oct 25 01:49:29 2007
@@ -166,8 +166,7 @@
<div class="doc_code">
<pre>
-# c++ -g tut2.cpp `llvm-config --cppflags` `llvm-config --ldflags` \
- `llvm-config --libs core` -o tut2
+# c++ -g tut2.cpp `llvm-config --cppflags --ldflags --libs core` -o tut2
# ./tut2
</pre>
</div>
More information about the llvm-commits
mailing list