Lines Matching refs:Call
154 void traceAICall(CallInst *Call, CallInfo &ParentInfo);
161 bool IsPreserveDIAccessIndexCall(const CallInst *Call, CallInfo &Cinfo);
174 Value *computeBaseAndAccessKey(CallInst *Call, CallInfo &CInfo,
176 MDNode *computeAccessKey(CallInst *Call, CallInfo &CInfo,
179 bool transformGEPChain(CallInst *Call, CallInfo &CInfo);
271 static Type *getBaseElementType(const CallInst *Call) { in getBaseElementType() argument
273 return Call->getAttributes().getParamElementType(0); in getBaseElementType()
277 bool BPFAbstractMemberAccess::IsPreserveDIAccessIndexCall(const CallInst *Call, in IsPreserveDIAccessIndexCall() argument
279 if (!Call) in IsPreserveDIAccessIndexCall()
282 const auto *GV = dyn_cast<GlobalValue>(Call->getCalledOperand()); in IsPreserveDIAccessIndexCall()
287 CInfo.Metadata = Call->getMetadata(LLVMContext::MD_preserve_access_index); in IsPreserveDIAccessIndexCall()
290 CInfo.AccessIndex = getConstant(Call->getArgOperand(2)); in IsPreserveDIAccessIndexCall()
291 CInfo.Base = Call->getArgOperand(0); in IsPreserveDIAccessIndexCall()
292 CInfo.RecordAlignment = DL->getABITypeAlign(getBaseElementType(Call)); in IsPreserveDIAccessIndexCall()
297 CInfo.Metadata = Call->getMetadata(LLVMContext::MD_preserve_access_index); in IsPreserveDIAccessIndexCall()
300 CInfo.AccessIndex = getConstant(Call->getArgOperand(1)); in IsPreserveDIAccessIndexCall()
301 CInfo.Base = Call->getArgOperand(0); in IsPreserveDIAccessIndexCall()
308 CInfo.Metadata = Call->getMetadata(LLVMContext::MD_preserve_access_index); in IsPreserveDIAccessIndexCall()
311 CInfo.AccessIndex = getConstant(Call->getArgOperand(2)); in IsPreserveDIAccessIndexCall()
312 CInfo.Base = Call->getArgOperand(0); in IsPreserveDIAccessIndexCall()
313 CInfo.RecordAlignment = DL->getABITypeAlign(getBaseElementType(Call)); in IsPreserveDIAccessIndexCall()
320 uint64_t InfoKind = getConstant(Call->getArgOperand(1)); in IsPreserveDIAccessIndexCall()
328 CInfo.Metadata = Call->getMetadata(LLVMContext::MD_preserve_access_index); in IsPreserveDIAccessIndexCall()
331 uint64_t Flag = getConstant(Call->getArgOperand(1)); in IsPreserveDIAccessIndexCall()
342 CInfo.Metadata = Call->getMetadata(LLVMContext::MD_preserve_access_index); in IsPreserveDIAccessIndexCall()
345 uint64_t Flag = getConstant(Call->getArgOperand(2)); in IsPreserveDIAccessIndexCall()
361 for (auto Call : CallList) { in replaceWithGEP() local
364 Dimension = getConstant(Call->getArgOperand(DimensionIndex)); in replaceWithGEP()
367 ConstantInt::get(Type::getInt32Ty(Call->getParent()->getContext()), 0); in replaceWithGEP()
371 IdxList.push_back(Call->getArgOperand(GEPIndex)); in replaceWithGEP()
374 getBaseElementType(Call), Call->getArgOperand(0), IdxList, "", Call); in replaceWithGEP()
375 Call->replaceAllUsesWith(GEP); in replaceWithGEP()
376 Call->eraseFromParent(); in replaceWithGEP()
388 auto *Call = dyn_cast<CallInst>(&I); in removePreserveAccessIndexIntrinsic() local
390 if (!IsPreserveDIAccessIndexCall(Call, CInfo)) in removePreserveAccessIndexIntrinsic()
395 PreserveArrayIndexCalls.push_back(Call); in removePreserveAccessIndexIntrinsic()
397 PreserveUnionIndexCalls.push_back(Call); in removePreserveAccessIndexIntrinsic()
399 PreserveStructIndexCalls.push_back(Call); in removePreserveAccessIndexIntrinsic()
414 for (auto Call : PreserveUnionIndexCalls) { in removePreserveAccessIndexIntrinsic() local
415 Call->replaceAllUsesWith(Call->getArgOperand(0)); in removePreserveAccessIndexIntrinsic()
416 Call->eraseFromParent(); in removePreserveAccessIndexIntrinsic()
474 void BPFAbstractMemberAccess::traceAICall(CallInst *Call, in traceAICall() argument
476 for (User *U : Call->users()) { in traceAICall()
482 traceBitCast(BI, Call, ParentInfo); in traceAICall()
489 AIChain[CI] = std::make_pair(Call, ParentInfo); in traceAICall()
492 BaseAICalls[Call] = ParentInfo; in traceAICall()
496 traceGEP(GI, Call, ParentInfo); in traceAICall()
498 BaseAICalls[Call] = ParentInfo; in traceAICall()
500 BaseAICalls[Call] = ParentInfo; in traceAICall()
573 auto *Call = dyn_cast<CallInst>(&I); in collectAICallChains() local
574 if (!IsPreserveDIAccessIndexCall(Call, CInfo) || in collectAICallChains()
575 AIChain.find(Call) != AIChain.end()) in collectAICallChains()
578 traceAICall(Call, CInfo); in collectAICallChains()
761 Value *BPFAbstractMemberAccess::computeBaseAndAccessKey(CallInst *Call, in computeBaseAndAccessKey() argument
770 while (Call) { in computeBaseAndAccessKey()
771 CallStack.push(std::make_pair(Call, CInfo)); in computeBaseAndAccessKey()
772 CInfo = AIChain[Call].second; in computeBaseAndAccessKey()
773 Call = AIChain[Call].first; in computeBaseAndAccessKey()
791 Call = StackElem.first; in computeBaseAndAccessKey()
917 MDNode *BPFAbstractMemberAccess::computeAccessKey(CallInst *Call, in computeAccessKey() argument
936 const auto *CE = cast<ConstantExpr>(Call->getArgOperand(1)); in computeAccessKey()
978 bool BPFAbstractMemberAccess::transformGEPChain(CallInst *Call, in transformGEPChain() argument
987 TypeMeta = computeAccessKey(Call, CInfo, AccessKey, IsInt32Ret); in transformGEPChain()
989 Base = computeBaseAndAccessKey(Call, CInfo, AccessKey, TypeMeta); in transformGEPChain()
994 BasicBlock *BB = Call->getParent(); in transformGEPChain()
1017 LDInst = new LoadInst(Type::getInt32Ty(BB->getContext()), GV, "", Call); in transformGEPChain()
1019 LDInst = new LoadInst(Type::getInt64Ty(BB->getContext()), GV, "", Call); in transformGEPChain()
1022 BPFCoreSharedInfo::insertPassThrough(M, BB, LDInst, Call); in transformGEPChain()
1023 Call->replaceAllUsesWith(PassThroughInst); in transformGEPChain()
1024 Call->eraseFromParent(); in transformGEPChain()
1039 auto *LDInst = new LoadInst(Type::getInt64Ty(BB->getContext()), GV, "", Call); in transformGEPChain()
1043 BB->getInstList().insert(Call->getIterator(), BCInst); in transformGEPChain()
1048 BB->getInstList().insert(Call->getIterator(), GEP); in transformGEPChain()
1051 auto *BCInst2 = new BitCastInst(GEP, Call->getType()); in transformGEPChain()
1052 BB->getInstList().insert(Call->getIterator(), BCInst2); in transformGEPChain()
1100 BPFCoreSharedInfo::insertPassThrough(M, BB, BCInst2, Call); in transformGEPChain()
1101 Call->replaceAllUsesWith(PassThroughInst); in transformGEPChain()
1102 Call->eraseFromParent(); in transformGEPChain()