================ @@ -872,20 +895,122 @@ const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo( } else if (info.getCC() == CC_Swift || info.getCC() == CC_SwiftAsync) { swiftcall::computeABIInfo(CGM, *FI); } else { - CGM.getABIInfo().computeInfo(*FI); + if (isBPF) + CGM.fetchABIInfo(TB).computeInfo(*tempFI); + else + CGM.getABIInfo().computeInfo(*FI); } // Loop over all of the computed argument and return value info. If any of // them are direct or extend without a specified coerce type, specify the // default now. - ABIArgInfo &retInfo = FI->getReturnInfo(); - if (retInfo.canHaveCoerceToType() && retInfo.getCoerceToType() == nullptr) - retInfo.setCoerceToType(ConvertType(FI->getReturnType())); + if (isBPF && tempFI) { + llvm::ABITypeMapper ReverseMapper(getLLVMContext()); - for (auto &I : FI->arguments()) - if (I.info.canHaveCoerceToType() && I.info.getCoerceToType() == nullptr) - I.info.setCoerceToType(ConvertType(I.type)); + const auto &abiRetInfo = tempFI->getReturnInfo(); + ABIArgInfo &cgRetInfo = FI->getReturnInfo(); + + if (abiRetInfo.isDirect()) { ---------------- nikic wrote:
We should have a separate function for converting the ABIArgInfo, so it's not repeated for returns and args. https://github.com/llvm/llvm-project/pull/140112 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits