#include "llvm/Instructions.h"
#include "llvm/ModuleProvider.h"
#include "llvm/Analysis/Verifier.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;
static Function *CreateFibFunction(Module *M) {
// Create the fib function and insert it into module M. This function is said
// to return an int and take an int parameter.
- Function *FibF = M->getOrInsertFunction("fib", Type::IntTy, Type::IntTy, 0);
+ Function *FibF = M->getOrInsertFunction("fib", Type::IntTy, Type::IntTy,
+ (Type *)0);
// Add a basic block to the function.
BasicBlock *BB = new BasicBlock("EntryBlock", FibF);
// Get pointers to the constants.
- Value *One = ConstantSInt::get(Type::IntTy, 1);
- Value *Two = ConstantSInt::get(Type::IntTy, 2);
+ Value *One = ConstantInt::get(Type::IntTy, 1);
+ Value *Two = ConstantInt::get(Type::IntTy, 2);
// Get pointer to the integer argument of the add1 function...
Argument *ArgX = FibF->arg_begin(); // Get the arg.
// create fib(x-1)
Value *Sub = BinaryOperator::createSub(ArgX, One, "arg", RecurseBB);
- Value *CallFibX1 = new CallInst(FibF, Sub, "fibx1", RecurseBB);
- CallFibX1->setTailCall(true);
+ CallInst *CallFibX1 = new CallInst(FibF, Sub, "fibx1", RecurseBB);
+ CallFibX1->setTailCall();
// create fib(x-2)
Sub = BinaryOperator::createSub(ArgX, Two, "arg", RecurseBB);
- Value *CallFibX2 = new CallInst(FibF, Sub, "fibx2", RecurseBB);
- CallFibX2->setTailCall(true);
+ CallInst *CallFibX2 = new CallInst(FibF, Sub, "fibx2", RecurseBB);
+ CallFibX2->setTailCall();
// fib(x-1)+fib(x-2)