Lines Matching refs:Call

130   if (auto *Call = dyn_cast<CallInst>(I))  in isIntrinsicCall()  local
131 if (Function *Func = Call->getCalledFunction()) in isIntrinsicCall()
169 static void setParamElementType(CallInst *Call, unsigned ArgNo, Type *Type) { in setParamElementType() argument
170 LLVMContext &C = Call->getContext(); in setParamElementType()
171 Call->addParamAttr(ArgNo, Attribute::get(C, Attribute::ElementType, Type)); in setParamElementType()
174 static void setParamReadNone(CallInst *Call, unsigned ArgNo) { in setParamReadNone() argument
175 LLVMContext &C = Call->getContext(); in setParamReadNone()
176 Call->addParamAttr(ArgNo, Attribute::get(C, Attribute::ReadNone)); in setParamReadNone()
179 static void setParamReadOnly(CallInst *Call, unsigned ArgNo) { in setParamReadOnly() argument
180 LLVMContext &C = Call->getContext(); in setParamReadOnly()
181 Call->addParamAttr(ArgNo, Attribute::get(C, Attribute::ReadOnly)); in setParamReadOnly()
184 static void setParamWriteOnly(CallInst *Call, unsigned ArgNo) { in setParamWriteOnly() argument
185 LLVMContext &C = Call->getContext(); in setParamWriteOnly()
186 Call->addParamAttr(ArgNo, Attribute::get(C, Attribute::WriteOnly)); in setParamWriteOnly()
227 CallInst *Call = makeIntrinsicCall(M, Intrinsic::bpf_getelementptr_and_load, in makeGEPAndLoad() local
229 setParamElementType(Call, 0, GEP.SourceElementType); in makeGEPAndLoad()
230 Call->applyMergedLocation(mergeDILocations(GEP.Members), Load->getDebugLoc()); in makeGEPAndLoad()
231 Call->setName((*GEP.Members.rbegin())->getName()); in makeGEPAndLoad()
233 Call->setOnlyReadsMemory(); in makeGEPAndLoad()
234 Call->setOnlyAccessesArgMemory(); in makeGEPAndLoad()
235 setParamReadOnly(Call, 0); in makeGEPAndLoad()
238 Call->addParamAttr(I, Attribute::ImmArg); in makeGEPAndLoad()
239 Call->setAAMetadata(Load->getAAMetadata()); in makeGEPAndLoad()
240 return Call; in makeGEPAndLoad()
248 CallInst *Call = in makeGEPAndStore() local
251 setParamElementType(Call, 1, GEP.SourceElementType); in makeGEPAndStore()
253 setParamReadNone(Call, 0); in makeGEPAndStore()
254 Call->applyMergedLocation(mergeDILocations(GEP.Members), in makeGEPAndStore()
257 Call->setOnlyWritesMemory(); in makeGEPAndStore()
258 Call->setOnlyAccessesArgMemory(); in makeGEPAndStore()
259 setParamWriteOnly(Call, 1); in makeGEPAndStore()
262 Call->addParamAttr(I, Attribute::ImmArg); in makeGEPAndStore()
263 Call->setAAMetadata(Store->getAAMetadata()); in makeGEPAndStore()
264 return Call; in makeGEPAndStore()
267 static unsigned getOperandAsUnsigned(CallInst *Call, unsigned ArgNo) { in getOperandAsUnsigned() argument
268 if (auto *Int = dyn_cast<ConstantInt>(Call->getOperand(ArgNo))) in getOperandAsUnsigned()
272 ReportS << "Expecting ConstantInt as argument #" << ArgNo << " of " << *Call in getOperandAsUnsigned()
277 static GetElementPtrInst *reconstructGEP(CallInst *Call, int Delta) { in reconstructGEP() argument
279 Indices.append(Call->data_operands_begin() + 6 + Delta, in reconstructGEP()
280 Call->data_operands_end()); in reconstructGEP()
281 Type *GEPPointeeType = Call->getParamElementType(Delta); in reconstructGEP()
283 GetElementPtrInst::Create(GEPPointeeType, Call->getOperand(Delta), in reconstructGEP()
284 ArrayRef<Value *>(Indices), Call->getName()); in reconstructGEP()
285 GEP->setIsInBounds(getOperandAsUnsigned(Call, 5 + Delta)); in reconstructGEP()
290 static void reconstructCommon(CallInst *Call, GetElementPtrInst *GEP, T *Insn, in reconstructCommon() argument
292 Insn->setVolatile(getOperandAsUnsigned(Call, 1 + Delta)); in reconstructCommon()
293 Insn->setOrdering((AtomicOrdering)getOperandAsUnsigned(Call, 2 + Delta)); in reconstructCommon()
294 Insn->setSyncScopeID(getOperandAsUnsigned(Call, 3 + Delta)); in reconstructCommon()
295 unsigned AlignShiftValue = getOperandAsUnsigned(Call, 4 + Delta); in reconstructCommon()
297 GEP->setDebugLoc(Call->getDebugLoc()); in reconstructCommon()
298 Insn->setDebugLoc(Call->getDebugLoc()); in reconstructCommon()
299 Insn->setAAMetadata(Call->getAAMetadata()); in reconstructCommon()
303 BPFPreserveStaticOffsetPass::reconstructLoad(CallInst *Call) { in reconstructLoad() argument
304 GetElementPtrInst *GEP = reconstructGEP(Call, 0); in reconstructLoad()
305 Type *ReturnType = Call->getFunctionType()->getReturnType(); in reconstructLoad()
309 reconstructCommon(Call, GEP, Load, 0); in reconstructLoad()
314 BPFPreserveStaticOffsetPass::reconstructStore(CallInst *Call) { in reconstructStore() argument
315 GetElementPtrInst *GEP = reconstructGEP(Call, 1); in reconstructStore()
316 auto *Store = new StoreInst(Call->getOperand(0), GEP, in reconstructStore()
319 reconstructCommon(Call, GEP, Store, 1); in reconstructStore()
442 if (auto *Call = isGEPAndLoad(U)) in isPointerOperand() local
443 return Call->getArgOperand(0) == I; in isPointerOperand()
444 if (auto *Call = isGEPAndStore(U)) in isPointerOperand() local
445 return Call->getArgOperand(1) == I; in isPointerOperand()
450 if (auto *Call = dyn_cast<CallInst>(U)) in isInlineableCall() local
451 return Call->hasFnAttr(Attribute::InlineHint); in isInlineableCall()
630 auto *Call = dyn_cast<CallInst>(V); in removePAICalls() local
631 if (!Call) in removePAICalls()
634 BPFCoreSharedInfo::removeArrayAccessCall(Call); in removePAICalls()
636 BPFCoreSharedInfo::removeStructAccessCall(Call); in removePAICalls()
638 BPFCoreSharedInfo::removeUnionAccessCall(Call); in removePAICalls()
661 for (auto *Call : MarkerCalls) in rewriteFunction() local
662 removePAICalls(Call); in rewriteFunction()
664 for (auto *Call : MarkerCalls) { in rewriteFunction() local
665 if (RemovedMarkers.contains(Call)) in rewriteFunction()
667 bool StillUsed = rewriteAccessChain(Call, AllowPartial, RemovedMarkers); in rewriteFunction()
669 removeMarkerCall(Call); in rewriteFunction()