Lines Matching full:call

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