Lines Matching full:call
131 if (auto *Call = dyn_cast<CallInst>(I))
132 if (Function *Func = Call->getCalledFunction())
170 static void setParamElementType(CallInst *Call, unsigned ArgNo, Type *Type) {
171 LLVMContext &C = Call->getContext();
172 Call->addParamAttr(ArgNo, Attribute::get(C, Attribute::ElementType, Type));
175 static void setParamReadNone(CallInst *Call, unsigned ArgNo) {
176 LLVMContext &C = Call->getContext();
177 Call->addParamAttr(ArgNo, Attribute::get(C, Attribute::ReadNone));
180 static void setParamReadOnly(CallInst *Call, unsigned ArgNo) {
181 LLVMContext &C = Call->getContext();
182 Call->addParamAttr(ArgNo, Attribute::get(C, Attribute::ReadOnly));
185 static void setParamWriteOnly(CallInst *Call, unsigned ArgNo) {
186 LLVMContext &C = Call->getContext();
187 Call->addParamAttr(ArgNo, Attribute::get(C, Attribute::WriteOnly));
228 CallInst *Call = makeIntrinsicCall(M, Intrinsic::bpf_getelementptr_and_load,
230 setParamElementType(Call, 0, GEP.SourceElementType);
231 Call->applyMergedLocation(mergeDILocations(GEP.Members), Load->getDebugLoc());
232 Call->setName((*GEP.Members.rbegin())->getName());
234 Call->setOnlyReadsMemory();
235 Call->setOnlyAccessesArgMemory();
236 setParamReadOnly(Call, 0);
239 Call->addParamAttr(I, Attribute::ImmArg);
240 Call->setAAMetadata(Load->getAAMetadata());
241 return Call;
249 CallInst *Call =
252 setParamElementType(Call, 1, GEP.SourceElementType);
254 setParamReadNone(Call, 0);
255 Call->applyMergedLocation(mergeDILocations(GEP.Members),
258 Call->setOnlyWritesMemory();
259 Call->setOnlyAccessesArgMemory();
260 setParamWriteOnly(Call, 1);
263 Call->addParamAttr(I, Attribute::ImmArg);
264 Call->setAAMetadata(Store->getAAMetadata());
265 return Call;
268 static unsigned getOperandAsUnsigned(CallInst *Call, unsigned ArgNo) {
269 if (auto *Int = dyn_cast<ConstantInt>(Call->getOperand(ArgNo)))
273 ReportS << "Expecting ConstantInt as argument #" << ArgNo << " of " << *Call
278 static GetElementPtrInst *reconstructGEP(CallInst *Call, int Delta) {
280 Indices.append(Call->data_operands_begin() + 6 + Delta,
281 Call->data_operands_end());
282 Type *GEPPointeeType = Call->getParamElementType(Delta);
284 GetElementPtrInst::Create(GEPPointeeType, Call->getOperand(Delta),
285 ArrayRef<Value *>(Indices), Call->getName());
286 GEP->setIsInBounds(getOperandAsUnsigned(Call, 5 + Delta));
291 static void reconstructCommon(CallInst *Call, GetElementPtrInst *GEP, T *Insn,
293 Insn->setVolatile(getOperandAsUnsigned(Call, 1 + Delta));
294 Insn->setOrdering((AtomicOrdering)getOperandAsUnsigned(Call, 2 + Delta));
295 Insn->setSyncScopeID(getOperandAsUnsigned(Call, 3 + Delta));
296 unsigned AlignShiftValue = getOperandAsUnsigned(Call, 4 + Delta);
298 GEP->setDebugLoc(Call->getDebugLoc());
299 Insn->setDebugLoc(Call->getDebugLoc());
300 Insn->setAAMetadata(Call->getAAMetadata());
304 BPFPreserveStaticOffsetPass::reconstructLoad(CallInst *Call) {
305 GetElementPtrInst *GEP = reconstructGEP(Call, 0);
306 Type *ReturnType = Call->getFunctionType()->getReturnType();
310 reconstructCommon(Call, GEP, Load, 0);
315 BPFPreserveStaticOffsetPass::reconstructStore(CallInst *Call) {
316 GetElementPtrInst *GEP = reconstructGEP(Call, 1);
317 auto *Store = new StoreInst(Call->getOperand(0), GEP,
320 reconstructCommon(Call, GEP, Store, 1);
443 if (auto *Call = isGEPAndLoad(U))
444 return Call->getArgOperand(0) == I;
445 if (auto *Call = isGEPAndStore(U))
446 return Call->getArgOperand(1) == I;
451 if (auto *Call = dyn_cast<CallInst>(U))
452 return Call->hasFnAttr(Attribute::InlineHint);
484 // by a call to `llvm.bpf.getelementptr.and.load` or
487 // GEPs are merged into the intrinsic call.
500 // preserve.static.offset call is still in use and should remain
552 // Preserve preserve.static.offset call for parameters of
631 auto *Call = dyn_cast<CallInst>(V);
632 if (!Call)
635 BPFCoreSharedInfo::removeArrayAccessCall(Call);
637 BPFCoreSharedInfo::removeStructAccessCall(Call);
639 BPFCoreSharedInfo::removeUnionAccessCall(Call);
662 for (auto *Call : MarkerCalls)
663 removePAICalls(Call);
665 for (auto *Call : MarkerCalls) {
666 if (RemovedMarkers.contains(Call))
668 bool StillUsed = rewriteAccessChain(Call, AllowPartial, RemovedMarkers);
670 removeMarkerCall(Call);