Lines Matching refs:CI
84 virtual void visitCallInst(CallInst &CI);
94 void visitCallBarrier(CallInst *CI);
103 void visitCallConvert(CallInst *CI, StringRef MangledName,
111 void visitCallAsyncWorkGroupCopy(CallInst *CI,
115 void transBuiltin(CallInst *CI, OCLBuiltinTransInfo &Info);
123 void transMemoryBarrier(CallInst *CI, AtomicWorkItemFenceLiterals);
127 void visitCallAllAny(spv::Op OC, CallInst *CI);
132 void transAtomicBuiltin(CallInst *CI, OCLBuiltinTransInfo &Info);
137 void visitCallAtomicWorkItemFence(CallInst *CI);
150 CallInst *visitCallAtomicCmpXchg(CallInst *CI,
155 void visitCallAtomicInit(CallInst *CI);
161 void visitCallAtomicLegacy(CallInst *CI, StringRef MangledName,
166 void visitCallAtomicCpp11(CallInst *CI, StringRef MangledName,
172 void visitCallBuiltinSimple(CallInst *CI, StringRef MangledName,
179 void visitCallGetImageSize(CallInst *CI, StringRef MangledName,
190 void visitCallGroupBuiltin(CallInst *CI, StringRef MangledName,
195 void visitCallMemFence(CallInst *CI);
197 void visitCallNDRange(CallInst *CI, const std::string &DemangledName);
200 void visitCallPipeBuiltin(CallInst *CI, StringRef MangledName,
207 void visitCallReadImageWithSampler(CallInst *CI, StringRef MangledName,
212 void visitCallReadImageMSAA(CallInst *CI, StringRef MangledName,
216 void visitCallReadWriteImage(CallInst *CI, StringRef MangledName,
227 void visitCallToAddr(CallInst *CI, StringRef MangledName,
232 void visitCallRelational(CallInst *CI, const std::string &DemangledName);
238 void visitCallVecLoadStore(CallInst *CI, StringRef MangledName,
246 void visitCallGetFence(CallInst *CI, StringRef MangledName, const std::string& DemangledName);
249 void visitCallDot(CallInst *CI);
254 void visitCallScalToVec(CallInst *CI, StringRef MangledName,
259 void visitCallGetImageChannel(CallInst *CI, StringRef MangledName,
366 OCL20ToSPIRV::visitCallInst(CallInst& CI) { in visitCallInst() argument
367 DEBUG(dbgs() << "[visistCallInst] " << CI << '\n'); in visitCallInst()
368 auto F = CI.getCalledFunction(); in visitCallInst()
379 visitCallNDRange(&CI, DemangledName); in visitCallInst()
383 visitCallAllAny(OpAll, &CI); in visitCallInst()
387 visitCallAllAny(OpAny, &CI); in visitCallInst()
392 visitCallAsyncWorkGroupCopy(&CI, DemangledName); in visitCallInst()
397 auto PCI = &CI; in visitCallInst()
418 visitCallConvert(&CI, MangledName, DemangledName); in visitCallInst()
426 visitCallGetImageSize(&CI, MangledName, DemangledName); in visitCallInst()
434 visitCallGroupBuiltin(&CI, MangledName, DemangledName); in visitCallInst()
438 visitCallPipeBuiltin(&CI, MangledName, DemangledName); in visitCallInst()
442 visitCallMemFence(&CI); in visitCallInst()
447 visitCallReadImageWithSampler(&CI, MangledName, DemangledName); in visitCallInst()
451 visitCallReadImageMSAA(&CI, MangledName, DemangledName); in visitCallInst()
457 visitCallReadWriteImage(&CI, MangledName, DemangledName); in visitCallInst()
463 visitCallToAddr(&CI, MangledName, DemangledName); in visitCallInst()
468 visitCallVecLoadStore(&CI, MangledName, DemangledName); in visitCallInst()
476 visitCallRelational(&CI, DemangledName); in visitCallInst()
481 visitCallBarrier(&CI); in visitCallInst()
485 visitCallGetFence(&CI, MangledName, DemangledName); in visitCallInst()
489 !(CI.getOperand(0)->getType()->isVectorTy())) { in visitCallInst()
490 visitCallDot(&CI); in visitCallInst()
501 visitCallScalToVec(&CI, MangledName, DemangledName); in visitCallInst()
505 visitCallGetImageChannel(&CI, MangledName, DemangledName, in visitCallInst()
510 visitCallGetImageChannel(&CI, MangledName, DemangledName, in visitCallInst()
514 visitCallBuiltinSimple(&CI, MangledName, DemangledName); in visitCallInst()
518 OCL20ToSPIRV::visitCallNDRange(CallInst *CI, in visitCallNDRange() argument
529 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallNDRange()
530 mutateCallInstSPIRV(M, CI, [=](CallInst *, std::vector<Value *> &Args){ in visitCallNDRange()
532 Args[I] = getScalarOrArray(Args[I], Len, CI); in visitCallNDRange()
537 auto C = getScalarOrArrayConstantInt(CI, T, Len, 0); in visitCallNDRange()
545 Args.push_back(getScalarOrArrayConstantInt(CI, T, Len, 0)); in visitCallNDRange()
566 OCL20ToSPIRV::visitCallAsyncWorkGroupCopy(CallInst* CI, in visitCallAsyncWorkGroupCopy() argument
568 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallAsyncWorkGroupCopy()
569 mutateCallInstSPIRV(M, CI, [=](CallInst *, std::vector<Value *> &Args){ in visitCallAsyncWorkGroupCopy()
579 OCL20ToSPIRV::visitCallAtomicCmpXchg(CallInst* CI, in visitCallAtomicCmpXchg() argument
581 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallAtomicCmpXchg()
584 mutateCallInstOCL(M, CI, [&](CallInst * CI, std::vector<Value *> &Args, in visitCallAtomicCmpXchg()
587 Args[1] = new LoadInst(Args[1], "exp", false, CI); in visitCallAtomicCmpXchg()
606 OCL20ToSPIRV::visitCallAtomicInit(CallInst* CI) { in visitCallAtomicInit() argument
607 auto ST = new StoreInst(CI->getArgOperand(1), CI->getArgOperand(0), CI); in visitCallAtomicInit()
608 ST->takeName(CI); in visitCallAtomicInit()
609 CI->dropAllReferences(); in visitCallAtomicInit()
610 CI->eraseFromParent(); in visitCallAtomicInit()
614 OCL20ToSPIRV::visitCallAllAny(spv::Op OC, CallInst* CI) { in visitCallAllAny() argument
615 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallAllAny()
617 auto Args = getArguments(CI); in visitCallAllAny()
624 "cast", CI); in visitCallAllAny()
629 CI->replaceAllUsesWith(Cast); in visitCallAllAny()
630 CI->eraseFromParent(); in visitCallAllAny()
633 M, CI, in visitCallAllAny()
640 [&](CallInst *CI) -> Instruction * { in visitCallAllAny() argument
641 return CastInst::CreateZExtOrBitCast(CI, Type::getInt32Ty(*Ctx), "", in visitCallAllAny()
642 CI->getNextNode()); in visitCallAllAny()
649 OCL20ToSPIRV::visitCallAtomicWorkItemFence(CallInst* CI) { in visitCallAtomicWorkItemFence() argument
650 transMemoryBarrier(CI, getAtomicWorkItemFenceLiterals(CI)); in visitCallAtomicWorkItemFence()
654 OCL20ToSPIRV::visitCallMemFence(CallInst* CI) { in visitCallMemFence() argument
655 transMemoryBarrier(CI, std::make_tuple( in visitCallMemFence()
656 cast<ConstantInt>(CI->getArgOperand(0))->getZExtValue(), in visitCallMemFence()
661 void OCL20ToSPIRV::transMemoryBarrier(CallInst* CI, in transMemoryBarrier() argument
663 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in transMemoryBarrier()
664 mutateCallInstSPIRV(M, CI, [=](CallInst *, std::vector<Value *> &Args){ in transMemoryBarrier()
674 OCL20ToSPIRV::visitCallAtomicLegacy(CallInst* CI, in visitCallAtomicLegacy() argument
726 transAtomicBuiltin(CI, Info); in visitCallAtomicLegacy()
730 OCL20ToSPIRV::visitCallAtomicCpp11(CallInst* CI, in visitCallAtomicCpp11() argument
760 if (CI->getNumArgOperands() < MaxOps) in visitCallAtomicCpp11()
776 transAtomicBuiltin(CI, Info); in visitCallAtomicCpp11()
780 OCL20ToSPIRV::transAtomicBuiltin(CallInst* CI, in transAtomicBuiltin() argument
782 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in transAtomicBuiltin()
783 mutateCallInstSPIRV(M, CI, [=](CallInst * CI, std::vector<Value *> &Args){ in transAtomicBuiltin() argument
815 OCL20ToSPIRV::visitCallBarrier(CallInst* CI) { in visitCallBarrier() argument
816 auto Lit = getBarrierLiterals(CI); in visitCallBarrier()
817 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallBarrier()
818 mutateCallInstSPIRV(M, CI, [=](CallInst *, std::vector<Value *> &Args){ in visitCallBarrier()
827 void OCL20ToSPIRV::visitCallConvert(CallInst* CI, in visitCallConvert() argument
829 if (eraseUselessConvert(CI, MangledName, DemangledName)) in visitCallConvert()
832 auto TargetTy = CI->getType(); in visitCallConvert()
833 auto SrcTy = CI->getArgOperand(0)->getType(); in visitCallConvert()
872 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallConvert()
873 mutateCallInstSPIRV(M, CI, [=](CallInst *, std::vector<Value *> &Args){ in visitCallConvert()
878 void OCL20ToSPIRV::visitCallGroupBuiltin(CallInst* CI, in visitCallGroupBuiltin() argument
880 auto F = CI->getCalledFunction(); in visitCallGroupBuiltin()
939 IRBuilder<> IRB(CI); in visitCallGroupBuiltin()
946 makeVector(CI, Ops, std::make_pair(Ops.begin() + 1, Ops.end())); in visitCallGroupBuiltin()
950 transBuiltin(CI, Info); in visitCallGroupBuiltin()
954 OCL20ToSPIRV::transBuiltin(CallInst* CI, in transBuiltin() argument
956 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in transBuiltin()
968 mutateCallInstSPIRV(M, CI, in transBuiltin()
976 M, CI, in transBuiltin()
983 if (NewCI->getType()->isIntegerTy() && CI->getType()->isIntegerTy()) in transBuiltin()
984 return CastInst::CreateIntegerCast(NewCI, CI->getType(), in transBuiltin()
985 Info.isRetSigned, "", CI); in transBuiltin()
988 NewCI, CI->getType(), "", CI); in transBuiltin()
994 OCL20ToSPIRV::visitCallPipeBuiltin(CallInst* CI, in visitCallPipeBuiltin() argument
1001 && CI->getNumArgOperands() > 4) in visitCallPipeBuiltin()
1005 transBuiltin(CI, Info); in visitCallPipeBuiltin()
1008 void OCL20ToSPIRV::visitCallReadImageMSAA(CallInst *CI, StringRef MangledName, in visitCallReadImageMSAA() argument
1011 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallReadImageMSAA()
1013 M, CI, in visitCallReadImageMSAA()
1018 getPostfixForReturnType(CI)); in visitCallReadImageMSAA()
1024 CallInst *CI, StringRef MangledName, const std::string &DemangledName) { in visitCallReadImageWithSampler() argument
1026 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallReadImageWithSampler()
1027 bool isRetScalar = !CI->getType()->isVectorTy(); in visitCallReadImageWithSampler()
1029 M, CI, in visitCallReadImageWithSampler()
1039 nullptr, CI, kSPIRVName::TempSampledImage); in visitCallReadImageWithSampler()
1068 [&](CallInst *CI) -> Instruction * { in visitCallReadImageWithSampler() argument
1070 return ExtractElementInst::Create(CI, getSizet(M, 0), "", in visitCallReadImageWithSampler()
1071 CI->getNextNode()); in visitCallReadImageWithSampler()
1072 return CI; in visitCallReadImageWithSampler()
1078 OCL20ToSPIRV::visitCallGetImageSize(CallInst* CI, in visitCallGetImageSize() argument
1080 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallGetImageSize()
1083 auto IsImg = isOCLImageType(CI->getArgOperand(0)->getType(), &TyName); in visitCallGetImageSize()
1092 mutateCallInstSPIRV(M, CI, in visitCallGetImageSize()
1095 Ret = CI->getType()->isIntegerTy(64) ? Type::getInt64Ty(*Ctx) in visitCallGetImageSize()
1100 return getSPIRVFuncName(OpImageQuerySize, CI->getType()); in visitCallGetImageSize()
1103 return getSPIRVFuncName(OpImageQuerySizeLod, CI->getType()); in visitCallGetImageSize()
1116 ConstantVector::get(Index), "", CI); in visitCallGetImageSize()
1122 mask, NCI->getName(), CI); in visitCallGetImageSize()
1139 OCL20ToSPIRV::eraseUselessConvert(CallInst *CI, in eraseUselessConvert() argument
1142 auto TargetTy = CI->getType(); in eraseUselessConvert()
1143 auto SrcTy = CI->getArgOperand(0)->getType(); in eraseUselessConvert()
1153 CI->getArgOperand(0)->takeName(CI); in eraseUselessConvert()
1154 SPIRVDBG(dbgs() << "[regularizeOCLConvert] " << *CI << " <- " << in eraseUselessConvert()
1155 *CI->getArgOperand(0) << '\n'); in eraseUselessConvert()
1156 CI->replaceAllUsesWith(CI->getArgOperand(0)); in eraseUselessConvert()
1157 ValuesToDelete.insert(CI); in eraseUselessConvert()
1158 ValuesToDelete.insert(CI->getCalledFunction()); in eraseUselessConvert()
1165 OCL20ToSPIRV::visitCallBuiltinSimple(CallInst* CI, in visitCallBuiltinSimple() argument
1170 transBuiltin(CI, Info); in visitCallBuiltinSimple()
1203 auto CI = dyn_cast<CallInst>(*UI); in transWorkItemBuiltinsToVariables() local
1204 assert(CI && "invalid instruction"); in transWorkItemBuiltinsToVariables()
1205 Value * NewValue = new LoadInst(BV, "", CI); in transWorkItemBuiltinsToVariables()
1206 DEBUG(dbgs() << "Transform: " << *CI << " => " << *NewValue << '\n'); in transWorkItemBuiltinsToVariables()
1209 CI->getArgOperand(0), in transWorkItemBuiltinsToVariables()
1210 "", CI); in transWorkItemBuiltinsToVariables()
1213 NewValue->takeName(CI); in transWorkItemBuiltinsToVariables()
1214 CI->replaceAllUsesWith(NewValue); in transWorkItemBuiltinsToVariables()
1215 InstList.push_back(CI); in transWorkItemBuiltinsToVariables()
1230 OCL20ToSPIRV::visitCallReadWriteImage(CallInst* CI, in visitCallReadWriteImage() argument
1250 transBuiltin(CI, Info); in visitCallReadWriteImage()
1254 OCL20ToSPIRV::visitCallToAddr(CallInst* CI, StringRef MangledName, in visitCallToAddr() argument
1257 CI->getType()->getPointerAddressSpace()); in visitCallToAddr()
1263 Info.RetTy = getInt8PtrTy(cast<PointerType>(CI->getType())); in visitCallToAddr()
1267 Ops.push_back(castToInt8Ptr(P, CI)); in visitCallToAddr()
1270 transBuiltin(CI, Info); in visitCallToAddr()
1273 void OCL20ToSPIRV::visitCallRelational(CallInst *CI, in visitCallRelational() argument
1275 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallRelational()
1280 M, CI, in visitCallRelational()
1283 if (CI->getOperand(0)->getType()->isVectorTy()) in visitCallRelational()
1286 CI->getOperand(0)->getType()->getVectorNumElements()); in visitCallRelational()
1315 OCL20ToSPIRV::visitCallVecLoadStore(CallInst* CI, in visitCallVecLoadStore() argument
1349 getPostfixForReturnType(CI); in visitCallVecLoadStore()
1353 transBuiltin(CI, Info); in visitCallVecLoadStore()
1356 void OCL20ToSPIRV::visitCallGetFence(CallInst *CI, StringRef MangledName, in visitCallGetFence() argument
1358 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallGetFence()
1362 mutateCallInstSPIRV(M, CI, [=](CallInst *, std::vector<Value *> &Args, in visitCallGetFence()
1365 return BinaryOperator::CreateLShr(NewCI, getInt32(M, 8), "", CI); in visitCallGetFence()
1370 void OCL20ToSPIRV::visitCallDot(CallInst *CI) { in visitCallDot() argument
1371 IRBuilder<> Builder(CI); in visitCallDot()
1372 Value *FMulVal = Builder.CreateFMul(CI->getOperand(0), CI->getOperand(1)); in visitCallDot()
1373 CI->replaceAllUsesWith(FMulVal); in visitCallDot()
1374 CI->dropAllReferences(); in visitCallDot()
1375 CI->removeFromParent(); in visitCallDot()
1378 void OCL20ToSPIRV::visitCallScalToVec(CallInst *CI, StringRef MangledName, in visitCallScalToVec() argument
1382 auto IsArg0Vector = isa<VectorType>(CI->getOperand(0)->getType()); in visitCallScalToVec()
1383 for (unsigned I = 1, E = CI->getNumArgOperands(); Uniform && (I != E); ++I) { in visitCallScalToVec()
1384 Uniform = isa<VectorType>(CI->getOperand(I)->getType()) == IsArg0Vector; in visitCallScalToVec()
1387 visitCallBuiltinSimple(CI, MangledName, DemangledName); in visitCallScalToVec()
1416 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallScalToVec()
1418 M, CI, in visitCallScalToVec()
1422 Args[I] = CI->getOperand(I); in visitCallScalToVec()
1425 CI->getOperand(VecPos[0])->getType()->getVectorNumElements(); in visitCallScalToVec()
1428 UndefValue::get(CI->getOperand(VecPos[0])->getType()), in visitCallScalToVec()
1429 CI->getOperand(I), getInt32(M, 0), "", CI); in visitCallScalToVec()
1431 Inst, UndefValue::get(CI->getOperand(VecPos[0])->getType()), in visitCallScalToVec()
1432 ConstantVector::getSplat(VecArgWidth, getInt32(M, 0)), "", CI); in visitCallScalToVec()
1442 void OCL20ToSPIRV::visitCallGetImageChannel(CallInst *CI, StringRef MangledName, in visitCallGetImageChannel() argument
1445 AttributeSet Attrs = CI->getCalledFunction()->getAttributes(); in visitCallGetImageChannel()
1449 mutateCallInstSPIRV(M, CI, [=](CallInst *, std::vector<Value *> &Args, in visitCallGetImageChannel()
1453 NewCI, getInt32(M, Offset), "", CI); in visitCallGetImageChannel()