[llvm] [llvm] ABIInfo and TargetCodegenInfo (PR #190730)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 06:59:19 PDT 2026


================
@@ -0,0 +1,91 @@
+//===- 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/FunctionInfo.h"
+#include "llvm/ABI/Types.h"
+#include <cassert>
+#include <climits>
+
+namespace llvm {
+namespace abi {
+
+enum RecordArgABI {
+  /// Pass it using the normal C aggregate rules for the ABI, potentially
+  /// introducing extra copies and passing some or all of it in registers.
+  RAA_Default = 0,
+
+  /// Pass it on the stack using its defined layout.  The argument must be
+  /// evaluated directly into the correct stack position in the arguments area,
+  /// and the call machinery must not move it or introduce extra copies.
+  RAA_DirectInMemory,
+
+  /// Pass it as a pointer to temporary memory.
+  RAA_Indirect
+};
+
+struct ABICompatInfo {
+  unsigned Version = UINT_MAX;
+
+  struct ABIFlags {
+    bool PassInt128VectorsInMem : 1;
+    bool ReturnCXXRecordGreaterThan128InMem : 1;
+    bool ClassifyIntegerMMXAsSSE : 1;
+    bool HonorsRevision98 : 1;
+    bool Clang11Compat : 1;
----------------
nikic wrote:

I would expect ABICompatInfo to either contain the version, or the individual flags, but not both. If we have individual flags, then we can add a ctor that fills them based on the version. But I don't think we should also store the version if we have the flags, as that makes it unclear which you're supposed to check.

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


More information about the llvm-commits mailing list