[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


================
@@ -858,12 +865,28 @@ const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo(
   // Construct the function info.  We co-allocate the ArgInfos.
   FI = CGFunctionInfo::create(CC, isInstanceMethod, isChainCall, isDelegateCall,
                               info, paramInfos, resultType, argTypes, required);
+
+  llvm::BumpPtrAllocator Alloc;
+  llvm::abi::TypeBuilder TB(Alloc);
+
+  QualTypeMapper Mapper(CGM.getContext(), Alloc);
+
+  SmallVector<const llvm::abi::Type *, 8> MappedArgTypes;
+  for (CanQualType ArgType : argTypes) {
+    MappedArgTypes.push_back(Mapper.convertType(ArgType));
+  }
+  ArrayRef<const llvm::abi::Type *> ABIArgTypes = MappedArgTypes;
+  tempFI = llvm::abi::ABIFunctionInfo::create(
+      CC, Mapper.convertType(resultType), ABIArgTypes);
   FunctionInfos.InsertNode(FI, insertPos);
 
   bool inserted = FunctionsBeingProcessed.insert(FI).second;
   (void)inserted;
   assert(inserted && "Recursively being processed?");
 
+  bool isBPF = CGM.getTriple().getArch() == llvm::Triple::bpfeb ||
+               CGM.getTriple().getArch() == llvm::Triple::bpfel;
----------------
nikic wrote:

You can use `getTripe().isBPF()`.

https://github.com/llvm/llvm-project/pull/140112


More information about the llvm-commits mailing list