X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=examples%2FHowToUseJIT%2FHowToUseJIT.cpp;h=8fb9e5659def04eb3bf61d8a366d0f581438d79e;hb=7f71e219721a3508988382020e9df9ac27b84523;hp=31ea4f454048ccfd38b50728c767e6dc8c730724;hpb=237cef4b0b94b17ca065efad484f386f42579b61;p=oota-llvm.git diff --git a/examples/HowToUseJIT/HowToUseJIT.cpp b/examples/HowToUseJIT/HowToUseJIT.cpp index 31ea4f45404..8fb9e5659de 100644 --- a/examples/HowToUseJIT/HowToUseJIT.cpp +++ b/examples/HowToUseJIT/HowToUseJIT.cpp @@ -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 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 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);