[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

Maksim Levental via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 24 08:02:15 PDT 2025


================
@@ -0,0 +1,38 @@
+//===----- ABIInfo.h - ABI information access & encapsulation ----- C++ ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// ABI information access & encapsulation
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_ABI_ABIINFO_H
+#define LLVM_ABI_ABIINFO_H
+
+#include "llvm/ABI/ABIFunctionInfo.h"
+#include "llvm/ABI/Types.h"
+#include <cassert>
+
+namespace llvm {
+namespace abi {
+
+/// Abstract base class for target-specific ABI information.
+class ABIInfo {
+public:
+  virtual ~ABIInfo() = default;
+
+  virtual ABIArgInfo classifyReturnType(const Type *RetTy) const = 0;
+  virtual ABIArgInfo classifyArgumentType(const Type *ArgTy) const = 0;
+  virtual void computeInfo(ABIFunctionInfo &FI) const;
----------------
makslevental wrote:

```suggestion
  virtual void computeInfo(ABIFunctionInfo &FI) const {
    llvm_unreachable("computeInfo is not implemented");
  }
```

otherwise you get 

```
>>> referenced by ABIInfo.h:25 (/home/mlevental/dev_projects/llvm-project/llvm/include/llvm/ABI/ABIInfo.h:25)
>>>               BPF.cpp.o:(llvm::abi::ABIInfo::ABIInfo()) in archive lib/libLLVMABI.a
>>> the vtable symbol may be undefined because the class is missing its key function (see https://lld.llvm.org/missingkeyfunction)
```

due to https://lld.llvm.org/missingkeyfunction#forgetting-to-declare-a-virtual-function-in-an-abstract-class-as-pure

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


More information about the cfe-commits mailing list