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