Lines Matching refs:F
68 static void FindUses(Value *V, Function &F, in FindUses() argument
73 FindUses(BC, F, Uses, ConstantBCs); in FindUses()
74 else if (U.get()->getType() != F.getType()) { in FindUses()
89 Uses.push_back(std::make_pair(&U, &F)); in FindUses()
117 static Function *CreateWrapper(Function *F, FunctionType *Ty) { in CreateWrapper() argument
118 Module *M = F->getParent(); in CreateWrapper()
121 F->getName() + "_bitcast", M); in CreateWrapper()
129 FunctionType::param_iterator PI = F->getFunctionType()->param_begin(); in CreateWrapper()
130 FunctionType::param_iterator PE = F->getFunctionType()->param_end(); in CreateWrapper()
134 Type *ExpectedRtnType = F->getFunctionType()->getReturnType(); in CreateWrapper()
137 if ((F->getFunctionType()->getNumParams() != Ty->getNumParams()) || in CreateWrapper()
138 (F->getFunctionType()->isVarArg() != Ty->isVarArg()) || in CreateWrapper()
156 << F->getName() << "\n"); in CreateWrapper()
160 << F->getName() << "\n"); in CreateWrapper()
172 if (F->isVarArg()) in CreateWrapper()
176 CallInst *Call = CallInst::Create(F, Args, "", BB); in CreateWrapper()
178 Type *ExpectedRtnType = F->getFunctionType()->getReturnType(); in CreateWrapper()
196 << F->getName() << "\n"); in CreateWrapper()
200 << F->getName() << "\n"); in CreateWrapper()
211 F->getName() + "_bitcast_invalid", M); in CreateWrapper()
214 Wrapper->setName(F->getName() + "_bitcast_invalid"); in CreateWrapper()
216 LLVM_DEBUG(dbgs() << "CreateWrapper: no wrapper needed: " << F->getName() in CreateWrapper()
221 LLVM_DEBUG(dbgs() << "CreateWrapper: " << F->getName() << "\n"); in CreateWrapper()
245 for (Function &F : M) { in runOnModule()
246 FindUses(&F, F, Uses, ConstantBCs); in runOnModule()
252 if (F.getName() == "main") { in runOnModule()
253 Main = &F; in runOnModule()
259 if (shouldFixMainFunction(F.getFunctionType(), MainTy)) { in runOnModule()
261 << *F.getFunctionType() << "\n"); in runOnModule()
268 Uses.push_back(std::make_pair(UseMain, &F)); in runOnModule()
277 Function *F = UseFunc.second; in runOnModule() local
287 auto Pair = Wrappers.insert(std::make_pair(std::make_pair(F, Ty), nullptr)); in runOnModule()
289 Pair.first->second = CreateWrapper(F, Ty); in runOnModule()