Lines Matching refs:Call
164 void traceAICall(CallInst *Call, CallInfo &ParentInfo);
171 bool IsPreserveDIAccessIndexCall(const CallInst *Call, CallInfo &Cinfo);
182 Value *computeBaseAndAccessKey(CallInst *Call, CallInfo &CInfo,
184 MDNode *computeAccessKey(CallInst *Call, CallInfo &CInfo,
186 bool transformGEPChain(CallInst *Call, CallInfo &CInfo);
321 static Type *getBaseElementType(const CallInst *Call) { in getBaseElementType() argument
323 return Call->getParamElementType(0); in getBaseElementType()
333 bool BPFAbstractMemberAccess::IsPreserveDIAccessIndexCall(const CallInst *Call, in IsPreserveDIAccessIndexCall() argument
335 if (!Call) in IsPreserveDIAccessIndexCall()
338 const auto *GV = dyn_cast<GlobalValue>(Call->getCalledOperand()); in IsPreserveDIAccessIndexCall()
343 CInfo.Metadata = Call->getMetadata(LLVMContext::MD_preserve_access_index); in IsPreserveDIAccessIndexCall()
346 CInfo.AccessIndex = getConstant(Call->getArgOperand(2)); in IsPreserveDIAccessIndexCall()
347 CInfo.Base = Call->getArgOperand(0); in IsPreserveDIAccessIndexCall()
348 CInfo.RecordAlignment = DL->getABITypeAlign(getBaseElementType(Call)); in IsPreserveDIAccessIndexCall()
353 CInfo.Metadata = Call->getMetadata(LLVMContext::MD_preserve_access_index); in IsPreserveDIAccessIndexCall()
357 CInfo.AccessIndex = getConstant(Call->getArgOperand(1)); in IsPreserveDIAccessIndexCall()
358 CInfo.Base = Call->getArgOperand(0); in IsPreserveDIAccessIndexCall()
363 CInfo.Metadata = Call->getMetadata(LLVMContext::MD_preserve_access_index); in IsPreserveDIAccessIndexCall()
367 CInfo.AccessIndex = getConstant(Call->getArgOperand(2)); in IsPreserveDIAccessIndexCall()
368 CInfo.Base = Call->getArgOperand(0); in IsPreserveDIAccessIndexCall()
369 CInfo.RecordAlignment = DL->getABITypeAlign(getBaseElementType(Call)); in IsPreserveDIAccessIndexCall()
376 uint64_t InfoKind = getConstant(Call->getArgOperand(1)); in IsPreserveDIAccessIndexCall()
384 CInfo.Metadata = Call->getMetadata(LLVMContext::MD_preserve_access_index); in IsPreserveDIAccessIndexCall()
387 uint64_t Flag = getConstant(Call->getArgOperand(1)); in IsPreserveDIAccessIndexCall()
400 CInfo.Metadata = Call->getMetadata(LLVMContext::MD_preserve_access_index); in IsPreserveDIAccessIndexCall()
403 uint64_t Flag = getConstant(Call->getArgOperand(2)); in IsPreserveDIAccessIndexCall()
416 static void replaceWithGEP(CallInst *Call, uint32_t DimensionIndex, in replaceWithGEP() argument
420 Dimension = getConstant(Call->getArgOperand(DimensionIndex)); in replaceWithGEP()
423 ConstantInt::get(Type::getInt32Ty(Call->getParent()->getContext()), 0); in replaceWithGEP()
427 IdxList.push_back(Call->getArgOperand(GEPIndex)); in replaceWithGEP()
430 getBaseElementType(Call), Call->getArgOperand(0), IdxList, "", Call); in replaceWithGEP()
431 Call->replaceAllUsesWith(GEP); in replaceWithGEP()
432 Call->eraseFromParent(); in replaceWithGEP()
435 void BPFCoreSharedInfo::removeArrayAccessCall(CallInst *Call) { in removeArrayAccessCall() argument
436 replaceWithGEP(Call, 1, 2); in removeArrayAccessCall()
439 void BPFCoreSharedInfo::removeStructAccessCall(CallInst *Call) { in removeStructAccessCall() argument
440 replaceWithGEP(Call, 0, 1); in removeStructAccessCall()
443 void BPFCoreSharedInfo::removeUnionAccessCall(CallInst *Call) { in removeUnionAccessCall() argument
444 Call->replaceAllUsesWith(Call->getArgOperand(0)); in removeUnionAccessCall()
445 Call->eraseFromParent(); in removeUnionAccessCall()
456 auto *Call = dyn_cast<CallInst>(&I); in removePreserveAccessIndexIntrinsic() local
458 if (!IsPreserveDIAccessIndexCall(Call, CInfo)) in removePreserveAccessIndexIntrinsic()
463 PreserveArrayIndexCalls.push_back(Call); in removePreserveAccessIndexIntrinsic()
465 PreserveUnionIndexCalls.push_back(Call); in removePreserveAccessIndexIntrinsic()
467 PreserveStructIndexCalls.push_back(Call); in removePreserveAccessIndexIntrinsic()
480 for (CallInst *Call : PreserveArrayIndexCalls) in removePreserveAccessIndexIntrinsic()
481 BPFCoreSharedInfo::removeArrayAccessCall(Call); in removePreserveAccessIndexIntrinsic()
482 for (CallInst *Call : PreserveStructIndexCalls) in removePreserveAccessIndexIntrinsic()
483 BPFCoreSharedInfo::removeStructAccessCall(Call); in removePreserveAccessIndexIntrinsic()
484 for (CallInst *Call : PreserveUnionIndexCalls) in removePreserveAccessIndexIntrinsic()
485 BPFCoreSharedInfo::removeUnionAccessCall(Call); in removePreserveAccessIndexIntrinsic()
542 void BPFAbstractMemberAccess::traceAICall(CallInst *Call, in traceAICall() argument
544 for (User *U : Call->users()) { in traceAICall()
550 traceBitCast(BI, Call, ParentInfo); in traceAICall()
557 AIChain[CI] = std::make_pair(Call, ParentInfo); in traceAICall()
560 BaseAICalls[Call] = ParentInfo; in traceAICall()
564 traceGEP(GI, Call, ParentInfo); in traceAICall()
566 BaseAICalls[Call] = ParentInfo; in traceAICall()
568 BaseAICalls[Call] = ParentInfo; in traceAICall()
641 auto *Call = dyn_cast<CallInst>(&I); in collectAICallChains() local
642 if (!IsPreserveDIAccessIndexCall(Call, CInfo) || in collectAICallChains()
643 AIChain.find(Call) != AIChain.end()) in collectAICallChains()
646 traceAICall(Call, CInfo); in collectAICallChains()
834 Value *BPFAbstractMemberAccess::computeBaseAndAccessKey(CallInst *Call, in computeBaseAndAccessKey() argument
843 while (Call) { in computeBaseAndAccessKey()
844 CallStack.push(std::make_pair(Call, CInfo)); in computeBaseAndAccessKey()
845 CInfo = AIChain[Call].second; in computeBaseAndAccessKey()
846 Call = AIChain[Call].first; in computeBaseAndAccessKey()
864 Call = StackElem.first; in computeBaseAndAccessKey()
990 MDNode *BPFAbstractMemberAccess::computeAccessKey(CallInst *Call, in computeAccessKey() argument
1014 cast<GlobalVariable>(Call->getArgOperand(1)->stripPointerCasts()); in computeAccessKey()
1055 bool BPFAbstractMemberAccess::transformGEPChain(CallInst *Call, in transformGEPChain() argument
1064 TypeMeta = computeAccessKey(Call, CInfo, AccessKey, IsInt32Ret); in transformGEPChain()
1066 Base = computeBaseAndAccessKey(Call, CInfo, AccessKey, TypeMeta); in transformGEPChain()
1071 BasicBlock *BB = Call->getParent(); in transformGEPChain()
1094 LDInst = new LoadInst(Type::getInt32Ty(BB->getContext()), GV, "", Call); in transformGEPChain()
1096 LDInst = new LoadInst(Type::getInt64Ty(BB->getContext()), GV, "", Call); in transformGEPChain()
1099 BPFCoreSharedInfo::insertPassThrough(M, BB, LDInst, Call); in transformGEPChain()
1100 Call->replaceAllUsesWith(PassThroughInst); in transformGEPChain()
1101 Call->eraseFromParent(); in transformGEPChain()
1116 auto *LDInst = new LoadInst(Type::getInt64Ty(BB->getContext()), GV, "", Call); in transformGEPChain()
1121 BCInst->insertBefore(Call); in transformGEPChain()
1126 GEP->insertBefore(Call); in transformGEPChain()
1129 auto *BCInst2 = new BitCastInst(GEP, Call->getType()); in transformGEPChain()
1130 BCInst2->insertBefore(Call); in transformGEPChain()
1178 BPFCoreSharedInfo::insertPassThrough(M, BB, BCInst2, Call); in transformGEPChain()
1179 Call->replaceAllUsesWith(PassThroughInst); in transformGEPChain()
1180 Call->eraseFromParent(); in transformGEPChain()