one too many l's
[oota-llvm.git] / examples / HowToUseJIT / HowToUseJIT.cpp
index 31ea4f454048ccfd38b50728c767e6dc8c730724..8fb9e5659def04eb3bf61d8a366d0f581438d79e 100644 (file)
@@ -39,7 +39,8 @@
 #include "llvm/Type.h"
 #include "llvm/Instructions.h"
 #include "llvm/ModuleProvider.h"
-#include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include "llvm/ExecutionEngine/JIT.h"
+#include "llvm/ExecutionEngine/Interpreter.h"
 #include "llvm/ExecutionEngine/GenericValue.h"
 #include <iostream>
 using namespace llvm;
@@ -51,7 +52,8 @@ int main() {
   // Create the add1 function entry and insert this entry into module M.  The
   // function will have a return type of "int" and take an argument of "int".
   // The '0' terminates the list of argument types.
-  Function *Add1F = M->getOrInsertFunction("add1", Type::IntTy, Type::IntTy, 0);
+  Function *Add1F = M->getOrInsertFunction("add1", Type::IntTy, Type::IntTy,
+                                           (Type *)0);
 
   // Add a basic block to the function. As before, it automatically inserts
   // because of the last argument.
@@ -76,7 +78,7 @@ int main() {
 
   // Now we going to create function `foo', which returns an int and takes no
   // arguments.
-  Function *FooF = M->getOrInsertFunction("foo", Type::IntTy, 0);
+  Function *FooF = M->getOrInsertFunction("foo", Type::IntTy, (Type *)0);
 
   // Add a basic block to the FooF function.
   BB = new BasicBlock("EntryBlock", FooF);
@@ -87,7 +89,8 @@ int main() {
   // Pass Ten to the call call:
   std::vector<Value*> Params;
   Params.push_back(Ten);
-  CallInst * Add1CallRes = new CallInst(Add1F, Params, "add1", BB);
+  CallInst *Add1CallRes = new CallInst(Add1F, Params, "add1", BB);
+  Add1CallRes->setTailCall(true);
 
   // Create the return instruction and add it to the basic block.
   new ReturnInst(Add1CallRes, BB);