@@ -700,62 +700,6 @@ static unsigned findSinglePartiallyAppliedParameterIndexIgnoringEmptyTypes(
700700 return firstNonEmpty;
701701}
702702
703-
704- llvm::Function *irgen::getThinToThickForwarder (IRGenModule &IGM,
705- const Optional<FunctionPointer> &staticFnPtr,
706- const CanSILFunctionType origType) {
707- auto origSig = IGM.getSignature (origType);
708- llvm::FunctionType *origFnTy = origSig.getType ();
709- auto origTy = origSig.getType ()->getPointerTo ();
710-
711- llvm::SmallVector<llvm::Type *, 4 > thunkParams;
712-
713- for (unsigned i = 0 ; i < origFnTy->getNumParams (); ++i)
714- thunkParams.push_back (origFnTy->getParamType (i));
715-
716- thunkParams.push_back (IGM.RefCountedPtrTy );
717-
718- auto thunkType = llvm::FunctionType::get (origFnTy->getReturnType (),
719- thunkParams,
720- /* vararg*/ false );
721-
722- StringRef FnName;
723- if (staticFnPtr)
724- FnName = staticFnPtr->getPointer ()->getName ();
725-
726- IRGenMangler Mangler;
727- std::string thunkName = Mangler.mangleThinToThickForwarder (FnName);
728-
729-
730- // FIXME: Maybe cache the thunk by function and closure types?.
731- llvm::Function *fwd =
732- llvm::Function::Create (thunkType, llvm::Function::InternalLinkage,
733- llvm::StringRef (thunkName), &IGM.Module );
734-
735- fwd->setAttributes (origSig.getAttributes ());
736- fwd->addAttribute (llvm::AttributeList::FirstArgIndex + origFnTy->getNumParams (), llvm::Attribute::SwiftSelf);
737- IRGenFunction IGF (IGM, fwd);
738- if (IGM.DebugInfo )
739- IGM.DebugInfo ->emitArtificialFunction (IGF, fwd);
740- auto args = IGF.collectParameters ();
741- auto rawFnPtr = args.takeLast ();
742-
743- // It comes out of the context as an i8*. Cast to the function type.
744- rawFnPtr = IGF.Builder .CreateBitCast (rawFnPtr, origTy);
745-
746- auto fnPtr = FunctionPointer (rawFnPtr, origSig);
747-
748- auto result = IGF.Builder .CreateCall (fnPtr, args.claimAll ());
749-
750- // Return the result, if we have one.
751- if (result->getType ()->isVoidTy ())
752- IGF.Builder .CreateRetVoid ();
753- else
754- IGF.Builder .CreateRet (result);
755- return fwd;
756- }
757-
758-
759703// / Emit the forwarding stub function for a partial application.
760704// /
761705// / If 'layout' is null, there is a single captured value of
0 commit comments