Lines Matching refs:F

42   bool substituteIntrinsicCalls(Function *F);
43 Function *removeAggregateTypesFromSignature(Function *F);
79 Function *F = M->getFunction(Name); in getOrCreateFunction() local
80 if (F && F->getFunctionType() == FT) in getOrCreateFunction()
81 return F; in getOrCreateFunction()
83 if (F) in getOrCreateFunction()
84 NewF->setDSOLocal(F->isDSOLocal()); in getOrCreateFunction()
103 Function *F = M->getFunction(FuncName); in lowerIntrinsicToFunction() local
104 if (F) { in lowerIntrinsicToFunction()
105 Intrinsic->setCalledFunction(F); in lowerIntrinsicToFunction()
114 F = dyn_cast<Function>(FC.getCallee()); in lowerIntrinsicToFunction()
115 assert(F && "Callee must be a function"); in lowerIntrinsicToFunction()
120 Argument *Dest = F->getArg(0); in lowerIntrinsicToFunction()
121 Argument *Val = F->getArg(1); in lowerIntrinsicToFunction()
122 Argument *Len = F->getArg(2); in lowerIntrinsicToFunction()
123 Argument *IsVolatile = F->getArg(3); in lowerIntrinsicToFunction()
128 BasicBlock *EntryBB = BasicBlock::Create(M->getContext(), "entry", F); in lowerIntrinsicToFunction()
138 BasicBlock *EntryBB = BasicBlock::Create(M->getContext(), "entry", F); in lowerIntrinsicToFunction()
141 F->getArg(0)); in lowerIntrinsicToFunction()
349 Function *F = Intrinsic::getOrInsertDeclaration( in lowerExpectAssume() local
351 II->setCalledFunction(F); in lowerExpectAssume()
353 Function *F = Intrinsic::getOrInsertDeclaration( in lowerExpectAssume() local
356 II->setCalledFunction(F); in lowerExpectAssume()
364 Function *F = nullptr; in toSpvOverloadedIntrinsic() local
366 F = Intrinsic::getOrInsertDeclaration(II->getModule(), NewID); in toSpvOverloadedIntrinsic()
371 F = Intrinsic::getOrInsertDeclaration(II->getModule(), NewID, Tys); in toSpvOverloadedIntrinsic()
373 II->setCalledFunction(F); in toSpvOverloadedIntrinsic()
379 bool SPIRVPrepareFunctions::substituteIntrinsicCalls(Function *F) { in substituteIntrinsicCalls() argument
381 const SPIRVSubtarget &STI = TM.getSubtarget<SPIRVSubtarget>(*F); in substituteIntrinsicCalls()
382 for (BasicBlock &BB : *F) { in substituteIntrinsicCalls()
433 SPIRVPrepareFunctions::removeAggregateTypesFromSignature(Function *F) { in removeAggregateTypesFromSignature() argument
434 bool IsRetAggr = F->getReturnType()->isAggregateType(); in removeAggregateTypesFromSignature()
436 if (F->isIntrinsic() && IsRetAggr) in removeAggregateTypesFromSignature()
437 return F; in removeAggregateTypesFromSignature()
439 IRBuilder<> B(F->getContext()); in removeAggregateTypesFromSignature()
441 bool HasAggrArg = llvm::any_of(F->args(), [](Argument &Arg) { in removeAggregateTypesFromSignature()
446 return F; in removeAggregateTypesFromSignature()
448 Type *RetType = IsRetAggr ? B.getInt32Ty() : F->getReturnType(); in removeAggregateTypesFromSignature()
450 ChangedTypes.push_back(std::pair<int, Type *>(-1, F->getReturnType())); in removeAggregateTypesFromSignature()
452 for (const auto &Arg : F->args()) { in removeAggregateTypesFromSignature()
461 FunctionType::get(RetType, ArgTypes, F->getFunctionType()->isVarArg()); in removeAggregateTypesFromSignature()
463 Function::Create(NewFTy, F->getLinkage(), F->getName(), *F->getParent()); in removeAggregateTypesFromSignature()
467 for (auto &Arg : F->args()) { in removeAggregateTypesFromSignature()
474 CloneFunctionInto(NewF, F, VMap, CloneFunctionChangeType::LocalChangesOnly, in removeAggregateTypesFromSignature()
476 NewF->takeName(F); in removeAggregateTypesFromSignature()
479 F->getParent()->getOrInsertNamedMetadata("spv.cloned_funcs"); in removeAggregateTypesFromSignature()
490 for (auto *U : make_early_inc_range(F->users())) { in removeAggregateTypesFromSignature()
493 U->replaceUsesOfWith(F, NewF); in removeAggregateTypesFromSignature()
497 if (RetType != F->getReturnType()) in removeAggregateTypesFromSignature()
498 TM.getSubtarget<SPIRVSubtarget>(*F).getSPIRVGlobalRegistry()->addMutated( in removeAggregateTypesFromSignature()
499 NewF, F->getReturnType()); in removeAggregateTypesFromSignature()
505 for (Function &F : M) { in runOnModule()
506 Changed |= substituteIntrinsicCalls(&F); in runOnModule()
507 Changed |= sortBlocks(F); in runOnModule()
511 for (auto &F : M) in runOnModule() local
512 FuncsWorklist.push_back(&F); in runOnModule()
514 for (auto *F : FuncsWorklist) { in runOnModule() local
515 Function *NewF = removeAggregateTypesFromSignature(F); in runOnModule()
517 if (NewF != F) { in runOnModule()
518 F->eraseFromParent(); in runOnModule()