[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 21 09:30:03 PDT 2025
================
@@ -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
More information about the llvm-commits
mailing list