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()
429 auto *GEP = GetElementPtrInst::CreateInBounds(getBaseElementType(Call), in replaceWithGEP()
430 Call->getArgOperand(0), IdxList, in replaceWithGEP()
431 "", Call->getIterator()); in replaceWithGEP()
432 Call->replaceAllUsesWith(GEP); in replaceWithGEP()
433 Call->eraseFromParent(); in replaceWithGEP()
436 void BPFCoreSharedInfo::removeArrayAccessCall(CallInst *Call) { in removeArrayAccessCall() argument
437 replaceWithGEP(Call, 1, 2); in removeArrayAccessCall()
440 void BPFCoreSharedInfo::removeStructAccessCall(CallInst *Call) { in removeStructAccessCall() argument
441 replaceWithGEP(Call, 0, 1); in removeStructAccessCall()
444 void BPFCoreSharedInfo::removeUnionAccessCall(CallInst *Call) { in removeUnionAccessCall() argument
445 Call->replaceAllUsesWith(Call->getArgOperand(0)); in removeUnionAccessCall()
446 Call->eraseFromParent(); in removeUnionAccessCall()
457 auto *Call = dyn_cast<CallInst>(&I); in removePreserveAccessIndexIntrinsic() local
459 if (!IsPreserveDIAccessIndexCall(Call, CInfo)) in removePreserveAccessIndexIntrinsic()
464 PreserveArrayIndexCalls.push_back(Call); in removePreserveAccessIndexIntrinsic()
466 PreserveUnionIndexCalls.push_back(Call); in removePreserveAccessIndexIntrinsic()
468 PreserveStructIndexCalls.push_back(Call); in removePreserveAccessIndexIntrinsic()
481 for (CallInst *Call : PreserveArrayIndexCalls) in removePreserveAccessIndexIntrinsic()
482 BPFCoreSharedInfo::removeArrayAccessCall(Call); in removePreserveAccessIndexIntrinsic()
483 for (CallInst *Call : PreserveStructIndexCalls) in removePreserveAccessIndexIntrinsic()
484 BPFCoreSharedInfo::removeStructAccessCall(Call); in removePreserveAccessIndexIntrinsic()
485 for (CallInst *Call : PreserveUnionIndexCalls) in removePreserveAccessIndexIntrinsic()
486 BPFCoreSharedInfo::removeUnionAccessCall(Call); in removePreserveAccessIndexIntrinsic()
543 void BPFAbstractMemberAccess::traceAICall(CallInst *Call, in traceAICall() argument
545 for (User *U : Call->users()) { in traceAICall()
551 traceBitCast(BI, Call, ParentInfo); in traceAICall()
558 AIChain[CI] = std::make_pair(Call, ParentInfo); in traceAICall()
561 BaseAICalls[Call] = ParentInfo; in traceAICall()
565 traceGEP(GI, Call, ParentInfo); in traceAICall()
567 BaseAICalls[Call] = ParentInfo; in traceAICall()
569 BaseAICalls[Call] = ParentInfo; in traceAICall()
642 auto *Call = dyn_cast<CallInst>(&I); in collectAICallChains() local
643 if (!IsPreserveDIAccessIndexCall(Call, CInfo) || in collectAICallChains()
644 AIChain.find(Call) != AIChain.end()) in collectAICallChains()
647 traceAICall(Call, CInfo); in collectAICallChains()
835 Value *BPFAbstractMemberAccess::computeBaseAndAccessKey(CallInst *Call, in computeBaseAndAccessKey() argument
844 while (Call) { in computeBaseAndAccessKey()
845 CallStack.push(std::make_pair(Call, CInfo)); in computeBaseAndAccessKey()
846 CInfo = AIChain[Call].second; in computeBaseAndAccessKey()
847 Call = AIChain[Call].first; in computeBaseAndAccessKey()
865 Call = StackElem.first; in computeBaseAndAccessKey()
991 MDNode *BPFAbstractMemberAccess::computeAccessKey(CallInst *Call, in computeAccessKey() argument
1015 cast<GlobalVariable>(Call->getArgOperand(1)->stripPointerCasts()); in computeAccessKey()
1056 bool BPFAbstractMemberAccess::transformGEPChain(CallInst *Call, in transformGEPChain() argument
1065 TypeMeta = computeAccessKey(Call, CInfo, AccessKey, IsInt32Ret); in transformGEPChain()
1067 Base = computeBaseAndAccessKey(Call, CInfo, AccessKey, TypeMeta); in transformGEPChain()
1072 BasicBlock *BB = Call->getParent(); in transformGEPChain()
1096 Call->getIterator()); in transformGEPChain()
1099 Call->getIterator()); in transformGEPChain()
1102 BPFCoreSharedInfo::insertPassThrough(M, BB, LDInst, Call); in transformGEPChain()
1103 Call->replaceAllUsesWith(PassThroughInst); in transformGEPChain()
1104 Call->eraseFromParent(); in transformGEPChain()
1120 Call->getIterator()); in transformGEPChain()
1125 BCInst->insertBefore(Call); in transformGEPChain()
1130 GEP->insertBefore(Call); in transformGEPChain()
1133 auto *BCInst2 = new BitCastInst(GEP, Call->getType()); in transformGEPChain()
1134 BCInst2->insertBefore(Call); in transformGEPChain()
1182 BPFCoreSharedInfo::insertPassThrough(M, BB, BCInst2, Call); in transformGEPChain()
1183 Call->replaceAllUsesWith(PassThroughInst); in transformGEPChain()
1184 Call->eraseFromParent(); in transformGEPChain()