From 89f6d88db334ba088672ae0753deb7d7b7509bac Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Sun, 13 Apr 2008 06:22:09 +0000 Subject: Merge LLVMBuilder and FoldingBuilder, calling the result IRBuilder. Patch by Dominic Hamon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49604 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/tutorial/JITTutorial1.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/tutorial/JITTutorial1.html') diff --git a/docs/tutorial/JITTutorial1.html b/docs/tutorial/JITTutorial1.html index 4c5a1203c9..4f57a53666 100644 --- a/docs/tutorial/JITTutorial1.html +++ b/docs/tutorial/JITTutorial1.html @@ -60,7 +60,7 @@ entry: #include <llvm/CallingConv.h> #include <llvm/Analysis/Verifier.h> #include <llvm/Assembly/PrintModulePass.h> -#include <llvm/Support/LLVMBuilder.h> +#include <llvm/Support/IRBuilder.h> @@ -143,11 +143,11 @@ Module* makeLLVMModule() {
   BasicBlock* block = new BasicBlock("entry", mul_add);
-  LLVMBuilder builder(block);
+  IRBuilder builder(block);
 
-

We create a new basic block, as you might expect, by calling its constructor. All we need to tell it is its name and the function to which it belongs. In addition, we’re creating an LLVMBuilder object, which is a convenience interface for creating instructions and appending them to the end of a block. Instructions can be created through their constructors as well, but some of their interfaces are quite complicated. Unless you need a lot of control, using LLVMBuilder will make your life simpler.

+

We create a new basic block, as you might expect, by calling its constructor. All we need to tell it is its name and the function to which it belongs. In addition, we’re creating an IRBuilder object, which is a convenience interface for creating instructions and appending them to the end of a block. Instructions can be created through their constructors as well, but some of their interfaces are quite complicated. Unless you need a lot of control, using IRBuilder will make your life simpler.

@@ -163,7 +163,7 @@ Module* makeLLVMModule() {
 
-

The final step in creating our function is to create the instructions that make it up. Our mul_add function is composed of just three instructions: a multiply, an add, and a return. LLVMBuilder gives us a simple interface for constructing these instructions and appending them to the “entry” block. Each of the calls to LLVMBuilder returns a Value* that represents the value yielded by the instruction. You’ll also notice that, above, x, y, and z are also Value*’s, so it’s clear that instructions operate on Value*’s.

+

The final step in creating our function is to create the instructions that make it up. Our mul_add function is composed of just three instructions: a multiply, an add, and a return. IRBuilder gives us a simple interface for constructing these instructions and appending them to the “entry” block. Each of the calls to IRBuilder returns a Value* that represents the value yielded by the instruction. You’ll also notice that, above, x, y, and z are also Value*’s, so it’s clear that instructions operate on Value*’s.

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 command line as a guide:

-- cgit v1.2.3-70-g09d2