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

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


================
@@ -0,0 +1,60 @@
+//===- TargetCodegenInfo.h - Target code generation info ---------*- 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
+/// Target-specific code generation information and factory functions.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_ABI_TARGETCODEGENINFO_H
+#define LLVM_ABI_TARGETCODEGENINFO_H
+
+#include "llvm/ABI/ABIInfo.h"
+#include "llvm/TargetParser/Triple.h"
+#include <memory>
+
+namespace llvm {
+namespace abi {
+
+class TargetCodeGenInfo {
+  std::unique_ptr<ABIInfo> Info;
+
+protected:
+  template <typename T> const T &getABIInfo() const {
+    return static_cast<const T &>(*Info);
+  }
+
+public:
+  TargetCodeGenInfo(std::unique_ptr<ABIInfo> Info) : Info(std::move(Info)) {}
+
+  virtual ~TargetCodeGenInfo() = default;
+
+  const ABIInfo &getABIInfo() const { return *Info; }
+};
+
+std::unique_ptr<TargetCodeGenInfo> createBPFTargetCodeGenInfo(TypeBuilder &TB);
+
+/// The AVX ABI level for X86 targets.
+enum class X86AVXABILevel {
+  None,
+  AVX,
+  AVX512,
+};
+
+std::unique_ptr<TargetCodeGenInfo>
+createX8664TargetCodeGenInfo(TypeBuilder &TB, const Triple &Triple,
+                             X86AVXABILevel AVXLevel, bool Has64BitPointers,
+                             const ABICompatInfo &Compat);
----------------
nikic wrote:

These are not part of this PR.

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


More information about the llvm-commits mailing list