Fix ISPC build fail after LLVM commit 252380
This commit is contained in:
@@ -279,7 +279,11 @@ lAddModuleSymbols(llvm::Module *module, SymbolTable *symbolTable) {
|
|||||||
|
|
||||||
llvm::Module::iterator iter;
|
llvm::Module::iterator iter;
|
||||||
for (iter = module->begin(); iter != module->end(); ++iter) {
|
for (iter = module->begin(); iter != module->end(); ++iter) {
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
llvm::Function *func = iter;
|
llvm::Function *func = iter;
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
llvm::Function *func = &*iter;
|
||||||
|
#endif
|
||||||
lCreateISPCSymbol(func, symbolTable);
|
lCreateISPCSymbol(func, symbolTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -295,7 +299,11 @@ static void
|
|||||||
lCheckModuleIntrinsics(llvm::Module *module) {
|
lCheckModuleIntrinsics(llvm::Module *module) {
|
||||||
llvm::Module::iterator iter;
|
llvm::Module::iterator iter;
|
||||||
for (iter = module->begin(); iter != module->end(); ++iter) {
|
for (iter = module->begin(); iter != module->end(); ++iter) {
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
llvm::Function *func = iter;
|
llvm::Function *func = iter;
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
llvm::Function *func = &*iter;
|
||||||
|
#endif
|
||||||
if (!func->isIntrinsic())
|
if (!func->isIntrinsic())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
86
cbackend.cpp
86
cbackend.cpp
@@ -286,7 +286,11 @@ namespace {
|
|||||||
|
|
||||||
for (llvm::Module::const_named_metadata_iterator I = M.named_metadata_begin(),
|
for (llvm::Module::const_named_metadata_iterator I = M.named_metadata_begin(),
|
||||||
E = M.named_metadata_end(); I != E; ++I) {
|
E = M.named_metadata_end(); I != E; ++I) {
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
const llvm::NamedMDNode *NMD = I;
|
const llvm::NamedMDNode *NMD = I;
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
const llvm::NamedMDNode *NMD = &*I;
|
||||||
|
#endif
|
||||||
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i)
|
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i)
|
||||||
incorporateMDNode(NMD->getOperand(i));
|
incorporateMDNode(NMD->getOperand(i));
|
||||||
}
|
}
|
||||||
@@ -2403,13 +2407,17 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
std::set<llvm::Function*> StaticCtors, StaticDtors;
|
std::set<llvm::Function*> StaticCtors, StaticDtors;
|
||||||
for (llvm::Module::global_iterator I = M.global_begin(), E = M.global_end();
|
for (llvm::Module::global_iterator I = M.global_begin(), E = M.global_end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
switch (getGlobalVariableClass(I)) {
|
switch (getGlobalVariableClass(I)) {
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
switch (getGlobalVariableClass(&*I)) {
|
||||||
|
#endif
|
||||||
default: break;
|
default: break;
|
||||||
case GlobalCtors:
|
case GlobalCtors:
|
||||||
FindStaticTors(I, StaticCtors);
|
FindStaticTors(&*I, StaticCtors);
|
||||||
break;
|
break;
|
||||||
case GlobalDtors:
|
case GlobalDtors:
|
||||||
FindStaticTors(I, StaticDtors);
|
FindStaticTors(&*I, StaticDtors);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2528,7 +2536,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
if (I->isThreadLocal())
|
if (I->isThreadLocal())
|
||||||
Out << "__thread ";
|
Out << "__thread ";
|
||||||
|
|
||||||
printType(Out, I->getType()->getElementType(), false, GetValueName(I));
|
printType(Out, I->getType()->getElementType(), false, GetValueName(&*I));
|
||||||
|
|
||||||
if (I->hasExternalWeakLinkage())
|
if (I->hasExternalWeakLinkage())
|
||||||
Out << " __EXTERNAL_WEAK__";
|
Out << " __EXTERNAL_WEAK__";
|
||||||
@@ -2543,7 +2551,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
if (!I->isDeclaration()) {
|
if (!I->isDeclaration()) {
|
||||||
// Ignore special globals, such as debug info.
|
// Ignore special globals, such as debug info.
|
||||||
if (getGlobalVariableClass(I))
|
if (getGlobalVariableClass(&*I))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (I->hasLocalLinkage())
|
if (I->hasLocalLinkage())
|
||||||
@@ -2556,7 +2564,7 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
Out << "__thread ";
|
Out << "__thread ";
|
||||||
|
|
||||||
printType(Out, I->getType()->getElementType(), false,
|
printType(Out, I->getType()->getElementType(), false,
|
||||||
GetValueName(I));
|
GetValueName(&*I));
|
||||||
|
|
||||||
if (I->hasLinkOnceLinkage())
|
if (I->hasLinkOnceLinkage())
|
||||||
Out << " __attribute__((common))";
|
Out << " __attribute__((common))";
|
||||||
@@ -2589,7 +2597,11 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
case llvm::Intrinsic::uadd_with_overflow:
|
case llvm::Intrinsic::uadd_with_overflow:
|
||||||
case llvm::Intrinsic::sadd_with_overflow:
|
case llvm::Intrinsic::sadd_with_overflow:
|
||||||
case llvm::Intrinsic::umul_with_overflow:
|
case llvm::Intrinsic::umul_with_overflow:
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
intrinsicsToDefine.push_back(I);
|
intrinsicsToDefine.push_back(I);
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
intrinsicsToDefine.push_back(&*I);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@@ -2617,14 +2629,24 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
|
|
||||||
if (I->hasExternalWeakLinkage())
|
if (I->hasExternalWeakLinkage())
|
||||||
Out << "extern ";
|
Out << "extern ";
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
printFunctionSignature(I, true);
|
printFunctionSignature(I, true);
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
printFunctionSignature(&*I, true);
|
||||||
|
#endif
|
||||||
if (I->hasWeakLinkage() || I->hasLinkOnceLinkage())
|
if (I->hasWeakLinkage() || I->hasLinkOnceLinkage())
|
||||||
Out << " __ATTRIBUTE_WEAK__";
|
Out << " __ATTRIBUTE_WEAK__";
|
||||||
if (I->hasExternalWeakLinkage())
|
if (I->hasExternalWeakLinkage())
|
||||||
Out << " __EXTERNAL_WEAK__";
|
Out << " __EXTERNAL_WEAK__";
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
if (StaticCtors.count(I))
|
if (StaticCtors.count(I))
|
||||||
Out << " __ATTRIBUTE_CTOR__";
|
Out << " __ATTRIBUTE_CTOR__";
|
||||||
if (StaticDtors.count(I))
|
if (StaticDtors.count(I))
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
if (StaticCtors.count(&*I))
|
||||||
|
Out << " __ATTRIBUTE_CTOR__";
|
||||||
|
if (StaticDtors.count(&*I))
|
||||||
|
#endif
|
||||||
Out << " __ATTRIBUTE_DTOR__";
|
Out << " __ATTRIBUTE_DTOR__";
|
||||||
if (I->hasHiddenVisibility())
|
if (I->hasHiddenVisibility())
|
||||||
Out << " __HIDDEN__";
|
Out << " __HIDDEN__";
|
||||||
@@ -2687,7 +2709,11 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
I != E; ++I)
|
I != E; ++I)
|
||||||
if (!I->isDeclaration()) {
|
if (!I->isDeclaration()) {
|
||||||
// Ignore special globals, such as debug info.
|
// Ignore special globals, such as debug info.
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
if (getGlobalVariableClass(I))
|
if (getGlobalVariableClass(I))
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
if (getGlobalVariableClass(&*I))
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (I->hasLocalLinkage())
|
if (I->hasLocalLinkage())
|
||||||
@@ -2704,7 +2730,11 @@ bool CWriter::doInitialization(llvm::Module &M) {
|
|||||||
Out << "__thread ";
|
Out << "__thread ";
|
||||||
|
|
||||||
printType(Out, I->getType()->getElementType(), false,
|
printType(Out, I->getType()->getElementType(), false,
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
GetValueName(I));
|
GetValueName(I));
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
GetValueName(&*I));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (I->hasLinkOnceLinkage())
|
if (I->hasLinkOnceLinkage())
|
||||||
Out << " __attribute__((common))";
|
Out << " __attribute__((common))";
|
||||||
@@ -3140,7 +3170,11 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
|||||||
for (; I != E; ++I) {
|
for (; I != E; ++I) {
|
||||||
if (PrintedArg) FunctionInnards << ", ";
|
if (PrintedArg) FunctionInnards << ", ";
|
||||||
if (I->hasName() || !Prototype)
|
if (I->hasName() || !Prototype)
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
ArgName = GetValueName(I);
|
ArgName = GetValueName(I);
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
ArgName = GetValueName(&*I);
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
ArgName = "";
|
ArgName = "";
|
||||||
llvm::Type *ArgTy = I->getType();
|
llvm::Type *ArgTy = I->getType();
|
||||||
@@ -3150,7 +3184,11 @@ void CWriter::printFunctionSignature(const llvm::Function *F, bool Prototype) {
|
|||||||
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
if (PAL.getParamAttributes(Idx).hasAttribute(llvm::AttributeSet::FunctionIndex, llvm::Attribute::ByVal)) {
|
||||||
#endif
|
#endif
|
||||||
ArgTy = llvm::cast<llvm::PointerType>(ArgTy)->getElementType();
|
ArgTy = llvm::cast<llvm::PointerType>(ArgTy)->getElementType();
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
ByValParams.insert(I);
|
ByValParams.insert(I);
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
ByValParams.insert(&*I);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
printType(FunctionInnards, ArgTy,
|
printType(FunctionInnards, ArgTy,
|
||||||
#if ISPC_LLVM_VERSION == ISPC_LLVM_3_2
|
#if ISPC_LLVM_VERSION == ISPC_LLVM_3_2
|
||||||
@@ -3259,7 +3297,7 @@ void CWriter::printFunction(llvm::Function &F) {
|
|||||||
|
|
||||||
Out << " ";
|
Out << " ";
|
||||||
printType(Out, F.arg_begin()->getType(), false,
|
printType(Out, F.arg_begin()->getType(), false,
|
||||||
GetValueName(F.arg_begin()));
|
GetValueName(&*(F.arg_begin())));
|
||||||
Out << " = &StructReturn;\n";
|
Out << " = &StructReturn;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3304,11 +3342,11 @@ void CWriter::printFunction(llvm::Function &F) {
|
|||||||
|
|
||||||
// print the basic blocks
|
// print the basic blocks
|
||||||
for (llvm::Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
|
for (llvm::Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) {
|
||||||
if (llvm::Loop *L = LI->getLoopFor(BB)) {
|
if (llvm::Loop *L = LI->getLoopFor(&*BB)) {
|
||||||
if (L->getHeader() == BB && L->getParentLoop() == 0)
|
if (L->getHeader() == BB && L->getParentLoop() == 0)
|
||||||
printLoop(L);
|
printLoop(L);
|
||||||
} else {
|
} else {
|
||||||
printBasicBlock(BB);
|
printBasicBlock(&*BB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3349,10 +3387,10 @@ void CWriter::printBasicBlock(llvm::BasicBlock *BB) {
|
|||||||
// Output all of the instructions in the basic block...
|
// Output all of the instructions in the basic block...
|
||||||
for (llvm::BasicBlock::iterator II = BB->begin(), E = --BB->end(); II != E;
|
for (llvm::BasicBlock::iterator II = BB->begin(), E = --BB->end(); II != E;
|
||||||
++II) {
|
++II) {
|
||||||
if (!isInlinableInst(*II) && !isDirectAlloca(II)) {
|
if (!isInlinableInst(*II) && !isDirectAlloca(&*II)) {
|
||||||
if (II->getType() != llvm::Type::getVoidTy(BB->getContext()) &&
|
if (II->getType() != llvm::Type::getVoidTy(BB->getContext()) &&
|
||||||
!isInlineAsm(*II))
|
!isInlineAsm(*II))
|
||||||
outputLValue(II);
|
outputLValue(&*II);
|
||||||
else
|
else
|
||||||
Out << " ";
|
Out << " ";
|
||||||
writeInstComputationInline(*II);
|
writeInstComputationInline(*II);
|
||||||
@@ -3456,12 +3494,20 @@ void CWriter::printPHICopiesForSuccessor (llvm::BasicBlock *CurBlock,
|
|||||||
llvm::BasicBlock *Successor,
|
llvm::BasicBlock *Successor,
|
||||||
unsigned Indent) {
|
unsigned Indent) {
|
||||||
for (llvm::BasicBlock::iterator I = Successor->begin(); llvm::isa<llvm::PHINode>(I); ++I) {
|
for (llvm::BasicBlock::iterator I = Successor->begin(); llvm::isa<llvm::PHINode>(I); ++I) {
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
llvm::PHINode *PN = llvm::cast<llvm::PHINode>(I);
|
llvm::PHINode *PN = llvm::cast<llvm::PHINode>(I);
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
llvm::PHINode *PN = llvm::cast<llvm::PHINode>(&*I);
|
||||||
|
#endif
|
||||||
// Now we have to do the printing.
|
// Now we have to do the printing.
|
||||||
llvm::Value *IV = PN->getIncomingValueForBlock(CurBlock);
|
llvm::Value *IV = PN->getIncomingValueForBlock(CurBlock);
|
||||||
if (!llvm::isa<llvm::UndefValue>(IV)) {
|
if (!llvm::isa<llvm::UndefValue>(IV)) {
|
||||||
Out << std::string(Indent, ' ');
|
Out << std::string(Indent, ' ');
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
Out << " " << GetValueName(I) << "__PHI = ";
|
Out << " " << GetValueName(I) << "__PHI = ";
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
Out << " " << GetValueName(&*I) << "__PHI = ";
|
||||||
|
#endif
|
||||||
writeOperand(IV);
|
writeOperand(IV);
|
||||||
Out << "; /* for PHI node */\n";
|
Out << "; /* for PHI node */\n";
|
||||||
}
|
}
|
||||||
@@ -4089,14 +4135,18 @@ void CWriter::lowerIntrinsics(llvm::Function &F) {
|
|||||||
llvm::Instruction *Before = 0;
|
llvm::Instruction *Before = 0;
|
||||||
if (CI != &BB->front())
|
if (CI != &BB->front())
|
||||||
#if ISPC_LLVM_VERSION >= ISPC_LLVM_3_5 // LLVM 3.5+
|
#if ISPC_LLVM_VERSION >= ISPC_LLVM_3_5 // LLVM 3.5+
|
||||||
Before = std::prev(llvm::BasicBlock::iterator(CI));
|
Before = &*std::prev(llvm::BasicBlock::iterator(CI));
|
||||||
#else
|
#else
|
||||||
Before = prior(llvm::BasicBlock::iterator(CI));
|
Before = prior(llvm::BasicBlock::iterator(CI));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IL->LowerIntrinsicCall(CI);
|
IL->LowerIntrinsicCall(CI);
|
||||||
if (Before) { // Move iterator to instruction after call
|
if (Before) { // Move iterator to instruction after call
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
I = Before; ++I;
|
I = Before; ++I;
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
I = Before->getIterator(); ++I;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
I = BB->begin();
|
I = BB->begin();
|
||||||
}
|
}
|
||||||
@@ -4321,7 +4371,7 @@ bool CWriter::visitBuiltinCall(llvm::CallInst &I, llvm::Intrinsic::ID ID,
|
|||||||
if (I.getParent()->getParent()->arg_empty())
|
if (I.getParent()->getParent()->arg_empty())
|
||||||
Out << "vararg_dummy_arg";
|
Out << "vararg_dummy_arg";
|
||||||
else
|
else
|
||||||
writeOperand(--I.getParent()->getParent()->arg_end());
|
writeOperand(&*(--I.getParent()->getParent()->arg_end()));
|
||||||
Out << ')';
|
Out << ')';
|
||||||
return true;
|
return true;
|
||||||
case llvm::Intrinsic::vaend:
|
case llvm::Intrinsic::vaend:
|
||||||
@@ -5000,8 +5050,8 @@ SmearCleanupPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
for (llvm::BasicBlock::iterator iter = bb.begin(), e = bb.end(); iter != e; ++iter) {
|
for (llvm::BasicBlock::iterator iter = bb.begin(), e = bb.end(); iter != e; ++iter) {
|
||||||
llvm::Value *smearValue = NULL;
|
llvm::Value *smearValue = NULL;
|
||||||
|
|
||||||
if (!(smearValue = getInsertChainSmearValue(iter)) &&
|
if (!(smearValue = getInsertChainSmearValue(&*iter)) &&
|
||||||
!(smearValue = getShuffleSmearValue(iter))) {
|
!(smearValue = getShuffleSmearValue(&*iter))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5029,7 +5079,7 @@ SmearCleanupPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
llvm::CallInst::Create(smearFunc, argArray, LLVMGetName(smearValue, "_smear"),
|
llvm::CallInst::Create(smearFunc, argArray, LLVMGetName(smearValue, "_smear"),
|
||||||
(llvm::Instruction *)NULL);
|
(llvm::Instruction *)NULL);
|
||||||
|
|
||||||
ReplaceInstWithInst(iter, smearCall);
|
ReplaceInstWithInst(&*iter, smearCall);
|
||||||
|
|
||||||
modifiedAny = true;
|
modifiedAny = true;
|
||||||
goto restart;
|
goto restart;
|
||||||
@@ -5128,7 +5178,7 @@ AndCmpCleanupPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
(llvm::Instruction *)NULL);
|
(llvm::Instruction *)NULL);
|
||||||
|
|
||||||
// And replace the original AND instruction with it.
|
// And replace the original AND instruction with it.
|
||||||
llvm::ReplaceInstWithInst(iter, cmpCall);
|
llvm::ReplaceInstWithInst(&*iter, cmpCall);
|
||||||
|
|
||||||
modifiedAny = true;
|
modifiedAny = true;
|
||||||
goto restart;
|
goto restart;
|
||||||
@@ -5270,7 +5320,7 @@ MaskOpsCleanupPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
llvm::ArrayRef<llvm::Value *> arg(val);
|
llvm::ArrayRef<llvm::Value *> arg(val);
|
||||||
llvm::CallInst *notCall = llvm::CallInst::Create(notFunc, arg,
|
llvm::CallInst *notCall = llvm::CallInst::Create(notFunc, arg,
|
||||||
bop->getName());
|
bop->getName());
|
||||||
ReplaceInstWithInst(iter, notCall);
|
ReplaceInstWithInst(&*iter, notCall);
|
||||||
modifiedAny = true;
|
modifiedAny = true;
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
@@ -5292,7 +5342,7 @@ MaskOpsCleanupPass::runOnBasicBlock(llvm::BasicBlock &bb) {
|
|||||||
llvm::CallInst *andNotCall =
|
llvm::CallInst *andNotCall =
|
||||||
llvm::CallInst::Create(andNotFuncs[i], argsRef, bop->getName());
|
llvm::CallInst::Create(andNotFuncs[i], argsRef, bop->getName());
|
||||||
|
|
||||||
ReplaceInstWithInst(iter, andNotCall);
|
ReplaceInstWithInst(&*iter, andNotCall);
|
||||||
modifiedAny = true;
|
modifiedAny = true;
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
|
|||||||
23
func.cpp
23
func.cpp
@@ -262,6 +262,7 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
|
|||||||
// pointer to the structure that holds all of the arguments, the
|
// pointer to the structure that holds all of the arguments, the
|
||||||
// thread index, and the thread count variables.
|
// thread index, and the thread count variables.
|
||||||
llvm::Function::arg_iterator argIter = function->arg_begin();
|
llvm::Function::arg_iterator argIter = function->arg_begin();
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
llvm::Value *structParamPtr = argIter++;
|
llvm::Value *structParamPtr = argIter++;
|
||||||
llvm::Value *threadIndex = argIter++;
|
llvm::Value *threadIndex = argIter++;
|
||||||
llvm::Value *threadCount = argIter++;
|
llvm::Value *threadCount = argIter++;
|
||||||
@@ -273,7 +274,19 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
|
|||||||
llvm::Value *taskCount0 = argIter++;
|
llvm::Value *taskCount0 = argIter++;
|
||||||
llvm::Value *taskCount1 = argIter++;
|
llvm::Value *taskCount1 = argIter++;
|
||||||
llvm::Value *taskCount2 = argIter++;
|
llvm::Value *taskCount2 = argIter++;
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
llvm::Value *structParamPtr = &*(argIter++);
|
||||||
|
llvm::Value *threadIndex = &*(argIter++);
|
||||||
|
llvm::Value *threadCount = &*(argIter++);
|
||||||
|
llvm::Value *taskIndex = &*(argIter++);
|
||||||
|
llvm::Value *taskCount = &*(argIter++);
|
||||||
|
llvm::Value *taskIndex0 = &*(argIter++);
|
||||||
|
llvm::Value *taskIndex1 = &*(argIter++);
|
||||||
|
llvm::Value *taskIndex2 = &*(argIter++);
|
||||||
|
llvm::Value *taskCount0 = &*(argIter++);
|
||||||
|
llvm::Value *taskCount1 = &*(argIter++);
|
||||||
|
llvm::Value *taskCount2 = &*(argIter++);
|
||||||
|
#endif
|
||||||
// Copy the function parameter values from the structure into local
|
// Copy the function parameter values from the structure into local
|
||||||
// storage
|
// storage
|
||||||
for (unsigned int i = 0; i < args.size(); ++i)
|
for (unsigned int i = 0; i < args.size(); ++i)
|
||||||
@@ -333,7 +346,11 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
|
|||||||
// Allocate stack storage for the parameter and emit code
|
// Allocate stack storage for the parameter and emit code
|
||||||
// to store the its value there.
|
// to store the its value there.
|
||||||
sym->storagePtr = ctx->AllocaInst(argIter->getType(), sym->name.c_str());
|
sym->storagePtr = ctx->AllocaInst(argIter->getType(), sym->name.c_str());
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
ctx->StoreInst(argIter, sym->storagePtr);
|
ctx->StoreInst(argIter, sym->storagePtr);
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
ctx->StoreInst(&*argIter, sym->storagePtr);
|
||||||
|
#endif
|
||||||
ctx->EmitFunctionParameterDebugInfo(sym, i);
|
ctx->EmitFunctionParameterDebugInfo(sym, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +369,11 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function,
|
|||||||
// Otherwise use the mask to set the entry mask value
|
// Otherwise use the mask to set the entry mask value
|
||||||
argIter->setName("__mask");
|
argIter->setName("__mask");
|
||||||
Assert(argIter->getType() == LLVMTypes::MaskType);
|
Assert(argIter->getType() == LLVMTypes::MaskType);
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
ctx->SetFunctionMask(argIter);
|
ctx->SetFunctionMask(argIter);
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
ctx->SetFunctionMask(&*argIter);
|
||||||
|
#endif
|
||||||
Assert(++argIter == function->arg_end());
|
Assert(++argIter == function->arg_end());
|
||||||
}
|
}
|
||||||
#ifdef ISPC_NVPTX_ENABLED
|
#ifdef ISPC_NVPTX_ENABLED
|
||||||
|
|||||||
@@ -1601,7 +1601,12 @@ lExtractFirstVectorElement(llvm::Value *v,
|
|||||||
//
|
//
|
||||||
// The insertion point for the new phi node also has to be the
|
// The insertion point for the new phi node also has to be the
|
||||||
// start of the bblock of the original phi node.
|
// start of the bblock of the original phi node.
|
||||||
|
|
||||||
|
#if ISPC_LLVM_VERSION <= ISPC_LLVM_3_7 /* 3.2, 3.3, 3.4, 3.5, 3.6, 3.7 */
|
||||||
llvm::Instruction *phiInsertPos = phi->getParent()->begin();
|
llvm::Instruction *phiInsertPos = phi->getParent()->begin();
|
||||||
|
#else /* LLVM 3.8+ */
|
||||||
|
llvm::Instruction *phiInsertPos = &*(phi->getParent()->begin());
|
||||||
|
#endif
|
||||||
llvm::PHINode *scalarPhi =
|
llvm::PHINode *scalarPhi =
|
||||||
llvm::PHINode::Create(vt->getElementType(),
|
llvm::PHINode::Create(vt->getElementType(),
|
||||||
phi->getNumIncomingValues(),
|
phi->getNumIncomingValues(),
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ lStripUnusedDebugInfo(llvm::Module *module) {
|
|||||||
llvm::Module::named_metadata_iterator iter = module->named_metadata_begin();
|
llvm::Module::named_metadata_iterator iter = module->named_metadata_begin();
|
||||||
for (; iter != module->named_metadata_end(); ++iter) {
|
for (; iter != module->named_metadata_end(); ++iter) {
|
||||||
if (!strncmp(iter->getName().str().c_str(), "llvm.dbg.lv", 11))
|
if (!strncmp(iter->getName().str().c_str(), "llvm.dbg.lv", 11))
|
||||||
toErase.push_back(iter);
|
toErase.push_back(&*iter);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < (int)toErase.size(); ++i)
|
for (int i = 0; i < (int)toErase.size(); ++i)
|
||||||
module->eraseNamedMetadata(toErase[i]);
|
module->eraseNamedMetadata(toErase[i]);
|
||||||
@@ -2830,11 +2830,11 @@ lCreateDispatchFunction(llvm::Module *module, llvm::Function *setISAFunc,
|
|||||||
// Check to see if we rewrote any types in the dispatch function.
|
// Check to see if we rewrote any types in the dispatch function.
|
||||||
// If so, create bitcasts for the appropriate pointer types.
|
// If so, create bitcasts for the appropriate pointer types.
|
||||||
if (argIter->getType() == targsIter->getType()) {
|
if (argIter->getType() == targsIter->getType()) {
|
||||||
args.push_back(argIter);
|
args.push_back(&*argIter);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
llvm::CastInst *argCast =
|
llvm::CastInst *argCast =
|
||||||
llvm::CastInst::CreatePointerCast(argIter, targsIter->getType(),
|
llvm::CastInst::CreatePointerCast(&*argIter, targsIter->getType(),
|
||||||
"dpatch_arg_bitcast", callBBlock);
|
"dpatch_arg_bitcast", callBBlock);
|
||||||
args.push_back(argCast);
|
args.push_back(argCast);
|
||||||
}
|
}
|
||||||
@@ -2962,7 +2962,7 @@ lExtractOrCheckGlobals(llvm::Module *msrc, llvm::Module *mdst, bool check) {
|
|||||||
llvm::Module::global_iterator iter;
|
llvm::Module::global_iterator iter;
|
||||||
|
|
||||||
for (iter = msrc->global_begin(); iter != msrc->global_end(); ++iter) {
|
for (iter = msrc->global_begin(); iter != msrc->global_end(); ++iter) {
|
||||||
llvm::GlobalVariable *gv = iter;
|
llvm::GlobalVariable *gv = &*iter;
|
||||||
// Is it a global definition?
|
// Is it a global definition?
|
||||||
if (gv->getLinkage() == llvm::GlobalValue::ExternalLinkage &&
|
if (gv->getLinkage() == llvm::GlobalValue::ExternalLinkage &&
|
||||||
gv->hasInitializer()) {
|
gv->hasInitializer()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user