return false;
}
-#if HAVE_LLVM == 0x307
- // llvm-3.7 has mismatched setDataLyout/getDataLayout APIs
- newModule->setDataLayout(*mpExec->getDataLayout());
-#else
newModule->setDataLayout(mpExec->getDataLayout());
-#endif
mpCurrentModule = newModule.get();
#if defined(_WIN32)
sprintf(fName, "%s.%s.asm", funcName, fileName);
#endif
-#if HAVE_LLVM == 0x306
- raw_fd_ostream fd(fName, EC, llvm::sys::fs::F_None);
- formatted_raw_ostream filestream(fd);
-#else
raw_fd_ostream filestream(fName, EC, llvm::sys::fs::F_None);
-#endif
legacy::PassManager* pMPasses = new legacy::PassManager();
auto* pTarget = mpExec->getTargetMachine();
return UndefValue::get(VectorType::get(t, mVWidth));
}
- #if HAVE_LLVM == 0x306
- Value *Builder::VINSERT(Value *vec, Value *val, uint64_t index)
- {
- return VINSERT(vec, val, C((int64_t)index));
- }
- #endif
-
Value *Builder::VBROADCAST(Value *src)
{
// check if src is already a vector
return CALLA(Callee, args);
}
- #if HAVE_LLVM > 0x306
CallInst *Builder::CALL(Value *Callee, Value* arg)
{
std::vector<Value*> args;
args.push_back(arg3);
return CALLA(Callee, args);
}
- #endif
//////////////////////////////////////////////////////////////////////////
Value *Builder::DEBUGTRAP()
// get a pointer to the first character in the constant string array
std::vector<Constant*> geplist{C(0),C(0)};
- #if HAVE_LLVM == 0x306
- Constant *strGEP = ConstantExpr::getGetElementPtr(gvPtr,geplist,false);
- #else
Constant *strGEP = ConstantExpr::getGetElementPtr(nullptr, gvPtr,geplist,false);
- #endif
// insert the pointer to the format string in the argument vector
printCallArgs[0] = strGEP;
Value* Builder::STACKSAVE()
{
Function* pfnStackSave = Intrinsic::getDeclaration(JM()->mpCurrentModule, Intrinsic::stacksave);
- #if HAVE_LLVM == 0x306
- return CALL(pfnStackSave);
- #else
return CALLA(pfnStackSave);
- #endif
}
void Builder::STACKRESTORE(Value* pSaved)
Value *Builder::VEXTRACTI128(Value* a, Constant* imm8)
{
- #if HAVE_LLVM == 0x306
- Function *func =
- Intrinsic::getDeclaration(JM()->mpCurrentModule,
- Intrinsic::x86_avx_vextractf128_si_256);
- return CALL(func, {a, imm8});
- #else
bool flag = !imm8->isZeroValue();
SmallVector<Constant*,8> idx;
for (unsigned i = 0; i < mVWidth / 2; i++) {
idx.push_back(C(flag ? i + mVWidth / 2 : i));
}
return VSHUFFLE(a, VUNDEF_I(), ConstantVector::get(idx));
- #endif
}
Value *Builder::VINSERTI128(Value* a, Value* b, Constant* imm8)
{
- #if HAVE_LLVM == 0x306
- Function *func =
- Intrinsic::getDeclaration(JM()->mpCurrentModule,
- Intrinsic::x86_avx_vinsertf128_si_256);
- return CALL(func, {a, b, imm8});
- #else
bool flag = !imm8->isZeroValue();
SmallVector<Constant*,8> idx;
for (unsigned i = 0; i < mVWidth; i++) {
idx2.push_back(C(flag ? i + mVWidth / 2 : i));
}
return VSHUFFLE(a, inter, ConstantVector::get(idx2));
- #endif
}
// rdtsc buckets macros
Value *VUNDEF_I();
Value *VUNDEF(Type* ty, uint32_t size);
Value *VUNDEF_IPTR();
-#if HAVE_LLVM == 0x306
-Value *VINSERT(Value *vec, Value *val, uint64_t index);
-#endif
Value *VBROADCAST(Value *src);
Value *VRCP(Value *va);
Value *VPLANEPS(Value* vA, Value* vB, Value* vC, Value* &vX, Value* &vY);
Value *GEP(Value* ptr, const std::initializer_list<Value*> &indexList);
Value *GEP(Value* ptr, const std::initializer_list<uint32_t> &indexList);
CallInst *CALL(Value *Callee, const std::initializer_list<Value*> &args);
-#if HAVE_LLVM > 0x306
CallInst *CALL(Value *Callee) { return CALLA(Callee); }
CallInst *CALL(Value *Callee, Value* arg);
CallInst *CALL2(Value *Callee, Value* arg1, Value* arg2);
CallInst *CALL3(Value *Callee, Value* arg1, Value* arg2, Value* arg3);
-#endif
LoadInst *LOAD(Value *BasePtr, const std::initializer_list<uint32_t> &offset, const llvm::Twine& name = "");
LoadInst *LOADV(Value *BasePtr, const std::initializer_list<Value*> &offset, const llvm::Twine& name = "");