New LLVM version macro

This commit is contained in:
Anton Mitrokhin
2015-06-16 15:00:00 +03:00
parent 0b62c28436
commit 0afa3f5713
20 changed files with 559 additions and 448 deletions

View File

@@ -48,7 +48,7 @@
#include <stdio.h>
#include <map>
#if defined(LLVM_3_2)
#if ISPC_LLVM_VERSION < ISPC_LLVM_3_3
#include <llvm/Module.h>
#include <llvm/Type.h>
#include <llvm/Instructions.h>
@@ -190,7 +190,11 @@ static llvm::Value* lConvertToGenericPtr(FunctionEmitContext *ctx, llvm::Value *
llvm::Function *func_warp_index = m->module->getFunction("__warp_index");
llvm::Value *warpId = ctx->CallInst(func_warp_index, NULL, std::vector<llvm::Value*>(), "gep2gen_warp_index");
llvm::Value *offset = ctx->BinaryOperator(llvm::Instruction::Mul, warpId, LLVMInt32(numEl), "gep2gen_offset");
#if ISPC_LLVM_VERSION < ISPC_LLVM_3_7
value = llvm::GetElementPtrInst::Create(value, offset, "gep2gen_offset", ctx->GetCurrentBasicBlock());
#else
value = llvm::GetElementPtrInst::Create(NULL, value, offset, "gep2gen_offset", ctx->GetCurrentBasicBlock());
#endif
}
/* convert arrElTy* to elTy* */
@@ -1535,7 +1539,11 @@ lUpdateVaryingCounter(int dim, int nDims, FunctionEmitContext *ctx,
ptr_arrayidx_indices.push_back(LLVMInt32(0));
ptr_arrayidx_indices.push_back(laneIdx);
#if 1
#if ISPC_LLVM_VERSION < ISPC_LLVM_3_7
llvm::Instruction* ptr_arrayidx = llvm::GetElementPtrInst::Create(globalDelta, ptr_arrayidx_indices, "arrayidx", ctx->GetCurrentBasicBlock());
#else
llvm::Instruction* ptr_arrayidx = llvm::GetElementPtrInst::Create(NULL, globalDelta, ptr_arrayidx_indices, "arrayidx", ctx->GetCurrentBasicBlock());
#endif
llvm::LoadInst* int8_39 = new llvm::LoadInst(ptr_arrayidx, "", false, ctx->GetCurrentBasicBlock());
llvm::Value * int32_39 = ctx->ZExtInst(int8_39, LLVMTypes::Int32Type);