[llvm] [llvm] annotate interfaces in llvm/TargetParser for DLL export (PR #143616)
Andrew Rogers via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 10 15:31:05 PDT 2025
https://github.com/andrurogerz created https://github.com/llvm/llvm-project/pull/143616
## Purpose
This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm/TargetParser` library. These annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build.
## Background
This effort is tracked in #109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307), and documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst).
Most of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`.
Additionally, I manually removed the redundant declaration of `getCanonicalArchName` from llvm/include/llvm/TargetParser/ARMTargetParser.h because IDS only auto-annotates the first declaration it encounters, and the second un-annotated declaration results in an MSVC warning.
## Validation
Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:
- Windows with MSVC
- Windows with Clang
- Linux with GCC
- Linux with Clang
- Darwin with Clang
>From c1a2fce0ce11c98428d1a2c575903544b11770f8 Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 9 Jun 2025 13:30:47 -0700
Subject: [PATCH 1/3] [llvm] annotate interfaces in TargetParser library for
DLL export
---
.../llvm/TargetParser/AArch64TargetParser.h | 51 +++++----
.../llvm/TargetParser/ARMTargetParser.h | 63 ++++++-----
.../llvm/TargetParser/ARMTargetParserCommon.h | 11 +-
.../llvm/TargetParser/CSKYTargetParser.h | 27 ++---
llvm/include/llvm/TargetParser/Host.h | 25 ++--
.../llvm/TargetParser/LoongArchTargetParser.h | 13 ++-
.../llvm/TargetParser/PPCTargetParser.h | 13 ++-
llvm/include/llvm/TargetParser/RISCVISAInfo.h | 33 +++---
.../llvm/TargetParser/RISCVTargetParser.h | 33 +++---
.../llvm/TargetParser/SubtargetFeature.h | 17 +--
llvm/include/llvm/TargetParser/TargetParser.h | 27 ++---
llvm/include/llvm/TargetParser/Triple.h | 107 +++++++++---------
.../llvm/TargetParser/X86TargetParser.h | 23 ++--
13 files changed, 228 insertions(+), 215 deletions(-)
diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h
index 0338770593bc4..ea736789887a5 100644
--- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h
+++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h
@@ -14,6 +14,7 @@
#ifndef LLVM_TARGETPARSER_AARCH64TARGETPARSER_H
#define LLVM_TARGETPARSER_AARCH64TARGETPARSER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Bitset.h"
#include "llvm/ADT/StringExtras.h"
@@ -79,7 +80,7 @@ struct FMVInfo {
: Name(Name), FeatureBit(FeatureBit), PriorityBit(PriorityBit), ID(ID) {};
};
-const std::vector<FMVInfo> &getFMVInfo();
+LLVM_ABI const std::vector<FMVInfo> &getFMVInfo();
// Represents a dependency between two architecture extensions. Later is the
// feature which was added to the architecture after Earlier, and expands the
@@ -146,7 +147,7 @@ struct ArchInfo {
StringRef getSubArch() const { return ArchFeature.substr(1); }
// Search for ArchInfo by SubArch name
- static std::optional<ArchInfo> findBySubArch(StringRef SubArch);
+ LLVM_ABI static std::optional<ArchInfo> findBySubArch(StringRef SubArch);
};
#define EMIT_ARCHITECTURES
@@ -182,33 +183,33 @@ struct ExtensionSet {
// Enable the given architecture extension, and any other extensions it
// depends on. Does not change the base architecture, or follow dependencies
// between features which are only related by required arcitecture versions.
- void enable(ArchExtKind E);
+ LLVM_ABI void enable(ArchExtKind E);
// Disable the given architecture extension, and any other extensions which
// depend on it. Does not change the base architecture, or follow
// dependencies between features which are only related by required
// arcitecture versions.
- void disable(ArchExtKind E);
+ LLVM_ABI void disable(ArchExtKind E);
// Add default extensions for the given CPU. Records the base architecture,
// to later resolve dependencies which depend on it.
- void addCPUDefaults(const CpuInfo &CPU);
+ LLVM_ABI void addCPUDefaults(const CpuInfo &CPU);
// Add default extensions for the given architecture version. Records the
// base architecture, to later resolve dependencies which depend on it.
- void addArchDefaults(const ArchInfo &Arch);
+ LLVM_ABI void addArchDefaults(const ArchInfo &Arch);
// Add or remove a feature based on a modifier string. The string must be of
// the form "<name>" to enable a feature or "no<name>" to disable it. This
// will also enable or disable any features as required by the dependencies
// between them.
- bool parseModifier(StringRef Modifier, const bool AllowNoDashForm = false);
+ LLVM_ABI bool parseModifier(StringRef Modifier, const bool AllowNoDashForm = false);
// Constructs a new ExtensionSet by toggling the corresponding bits for every
// feature in the \p Features list without expanding their dependencies. Used
// for reconstructing an ExtensionSet from the output of toLLVMFeatures().
// Features that are not recognized are pushed back to \p NonExtensions.
- void reconstructFromParsedFeatures(const std::vector<std::string> &Features,
+ LLVM_ABI void reconstructFromParsedFeatures(const std::vector<std::string> &Features,
std::vector<std::string> &NonExtensions);
// Convert the set of enabled extension to an LLVM feature list, appending
@@ -227,7 +228,7 @@ struct ExtensionSet {
}
}
- void dump() const;
+ LLVM_ABI void dump() const;
};
// Name alias.
@@ -239,52 +240,52 @@ struct Alias {
#define EMIT_CPU_ALIAS
#include "llvm/TargetParser/AArch64TargetParserDef.inc"
-const ExtensionInfo &getExtensionByID(ArchExtKind(ExtID));
+LLVM_ABI const ExtensionInfo &getExtensionByID(ArchExtKind(ExtID));
-bool getExtensionFeatures(
+LLVM_ABI bool getExtensionFeatures(
const AArch64::ExtensionBitset &Extensions,
std::vector<StringRef> &Features);
-StringRef getArchExtFeature(StringRef ArchExt);
-StringRef resolveCPUAlias(StringRef CPU);
+LLVM_ABI StringRef getArchExtFeature(StringRef ArchExt);
+LLVM_ABI StringRef resolveCPUAlias(StringRef CPU);
// Information by Name
-const ArchInfo *getArchForCpu(StringRef CPU);
+LLVM_ABI const ArchInfo *getArchForCpu(StringRef CPU);
// Parser
-const ArchInfo *parseArch(StringRef Arch);
+LLVM_ABI const ArchInfo *parseArch(StringRef Arch);
// Return the extension which has the given -target-feature name.
-std::optional<ExtensionInfo> targetFeatureToExtension(StringRef TargetFeature);
+LLVM_ABI std::optional<ExtensionInfo> targetFeatureToExtension(StringRef TargetFeature);
// Parse a name as defined by the Extension class in tablegen.
-std::optional<ExtensionInfo> parseArchExtension(StringRef Extension);
+LLVM_ABI std::optional<ExtensionInfo> parseArchExtension(StringRef Extension);
// Parse a name as defined by the FMVInfo class in tablegen.
-std::optional<FMVInfo> parseFMVExtension(StringRef Extension);
+LLVM_ABI std::optional<FMVInfo> parseFMVExtension(StringRef Extension);
// Given the name of a CPU or alias, return the correponding CpuInfo.
-std::optional<CpuInfo> parseCpu(StringRef Name);
+LLVM_ABI std::optional<CpuInfo> parseCpu(StringRef Name);
// Used by target parser tests
-void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values);
+LLVM_ABI void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values);
-bool isX18ReservedByDefault(const Triple &TT);
+LLVM_ABI bool isX18ReservedByDefault(const Triple &TT);
// For a given set of feature names, which can be either target-features, or
// fmv-features metadata, expand their dependencies and then return a bitmask
// corresponding to the entries of AArch64::FeatPriorities.
-uint64_t getFMVPriority(ArrayRef<StringRef> Features);
+LLVM_ABI uint64_t getFMVPriority(ArrayRef<StringRef> Features);
// For a given set of FMV feature names, expand their dependencies and then
// return a bitmask corresponding to the entries of AArch64::CPUFeatures.
// The values in CPUFeatures are not bitmasks themselves, they are sequential
// (0, 1, 2, 3, ...). The resulting bitmask is used at runtime to test whether
// a certain FMV feature is available on the host.
-uint64_t getCpuSupportsMask(ArrayRef<StringRef> Features);
+LLVM_ABI uint64_t getCpuSupportsMask(ArrayRef<StringRef> Features);
-void PrintSupportedExtensions();
+LLVM_ABI void PrintSupportedExtensions();
-void printEnabledExtensions(const std::set<StringRef> &EnabledFeatureNames);
+LLVM_ABI void printEnabledExtensions(const std::set<StringRef> &EnabledFeatureNames);
} // namespace AArch64
} // namespace llvm
diff --git a/llvm/include/llvm/TargetParser/ARMTargetParser.h b/llvm/include/llvm/TargetParser/ARMTargetParser.h
index b2403f42f1b79..e2e3033df72ef 100644
--- a/llvm/include/llvm/TargetParser/ARMTargetParser.h
+++ b/llvm/include/llvm/TargetParser/ARMTargetParser.h
@@ -14,6 +14,7 @@
#ifndef LLVM_TARGETPARSER_ARMTARGETPARSER_H
#define LLVM_TARGETPARSER_ARMTARGETPARSER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ARMBuildAttributes.h"
@@ -223,53 +224,53 @@ inline ArchKind &operator--(ArchKind &Kind) {
}
// Information by ID
-StringRef getFPUName(FPUKind FPUKind);
-FPUVersion getFPUVersion(FPUKind FPUKind);
-NeonSupportLevel getFPUNeonSupportLevel(FPUKind FPUKind);
-FPURestriction getFPURestriction(FPUKind FPUKind);
-
-bool getFPUFeatures(FPUKind FPUKind, std::vector<StringRef> &Features);
-bool getHWDivFeatures(uint64_t HWDivKind, std::vector<StringRef> &Features);
-bool getExtensionFeatures(uint64_t Extensions,
+LLVM_ABI StringRef getFPUName(FPUKind FPUKind);
+LLVM_ABI FPUVersion getFPUVersion(FPUKind FPUKind);
+LLVM_ABI NeonSupportLevel getFPUNeonSupportLevel(FPUKind FPUKind);
+LLVM_ABI FPURestriction getFPURestriction(FPUKind FPUKind);
+
+LLVM_ABI bool getFPUFeatures(FPUKind FPUKind, std::vector<StringRef> &Features);
+LLVM_ABI bool getHWDivFeatures(uint64_t HWDivKind, std::vector<StringRef> &Features);
+LLVM_ABI bool getExtensionFeatures(uint64_t Extensions,
std::vector<StringRef> &Features);
-StringRef getArchName(ArchKind AK);
-unsigned getArchAttr(ArchKind AK);
-StringRef getCPUAttr(ArchKind AK);
-StringRef getSubArch(ArchKind AK);
-StringRef getArchExtName(uint64_t ArchExtKind);
-StringRef getArchExtFeature(StringRef ArchExt);
-bool appendArchExtFeatures(StringRef CPU, ARM::ArchKind AK, StringRef ArchExt,
+LLVM_ABI StringRef getArchName(ArchKind AK);
+LLVM_ABI unsigned getArchAttr(ArchKind AK);
+LLVM_ABI StringRef getCPUAttr(ArchKind AK);
+LLVM_ABI StringRef getSubArch(ArchKind AK);
+LLVM_ABI StringRef getArchExtName(uint64_t ArchExtKind);
+LLVM_ABI StringRef getArchExtFeature(StringRef ArchExt);
+LLVM_ABI bool appendArchExtFeatures(StringRef CPU, ARM::ArchKind AK, StringRef ArchExt,
std::vector<StringRef> &Features,
FPUKind &ArgFPUKind);
-ArchKind convertV9toV8(ArchKind AK);
+LLVM_ABI ArchKind convertV9toV8(ArchKind AK);
// Information by Name
-FPUKind getDefaultFPU(StringRef CPU, ArchKind AK);
-uint64_t getDefaultExtensions(StringRef CPU, ArchKind AK);
-StringRef getDefaultCPU(StringRef Arch);
+LLVM_ABI FPUKind getDefaultFPU(StringRef CPU, ArchKind AK);
+LLVM_ABI uint64_t getDefaultExtensions(StringRef CPU, ArchKind AK);
+LLVM_ABI StringRef getDefaultCPU(StringRef Arch);
StringRef getCanonicalArchName(StringRef Arch);
-StringRef getFPUSynonym(StringRef FPU);
+LLVM_ABI StringRef getFPUSynonym(StringRef FPU);
// Parser
-uint64_t parseHWDiv(StringRef HWDiv);
-FPUKind parseFPU(StringRef FPU);
-ArchKind parseArch(StringRef Arch);
-uint64_t parseArchExt(StringRef ArchExt);
-ArchKind parseCPUArch(StringRef CPU);
-ProfileKind parseArchProfile(StringRef Arch);
-unsigned parseArchVersion(StringRef Arch);
+LLVM_ABI uint64_t parseHWDiv(StringRef HWDiv);
+LLVM_ABI FPUKind parseFPU(StringRef FPU);
+LLVM_ABI ArchKind parseArch(StringRef Arch);
+LLVM_ABI uint64_t parseArchExt(StringRef ArchExt);
+LLVM_ABI ArchKind parseCPUArch(StringRef CPU);
+LLVM_ABI ProfileKind parseArchProfile(StringRef Arch);
+LLVM_ABI unsigned parseArchVersion(StringRef Arch);
-void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values);
-StringRef computeDefaultTargetABI(const Triple &TT, StringRef CPU);
+LLVM_ABI void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values);
+LLVM_ABI StringRef computeDefaultTargetABI(const Triple &TT, StringRef CPU);
/// Get the (LLVM) name of the minimum ARM CPU for the arch we are targeting.
///
/// \param Arch the architecture name (e.g., "armv7s"). If it is an empty
/// string then the triple's arch name is used.
-StringRef getARMCPUForArch(const llvm::Triple &Triple, StringRef MArch = {});
+LLVM_ABI StringRef getARMCPUForArch(const llvm::Triple &Triple, StringRef MArch = {});
-void PrintSupportedExtensions(StringMap<StringRef> DescMap);
+LLVM_ABI void PrintSupportedExtensions(StringMap<StringRef> DescMap);
} // namespace ARM
} // namespace llvm
diff --git a/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h b/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h
index f6115718e9f5f..a4d21a9c5d497 100644
--- a/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h
+++ b/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h
@@ -13,6 +13,7 @@
#ifndef LLVM_TARGETPARSER_ARMTARGETPARSERCOMMON_H
#define LLVM_TARGETPARSER_ARMTARGETPARSERCOMMON_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
namespace llvm {
@@ -23,19 +24,19 @@ enum class ISAKind { INVALID = 0, ARM, THUMB, AARCH64 };
enum class EndianKind { INVALID = 0, LITTLE, BIG };
/// Converts e.g. "armv8" -> "armv8-a"
-StringRef getArchSynonym(StringRef Arch);
+LLVM_ABI StringRef getArchSynonym(StringRef Arch);
/// MArch is expected to be of the form (arm|thumb)?(eb)?(v.+)?(eb)?, but
/// (iwmmxt|xscale)(eb)? is also permitted. If the former, return
/// "v.+", if the latter, return unmodified string, minus 'eb'.
/// If invalid, return empty string.
-StringRef getCanonicalArchName(StringRef Arch);
+LLVM_ABI StringRef getCanonicalArchName(StringRef Arch);
// ARM, Thumb, AArch64
-ISAKind parseArchISA(StringRef Arch);
+LLVM_ABI ISAKind parseArchISA(StringRef Arch);
// Little/Big endian
-EndianKind parseArchEndian(StringRef Arch);
+LLVM_ABI EndianKind parseArchEndian(StringRef Arch);
struct ParsedBranchProtection {
StringRef Scope;
@@ -45,7 +46,7 @@ struct ParsedBranchProtection {
bool GuardedControlStack;
};
-bool parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP,
+LLVM_ABI bool parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP,
StringRef &Err, bool EnablePAuthLR = false);
} // namespace ARM
diff --git a/llvm/include/llvm/TargetParser/CSKYTargetParser.h b/llvm/include/llvm/TargetParser/CSKYTargetParser.h
index 4c4ec06f758a8..1d93055e67456 100644
--- a/llvm/include/llvm/TargetParser/CSKYTargetParser.h
+++ b/llvm/include/llvm/TargetParser/CSKYTargetParser.h
@@ -15,6 +15,7 @@
#ifndef LLVM_TARGETPARSER_CSKYTARGETPARSER_H
#define LLVM_TARGETPARSER_CSKYTARGETPARSER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/TargetParser/Triple.h"
#include <vector>
@@ -176,25 +177,25 @@ const ArchNames<CSKY::ArchKind> ARCHNames[] = {
#include "llvm/TargetParser/CSKYTargetParser.def"
};
-StringRef getArchName(ArchKind AK);
-StringRef getDefaultCPU(StringRef Arch);
-StringRef getArchExtName(uint64_t ArchExtKind);
-StringRef getArchExtFeature(StringRef ArchExt);
-uint64_t getDefaultExtensions(StringRef CPU);
-bool getExtensionFeatures(uint64_t Extensions,
+LLVM_ABI StringRef getArchName(ArchKind AK);
+LLVM_ABI StringRef getDefaultCPU(StringRef Arch);
+LLVM_ABI StringRef getArchExtName(uint64_t ArchExtKind);
+LLVM_ABI StringRef getArchExtFeature(StringRef ArchExt);
+LLVM_ABI uint64_t getDefaultExtensions(StringRef CPU);
+LLVM_ABI bool getExtensionFeatures(uint64_t Extensions,
std::vector<StringRef> &Features);
// Information by ID
-StringRef getFPUName(unsigned FPUKind);
-FPUVersion getFPUVersion(unsigned FPUKind);
+LLVM_ABI StringRef getFPUName(unsigned FPUKind);
+LLVM_ABI FPUVersion getFPUVersion(unsigned FPUKind);
-bool getFPUFeatures(CSKYFPUKind Kind, std::vector<StringRef> &Features);
+LLVM_ABI bool getFPUFeatures(CSKYFPUKind Kind, std::vector<StringRef> &Features);
// Parser
-ArchKind parseArch(StringRef Arch);
-ArchKind parseCPUArch(StringRef CPU);
-uint64_t parseArchExt(StringRef ArchExt);
-void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values);
+LLVM_ABI ArchKind parseArch(StringRef Arch);
+LLVM_ABI ArchKind parseCPUArch(StringRef CPU);
+LLVM_ABI uint64_t parseArchExt(StringRef ArchExt);
+LLVM_ABI void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values);
} // namespace CSKY
diff --git a/llvm/include/llvm/TargetParser/Host.h b/llvm/include/llvm/TargetParser/Host.h
index 443f4f583b559..be3d41e022ad9 100644
--- a/llvm/include/llvm/TargetParser/Host.h
+++ b/llvm/include/llvm/TargetParser/Host.h
@@ -13,6 +13,7 @@
#ifndef LLVM_TARGETPARSER_HOST_H
#define LLVM_TARGETPARSER_HOST_H
+#include "llvm/Support/Compiler.h"
#include <string>
namespace llvm {
@@ -30,18 +31,18 @@ namespace sys {
/// CPU_TYPE-VENDOR-OPERATING_SYSTEM
/// or
/// CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM
-std::string getDefaultTargetTriple();
+LLVM_ABI std::string getDefaultTargetTriple();
/// getProcessTriple() - Return an appropriate target triple for generating
/// code to be loaded into the current process, e.g. when using the JIT.
-std::string getProcessTriple();
+LLVM_ABI std::string getProcessTriple();
/// getHostCPUName - Get the LLVM name for the host CPU. The particular format
/// of the name is target dependent, and suitable for passing as -mcpu to the
/// target which matches the host.
///
/// \return - The host CPU name, or empty if the CPU could not be determined.
-StringRef getHostCPUName();
+LLVM_ABI StringRef getHostCPUName();
/// getHostCPUFeatures - Get the LLVM names for the host CPU features.
/// The particular format of the names are target dependent, and suitable for
@@ -52,20 +53,20 @@ StringRef getHostCPUName();
/// which features may appear in this map, except that they are all valid LLVM
/// feature names. The map can be empty, for example if feature detection
/// fails.
-const StringMap<bool, MallocAllocator> getHostCPUFeatures();
+LLVM_ABI const StringMap<bool, MallocAllocator> getHostCPUFeatures();
/// This is a function compatible with cl::AddExtraVersionPrinter, which adds
/// info about the current target triple and detected CPU.
-void printDefaultTargetAndDetectedCPU(raw_ostream &OS);
+LLVM_ABI void printDefaultTargetAndDetectedCPU(raw_ostream &OS);
namespace detail {
/// Helper functions to extract HostCPUName from /proc/cpuinfo on linux.
-StringRef getHostCPUNameForPowerPC(StringRef ProcCpuinfoContent);
-StringRef getHostCPUNameForARM(StringRef ProcCpuinfoContent);
-StringRef getHostCPUNameForS390x(StringRef ProcCpuinfoContent);
-StringRef getHostCPUNameForRISCV(StringRef ProcCpuinfoContent);
-StringRef getHostCPUNameForSPARC(StringRef ProcCpuinfoContent);
-StringRef getHostCPUNameForBPF();
+LLVM_ABI StringRef getHostCPUNameForPowerPC(StringRef ProcCpuinfoContent);
+LLVM_ABI StringRef getHostCPUNameForARM(StringRef ProcCpuinfoContent);
+LLVM_ABI StringRef getHostCPUNameForS390x(StringRef ProcCpuinfoContent);
+LLVM_ABI StringRef getHostCPUNameForRISCV(StringRef ProcCpuinfoContent);
+LLVM_ABI StringRef getHostCPUNameForSPARC(StringRef ProcCpuinfoContent);
+LLVM_ABI StringRef getHostCPUNameForBPF();
/// Helper functions to extract CPU details from CPUID on x86.
namespace x86 {
@@ -78,7 +79,7 @@ enum class VendorSignatures {
/// Returns the host CPU's vendor.
/// MaxLeaf: if a non-nullptr pointer is specified, the EAX value will be
/// assigned to its pointee.
-VendorSignatures getVendorSignature(unsigned *MaxLeaf = nullptr);
+LLVM_ABI VendorSignatures getVendorSignature(unsigned *MaxLeaf = nullptr);
} // namespace x86
} // namespace detail
} // namespace sys
diff --git a/llvm/include/llvm/TargetParser/LoongArchTargetParser.h b/llvm/include/llvm/TargetParser/LoongArchTargetParser.h
index a28e4e9eff811..1357d74744592 100644
--- a/llvm/include/llvm/TargetParser/LoongArchTargetParser.h
+++ b/llvm/include/llvm/TargetParser/LoongArchTargetParser.h
@@ -14,6 +14,7 @@
#ifndef LLVM_TARGETPARSER_LOONGARCHTARGETPARSER_H
#define LLVM_TARGETPARSER_LOONGARCHTARGETPARSER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/TargetParser/Triple.h"
#include <vector>
@@ -84,12 +85,12 @@ struct ArchInfo {
uint32_t Features;
};
-bool isValidArchName(StringRef Arch);
-bool isValidFeatureName(StringRef Feature);
-bool getArchFeatures(StringRef Arch, std::vector<StringRef> &Features);
-bool isValidCPUName(StringRef TuneCPU);
-void fillValidCPUList(SmallVectorImpl<StringRef> &Values);
-StringRef getDefaultArch(bool Is64Bit);
+LLVM_ABI bool isValidArchName(StringRef Arch);
+LLVM_ABI bool isValidFeatureName(StringRef Feature);
+LLVM_ABI bool getArchFeatures(StringRef Arch, std::vector<StringRef> &Features);
+LLVM_ABI bool isValidCPUName(StringRef TuneCPU);
+LLVM_ABI void fillValidCPUList(SmallVectorImpl<StringRef> &Values);
+LLVM_ABI StringRef getDefaultArch(bool Is64Bit);
} // namespace LoongArch
diff --git a/llvm/include/llvm/TargetParser/PPCTargetParser.h b/llvm/include/llvm/TargetParser/PPCTargetParser.h
index 5f9fe543aff0b..56e07023f5f4f 100644
--- a/llvm/include/llvm/TargetParser/PPCTargetParser.h
+++ b/llvm/include/llvm/TargetParser/PPCTargetParser.h
@@ -14,26 +14,27 @@
#ifndef LLVM_TARGETPARSER_PPCTARGETPARSER_H
#define LLVM_TARGETPARSER_PPCTARGETPARSER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/TargetParser/Triple.h"
namespace llvm {
namespace PPC {
-bool isValidCPU(StringRef CPU);
-void fillValidCPUList(SmallVectorImpl<StringRef> &Values);
-void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values);
+LLVM_ABI bool isValidCPU(StringRef CPU);
+LLVM_ABI void fillValidCPUList(SmallVectorImpl<StringRef> &Values);
+LLVM_ABI void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values);
// Get target CPU name.
// If CPUName is empty or generic, return the default CPU name.
// If CPUName is not empty or generic, return the normalized CPU name.
-StringRef getNormalizedPPCTargetCPU(const Triple &T, StringRef CPUName = "");
+LLVM_ABI StringRef getNormalizedPPCTargetCPU(const Triple &T, StringRef CPUName = "");
// Get the tune CPU name.
-StringRef getNormalizedPPCTuneCPU(const Triple &T, StringRef CPUName = "");
+LLVM_ABI StringRef getNormalizedPPCTuneCPU(const Triple &T, StringRef CPUName = "");
// For PPC, there are some cpu names for same CPU, like pwr10 and power10,
// normalize them.
-StringRef normalizeCPUName(StringRef CPUName);
+LLVM_ABI StringRef normalizeCPUName(StringRef CPUName);
} // namespace PPC
} // namespace llvm
diff --git a/llvm/include/llvm/TargetParser/RISCVISAInfo.h b/llvm/include/llvm/TargetParser/RISCVISAInfo.h
index 5b2b6f29fd3db..d4bfbd0bb184b 100644
--- a/llvm/include/llvm/TargetParser/RISCVISAInfo.h
+++ b/llvm/include/llvm/TargetParser/RISCVISAInfo.h
@@ -9,6 +9,7 @@
#ifndef LLVM_SUPPORT_RISCVISAINFO_H
#define LLVM_SUPPORT_RISCVISAINFO_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
@@ -31,26 +32,26 @@ class RISCVISAInfo {
/// extensions with unrecognised versions will be silently dropped, except
/// for the special case of the base 'i' and 'e' extensions, where the
/// default version will be used (as ignoring the base is not possible).
- static llvm::Expected<std::unique_ptr<RISCVISAInfo>>
+ LLVM_ABI static llvm::Expected<std::unique_ptr<RISCVISAInfo>>
parseArchString(StringRef Arch, bool EnableExperimentalExtension,
bool ExperimentalExtensionVersionCheck = true);
/// Parse RISC-V ISA info from an arch string that is already in normalized
/// form (as defined in the psABI). Unlike parseArchString, this function
/// will not error for unrecognized extension names or extension versions.
- static llvm::Expected<std::unique_ptr<RISCVISAInfo>>
+ LLVM_ABI static llvm::Expected<std::unique_ptr<RISCVISAInfo>>
parseNormalizedArchString(StringRef Arch);
/// Parse RISC-V ISA info from feature vector.
- static llvm::Expected<std::unique_ptr<RISCVISAInfo>>
+ LLVM_ABI static llvm::Expected<std::unique_ptr<RISCVISAInfo>>
parseFeatures(unsigned XLen, const std::vector<std::string> &Features);
- static llvm::Expected<std::unique_ptr<RISCVISAInfo>>
+ LLVM_ABI static llvm::Expected<std::unique_ptr<RISCVISAInfo>>
createFromExtMap(unsigned XLen,
const RISCVISAUtils::OrderedExtensionMap &Exts);
/// Convert RISC-V ISA info to a feature vector.
- std::vector<std::string> toFeatures(bool AddAllExtensions = false,
+ LLVM_ABI std::vector<std::string> toFeatures(bool AddAllExtensions = false,
bool IgnoreUnknown = true) const;
const RISCVISAUtils::OrderedExtensionMap &getExtensions() const {
@@ -64,25 +65,25 @@ class RISCVISAInfo {
unsigned getMaxELen() const { return MaxELen; }
unsigned getMaxELenFp() const { return MaxELenFp; }
- bool hasExtension(StringRef Ext) const;
- std::string toString() const;
- StringRef computeDefaultABI() const;
+ LLVM_ABI bool hasExtension(StringRef Ext) const;
+ LLVM_ABI std::string toString() const;
+ LLVM_ABI StringRef computeDefaultABI() const;
- static bool isSupportedExtensionFeature(StringRef Ext);
- static bool isSupportedExtension(StringRef Ext);
- static bool isSupportedExtensionWithVersion(StringRef Ext);
- static bool isSupportedExtension(StringRef Ext, unsigned MajorVersion,
+ LLVM_ABI static bool isSupportedExtensionFeature(StringRef Ext);
+ LLVM_ABI static bool isSupportedExtension(StringRef Ext);
+ LLVM_ABI static bool isSupportedExtensionWithVersion(StringRef Ext);
+ LLVM_ABI static bool isSupportedExtension(StringRef Ext, unsigned MajorVersion,
unsigned MinorVersion);
- static std::string getTargetFeatureForExtension(StringRef Ext);
+ LLVM_ABI static std::string getTargetFeatureForExtension(StringRef Ext);
- static void printSupportedExtensions(StringMap<StringRef> &DescMap);
- static void printEnabledExtensions(bool IsRV64,
+ LLVM_ABI static void printSupportedExtensions(StringMap<StringRef> &DescMap);
+ LLVM_ABI static void printEnabledExtensions(bool IsRV64,
std::set<StringRef> &EnabledFeatureNames,
StringMap<StringRef> &DescMap);
/// Return the group id and bit position of __riscv_feature_bits. Returns
/// <-1, -1> if not supported.
- static std::pair<int, int> getRISCVFeaturesBitsInfo(StringRef Ext);
+ LLVM_ABI static std::pair<int, int> getRISCVFeaturesBitsInfo(StringRef Ext);
// The maximum value of the group ID obtained from getRISCVFeaturesBitsInfo.
static constexpr unsigned FeatureBitSize = 2;
diff --git a/llvm/include/llvm/TargetParser/RISCVTargetParser.h b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
index a529479b546d9..f35c85998e09c 100644
--- a/llvm/include/llvm/TargetParser/RISCVTargetParser.h
+++ b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
@@ -14,6 +14,7 @@
#ifndef LLVM_TARGETPARSER_RISCVTARGETPARSER_H
#define LLVM_TARGETPARSER_RISCVTARGETPARSER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
@@ -43,18 +44,18 @@ struct CPUInfo {
static constexpr unsigned RVVBitsPerBlock = 64;
static constexpr unsigned RVVBytesPerBlock = RVVBitsPerBlock / 8;
-void getFeaturesForCPU(StringRef CPU,
+LLVM_ABI void getFeaturesForCPU(StringRef CPU,
SmallVectorImpl<std::string> &EnabledFeatures,
bool NeedPlus = false);
-bool parseCPU(StringRef CPU, bool IsRV64);
-bool parseTuneCPU(StringRef CPU, bool IsRV64);
-StringRef getMArchFromMcpu(StringRef CPU);
-void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64);
-void fillValidTuneCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64);
-bool hasFastScalarUnalignedAccess(StringRef CPU);
-bool hasFastVectorUnalignedAccess(StringRef CPU);
-bool hasValidCPUModel(StringRef CPU);
-CPUModel getCPUModel(StringRef CPU);
+LLVM_ABI bool parseCPU(StringRef CPU, bool IsRV64);
+LLVM_ABI bool parseTuneCPU(StringRef CPU, bool IsRV64);
+LLVM_ABI StringRef getMArchFromMcpu(StringRef CPU);
+LLVM_ABI void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64);
+LLVM_ABI void fillValidTuneCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64);
+LLVM_ABI bool hasFastScalarUnalignedAccess(StringRef CPU);
+LLVM_ABI bool hasFastVectorUnalignedAccess(StringRef CPU);
+LLVM_ABI bool hasValidCPUModel(StringRef CPU);
+LLVM_ABI CPUModel getCPUModel(StringRef CPU);
} // namespace RISCV
@@ -86,10 +87,10 @@ inline static bool isValidLMUL(unsigned LMUL, bool Fractional) {
return isPowerOf2_32(LMUL) && LMUL <= 8 && (!Fractional || LMUL != 1);
}
-unsigned encodeVTYPE(VLMUL VLMUL, unsigned SEW, bool TailAgnostic,
+LLVM_ABI unsigned encodeVTYPE(VLMUL VLMUL, unsigned SEW, bool TailAgnostic,
bool MaskAgnostic);
-unsigned encodeXSfmmVType(unsigned SEW, unsigned Widen, bool AltFmt);
+LLVM_ABI unsigned encodeXSfmmVType(unsigned SEW, unsigned Widen, bool AltFmt);
inline static VLMUL getVLMUL(unsigned VType) {
unsigned VLMul = VType & 0x7;
@@ -97,7 +98,7 @@ inline static VLMUL getVLMUL(unsigned VType) {
}
// Decode VLMUL into 1,2,4,8 and fractional indicator.
-std::pair<unsigned, bool> decodeVLMUL(VLMUL VLMul);
+LLVM_ABI std::pair<unsigned, bool> decodeVLMUL(VLMUL VLMul);
inline static VLMUL encodeLMUL(unsigned LMUL, bool Fractional) {
assert(isValidLMUL(LMUL, Fractional) && "Unsupported LMUL");
@@ -148,11 +149,11 @@ inline static bool isMaskAgnostic(unsigned VType) { return VType & 0x80; }
inline static bool isAltFmt(unsigned VType) { return VType & 0x100; }
-void printVType(unsigned VType, raw_ostream &OS);
+LLVM_ABI void printVType(unsigned VType, raw_ostream &OS);
-unsigned getSEWLMULRatio(unsigned SEW, VLMUL VLMul);
+LLVM_ABI unsigned getSEWLMULRatio(unsigned SEW, VLMUL VLMul);
-std::optional<VLMUL> getSameRatioLMUL(unsigned SEW, VLMUL VLMUL, unsigned EEW);
+LLVM_ABI std::optional<VLMUL> getSameRatioLMUL(unsigned SEW, VLMUL VLMUL, unsigned EEW);
} // namespace RISCVVType
} // namespace llvm
diff --git a/llvm/include/llvm/TargetParser/SubtargetFeature.h b/llvm/include/llvm/TargetParser/SubtargetFeature.h
index 2e1f00dad2df3..63f8aa194ce1c 100644
--- a/llvm/include/llvm/TargetParser/SubtargetFeature.h
+++ b/llvm/include/llvm/TargetParser/SubtargetFeature.h
@@ -17,6 +17,7 @@
#ifndef LLVM_TARGETPARSER_SUBTARGETFEATURE_H
#define LLVM_TARGETPARSER_SUBTARGETFEATURE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
@@ -175,27 +176,27 @@ class SubtargetFeatures {
std::vector<std::string> Features; ///< Subtarget features as a vector
public:
- explicit SubtargetFeatures(StringRef Initial = "");
+ LLVM_ABI explicit SubtargetFeatures(StringRef Initial = "");
/// Returns features as a string.
- std::string getString() const;
+ LLVM_ABI std::string getString() const;
/// Adds Features.
- void AddFeature(StringRef String, bool Enable = true);
+ LLVM_ABI void AddFeature(StringRef String, bool Enable = true);
- void addFeaturesVector(const ArrayRef<std::string> OtherFeatures);
+ LLVM_ABI void addFeaturesVector(const ArrayRef<std::string> OtherFeatures);
/// Returns the vector of individual subtarget features.
const std::vector<std::string> &getFeatures() const { return Features; }
/// Prints feature string.
- void print(raw_ostream &OS) const;
+ LLVM_ABI void print(raw_ostream &OS) const;
// Dumps feature info.
- void dump() const;
+ LLVM_ABI void dump() const;
/// Adds the default features for the specified target triple.
- void getDefaultSubtargetFeatures(const Triple& Triple);
+ LLVM_ABI void getDefaultSubtargetFeatures(const Triple& Triple);
/// Determine if a feature has a flag; '+' or '-'
static bool hasFlag(StringRef Feature) {
@@ -221,7 +222,7 @@ class SubtargetFeatures {
}
/// Splits a string of comma separated items in to a vector of strings.
- static void Split(std::vector<std::string> &V, StringRef S);
+ LLVM_ABI static void Split(std::vector<std::string> &V, StringRef S);
};
} // end namespace llvm
diff --git a/llvm/include/llvm/TargetParser/TargetParser.h b/llvm/include/llvm/TargetParser/TargetParser.h
index f776b41f3d7ca..70137afa7b2bc 100644
--- a/llvm/include/llvm/TargetParser/TargetParser.h
+++ b/llvm/include/llvm/TargetParser/TargetParser.h
@@ -14,6 +14,7 @@
#ifndef LLVM_TARGETPARSER_TARGETPARSER_H
#define LLVM_TARGETPARSER_TARGETPARSER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
@@ -164,27 +165,27 @@ enum FeatureError : uint32_t {
UNSUPPORTED_TARGET_FEATURE
};
-StringRef getArchFamilyNameAMDGCN(GPUKind AK);
+LLVM_ABI StringRef getArchFamilyNameAMDGCN(GPUKind AK);
-StringRef getArchNameAMDGCN(GPUKind AK);
-StringRef getArchNameR600(GPUKind AK);
-StringRef getCanonicalArchName(const Triple &T, StringRef Arch);
-GPUKind parseArchAMDGCN(StringRef CPU);
-GPUKind parseArchR600(StringRef CPU);
-unsigned getArchAttrAMDGCN(GPUKind AK);
-unsigned getArchAttrR600(GPUKind AK);
+LLVM_ABI StringRef getArchNameAMDGCN(GPUKind AK);
+LLVM_ABI StringRef getArchNameR600(GPUKind AK);
+LLVM_ABI StringRef getCanonicalArchName(const Triple &T, StringRef Arch);
+LLVM_ABI GPUKind parseArchAMDGCN(StringRef CPU);
+LLVM_ABI GPUKind parseArchR600(StringRef CPU);
+LLVM_ABI unsigned getArchAttrAMDGCN(GPUKind AK);
+LLVM_ABI unsigned getArchAttrR600(GPUKind AK);
-void fillValidArchListAMDGCN(SmallVectorImpl<StringRef> &Values);
-void fillValidArchListR600(SmallVectorImpl<StringRef> &Values);
+LLVM_ABI void fillValidArchListAMDGCN(SmallVectorImpl<StringRef> &Values);
+LLVM_ABI void fillValidArchListR600(SmallVectorImpl<StringRef> &Values);
-IsaVersion getIsaVersion(StringRef GPU);
+LLVM_ABI IsaVersion getIsaVersion(StringRef GPU);
/// Fills Features map with default values for given target GPU
-void fillAMDGPUFeatureMap(StringRef GPU, const Triple &T,
+LLVM_ABI void fillAMDGPUFeatureMap(StringRef GPU, const Triple &T,
StringMap<bool> &Features);
/// Inserts wave size feature for given GPU into features map
-std::pair<FeatureError, StringRef>
+LLVM_ABI std::pair<FeatureError, StringRef>
insertWaveSizeFeature(StringRef GPU, const Triple &T,
StringMap<bool> &Features);
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index b56e6e18805e0..372feacacdd71 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -9,6 +9,7 @@
#ifndef LLVM_TARGETPARSER_TRIPLE_H
#define LLVM_TARGETPARSER_TRIPLE_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/VersionTuple.h"
@@ -348,9 +349,9 @@ class Triple {
/// triple fields unknown.
Triple() = default;
- explicit Triple(const Twine &Str);
- Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
- Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
+ LLVM_ABI explicit Triple(const Twine &Str);
+ LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
+ LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
const Twine &EnvironmentStr);
bool operator==(const Triple &Other) const {
@@ -381,7 +382,7 @@ class Triple {
/// reasonably be done). In particular, it handles the common case in which
/// otherwise valid components are in the wrong order. \p Form is used to
/// specify the output canonical form.
- static std::string normalize(StringRef Str,
+ LLVM_ABI static std::string normalize(StringRef Str,
CanonicalForm Form = CanonicalForm::ANY);
/// Return the normalized form of this triple's string.
@@ -417,7 +418,7 @@ class Triple {
/// triple, if present.
///
/// For example, "fooos1.2.3" would return (1, 2, 3).
- VersionTuple getEnvironmentVersion() const;
+ LLVM_ABI VersionTuple getEnvironmentVersion() const;
/// Get the object format for this triple.
ObjectFormatType getObjectFormat() const { return ObjectFormat; }
@@ -426,7 +427,7 @@ class Triple {
/// present.
///
/// For example, "fooos1.2.3" would return (1, 2, 3).
- VersionTuple getOSVersion() const;
+ LLVM_ABI VersionTuple getOSVersion() const;
/// Return just the major version number, this is specialized because it is a
/// common query.
@@ -436,26 +437,26 @@ class Triple {
/// "darwin" versions to the corresponding OS X versions. This may also be
/// called with IOS triples but the OS X version number is just set to a
/// constant 10.4.0 in that case. Returns true if successful.
- bool getMacOSXVersion(VersionTuple &Version) const;
+ LLVM_ABI bool getMacOSXVersion(VersionTuple &Version) const;
/// Parse the version number as with getOSVersion. This should only be called
/// with IOS or generic triples.
- VersionTuple getiOSVersion() const;
+ LLVM_ABI VersionTuple getiOSVersion() const;
/// Parse the version number as with getOSVersion. This should only be called
/// with WatchOS or generic triples.
- VersionTuple getWatchOSVersion() const;
+ LLVM_ABI VersionTuple getWatchOSVersion() const;
/// Parse the version number as with getOSVersion.
- VersionTuple getDriverKitVersion() const;
+ LLVM_ABI VersionTuple getDriverKitVersion() const;
/// Parse the Vulkan version number from the OSVersion and SPIR-V version
/// (SubArch). This should only be called with Vulkan SPIR-V triples.
- VersionTuple getVulkanVersion() const;
+ LLVM_ABI VersionTuple getVulkanVersion() const;
/// Parse the DXIL version number from the OSVersion and DXIL version
/// (SubArch). This should only be called with DXIL triples.
- VersionTuple getDXILVersion() const;
+ LLVM_ABI VersionTuple getDXILVersion() const;
/// @}
/// @name Direct Component Access
@@ -469,34 +470,34 @@ class Triple {
bool empty() const { return Data.empty(); }
/// Get the architecture (first) component of the triple.
- StringRef getArchName() const;
+ LLVM_ABI StringRef getArchName() const;
/// Get the vendor (second) component of the triple.
- StringRef getVendorName() const;
+ LLVM_ABI StringRef getVendorName() const;
/// Get the operating system (third) component of the triple.
- StringRef getOSName() const;
+ LLVM_ABI StringRef getOSName() const;
/// Get the optional environment (fourth) component of the triple, or "" if
/// empty.
- StringRef getEnvironmentName() const;
+ LLVM_ABI StringRef getEnvironmentName() const;
/// Get the operating system and optional environment components as a single
/// string (separated by a '-' if the environment component is present).
- StringRef getOSAndEnvironmentName() const;
+ LLVM_ABI StringRef getOSAndEnvironmentName() const;
/// Get the version component of the environment component as a single
/// string (the version after the environment).
///
/// For example, "fooos1.2.3" would return "1.2.3".
- StringRef getEnvironmentVersionString() const;
+ LLVM_ABI StringRef getEnvironmentVersionString() const;
/// @}
/// @name Convenience Predicates
/// @{
/// Returns the pointer width of this architecture.
- static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch);
+ LLVM_ABI static unsigned getArchPointerBitWidth(llvm::Triple::ArchType Arch);
/// Returns the pointer width of this architecture.
unsigned getArchPointerBitWidth() const {
@@ -504,7 +505,7 @@ class Triple {
}
/// Returns the trampoline size in bytes for this configuration.
- unsigned getTrampolineSize() const;
+ LLVM_ABI unsigned getTrampolineSize() const;
/// Test whether the architecture is 64-bit
///
@@ -513,17 +514,17 @@ class Triple {
/// 16-bit. The inner details of pointer width for particular architectures
/// is not summed up in the triple, and so only a coarse grained predicate
/// system is provided.
- bool isArch64Bit() const;
+ LLVM_ABI bool isArch64Bit() const;
/// Test whether the architecture is 32-bit
///
/// Note that this tests for 32-bit pointer width, and nothing else.
- bool isArch32Bit() const;
+ LLVM_ABI bool isArch32Bit() const;
/// Test whether the architecture is 16-bit
///
/// Note that this tests for 16-bit pointer width, and nothing else.
- bool isArch16Bit() const;
+ LLVM_ABI bool isArch16Bit() const;
/// Helper function for doing comparisons against version numbers included in
/// the target triple.
@@ -544,7 +545,7 @@ class Triple {
/// Comparison function for checking OS X version compatibility, which handles
/// supporting skewed version numbering schemes used by the "darwin" triples.
- bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
+ LLVM_ABI bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
unsigned Micro = 0) const;
/// Is this a Mac OS X triple. For legacy reasons, we support both "darwin"
@@ -1171,38 +1172,38 @@ class Triple {
/// @{
/// Set the architecture (first) component of the triple to a known type.
- void setArch(ArchType Kind, SubArchType SubArch = NoSubArch);
+ LLVM_ABI void setArch(ArchType Kind, SubArchType SubArch = NoSubArch);
/// Set the vendor (second) component of the triple to a known type.
- void setVendor(VendorType Kind);
+ LLVM_ABI void setVendor(VendorType Kind);
/// Set the operating system (third) component of the triple to a known type.
- void setOS(OSType Kind);
+ LLVM_ABI void setOS(OSType Kind);
/// Set the environment (fourth) component of the triple to a known type.
- void setEnvironment(EnvironmentType Kind);
+ LLVM_ABI void setEnvironment(EnvironmentType Kind);
/// Set the object file format.
- void setObjectFormat(ObjectFormatType Kind);
+ LLVM_ABI void setObjectFormat(ObjectFormatType Kind);
/// Set all components to the new triple \p Str.
- void setTriple(const Twine &Str);
+ LLVM_ABI void setTriple(const Twine &Str);
/// Set the architecture (first) component of the triple by name.
- void setArchName(StringRef Str);
+ LLVM_ABI void setArchName(StringRef Str);
/// Set the vendor (second) component of the triple by name.
- void setVendorName(StringRef Str);
+ LLVM_ABI void setVendorName(StringRef Str);
/// Set the operating system (third) component of the triple by name.
- void setOSName(StringRef Str);
+ LLVM_ABI void setOSName(StringRef Str);
/// Set the optional environment (fourth) component of the triple by name.
- void setEnvironmentName(StringRef Str);
+ LLVM_ABI void setEnvironmentName(StringRef Str);
/// Set the operating system and optional environment components with a single
/// string.
- void setOSAndEnvironmentName(StringRef Str);
+ LLVM_ABI void setOSAndEnvironmentName(StringRef Str);
/// @}
/// @name Helpers to build variants of a particular triple.
@@ -1214,7 +1215,7 @@ class Triple {
///
/// \returns A new triple with a 32-bit architecture or an unknown
/// architecture if no such variant can be found.
- llvm::Triple get32BitArchVariant() const;
+ LLVM_ABI llvm::Triple get32BitArchVariant() const;
/// Form a triple with a 64-bit variant of the current architecture.
///
@@ -1222,7 +1223,7 @@ class Triple {
///
/// \returns A new triple with a 64-bit architecture or an unknown
/// architecture if no such variant can be found.
- llvm::Triple get64BitArchVariant() const;
+ LLVM_ABI llvm::Triple get64BitArchVariant() const;
/// Form a triple with a big endian variant of the current architecture.
///
@@ -1230,7 +1231,7 @@ class Triple {
///
/// \returns A new triple with a big endian architecture or an unknown
/// architecture if no such variant can be found.
- llvm::Triple getBigEndianArchVariant() const;
+ LLVM_ABI llvm::Triple getBigEndianArchVariant() const;
/// Form a triple with a little endian variant of the current architecture.
///
@@ -1238,73 +1239,73 @@ class Triple {
///
/// \returns A new triple with a little endian architecture or an unknown
/// architecture if no such variant can be found.
- llvm::Triple getLittleEndianArchVariant() const;
+ LLVM_ABI llvm::Triple getLittleEndianArchVariant() const;
/// Tests whether the target triple is little endian.
///
/// \returns true if the triple is little endian, false otherwise.
- bool isLittleEndian() const;
+ LLVM_ABI bool isLittleEndian() const;
/// Test whether target triples are compatible.
- bool isCompatibleWith(const Triple &Other) const;
+ LLVM_ABI bool isCompatibleWith(const Triple &Other) const;
/// Test whether the target triple is for a GPU.
bool isGPU() const { return isSPIRV() || isNVPTX() || isAMDGPU(); }
/// Merge target triples.
- std::string merge(const Triple &Other) const;
+ LLVM_ABI std::string merge(const Triple &Other) const;
/// Some platforms have different minimum supported OS versions that
/// varies by the architecture specified in the triple. This function
/// returns the minimum supported OS version for this triple if one an exists,
/// or an invalid version tuple if this triple doesn't have one.
- VersionTuple getMinimumSupportedOSVersion() const;
+ LLVM_ABI VersionTuple getMinimumSupportedOSVersion() const;
/// @}
/// @name Static helpers for IDs.
/// @{
/// Get the canonical name for the \p Kind architecture.
- static StringRef getArchTypeName(ArchType Kind);
+ LLVM_ABI static StringRef getArchTypeName(ArchType Kind);
/// Get the architecture name based on \p Kind and \p SubArch.
- static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
+ LLVM_ABI static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
/// Get the "prefix" canonical name for the \p Kind architecture. This is the
/// prefix used by the architecture specific builtins, and is suitable for
/// passing to \see Intrinsic::getIntrinsicForClangBuiltin().
///
/// \return - The architecture prefix, or 0 if none is defined.
- static StringRef getArchTypePrefix(ArchType Kind);
+ LLVM_ABI static StringRef getArchTypePrefix(ArchType Kind);
/// Get the canonical name for the \p Kind vendor.
- static StringRef getVendorTypeName(VendorType Kind);
+ LLVM_ABI static StringRef getVendorTypeName(VendorType Kind);
/// Get the canonical name for the \p Kind operating system.
- static StringRef getOSTypeName(OSType Kind);
+ LLVM_ABI static StringRef getOSTypeName(OSType Kind);
/// Get the canonical name for the \p Kind environment.
- static StringRef getEnvironmentTypeName(EnvironmentType Kind);
+ LLVM_ABI static StringRef getEnvironmentTypeName(EnvironmentType Kind);
/// Get the name for the \p Object format.
- static StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat);
+ LLVM_ABI static StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat);
/// @}
/// @name Static helpers for converting alternate architecture names.
/// @{
/// The canonical type for the given LLVM architecture name (e.g., "x86").
- static ArchType getArchTypeForLLVMName(StringRef Str);
+ LLVM_ABI static ArchType getArchTypeForLLVMName(StringRef Str);
/// @}
/// Returns a canonicalized OS version number for the specified OS.
- static VersionTuple getCanonicalVersionForOS(OSType OSKind,
+ LLVM_ABI static VersionTuple getCanonicalVersionForOS(OSType OSKind,
const VersionTuple &Version,
bool IsInValidRange);
/// Returns whether an OS version is invalid and would not map to an Apple OS.
- static bool isValidVersionForOS(OSType OSKind, const VersionTuple &Version);
+ LLVM_ABI static bool isValidVersionForOS(OSType OSKind, const VersionTuple &Version);
};
} // End llvm namespace
diff --git a/llvm/include/llvm/TargetParser/X86TargetParser.h b/llvm/include/llvm/TargetParser/X86TargetParser.h
index 8447aca7bb92a..c9bb015b18dbc 100644
--- a/llvm/include/llvm/TargetParser/X86TargetParser.h
+++ b/llvm/include/llvm/TargetParser/X86TargetParser.h
@@ -13,6 +13,7 @@
#ifndef LLVM_TARGETPARSER_X86TARGETPARSER_H
#define LLVM_TARGETPARSER_X86TARGETPARSER_H
+#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringMap.h"
#include <array>
@@ -153,34 +154,34 @@ enum CPUKind {
/// Parse \p CPU string into a CPUKind. Will only accept 64-bit capable CPUs if
/// \p Only64Bit is true.
-CPUKind parseArchX86(StringRef CPU, bool Only64Bit = false);
-CPUKind parseTuneCPU(StringRef CPU, bool Only64Bit = false);
+LLVM_ABI CPUKind parseArchX86(StringRef CPU, bool Only64Bit = false);
+LLVM_ABI CPUKind parseTuneCPU(StringRef CPU, bool Only64Bit = false);
/// Provide a list of valid CPU names. If \p Only64Bit is true, the list will
/// only contain 64-bit capable CPUs.
-void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values,
+LLVM_ABI void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values,
bool Only64Bit = false);
/// Provide a list of valid -mtune names.
-void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values,
+LLVM_ABI void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values,
bool Only64Bit = false);
/// Get the key feature prioritizing target multiversioning.
-ProcessorFeatures getKeyFeature(CPUKind Kind);
+LLVM_ABI ProcessorFeatures getKeyFeature(CPUKind Kind);
/// Fill in the features that \p CPU supports into \p Features.
/// "+" will be append in front of each feature if NeedPlus is true.
-void getFeaturesForCPU(StringRef CPU, SmallVectorImpl<StringRef> &Features,
+LLVM_ABI void getFeaturesForCPU(StringRef CPU, SmallVectorImpl<StringRef> &Features,
bool NeedPlus = false);
/// Set or clear entries in \p Features that are implied to be enabled/disabled
/// by the provided \p Feature.
-void updateImpliedFeatures(StringRef Feature, bool Enabled,
+LLVM_ABI void updateImpliedFeatures(StringRef Feature, bool Enabled,
StringMap<bool> &Features);
-char getCPUDispatchMangling(StringRef Name);
-bool validateCPUSpecificCPUDispatch(StringRef Name);
-std::array<uint32_t, 4> getCpuSupportsMask(ArrayRef<StringRef> FeatureStrs);
-unsigned getFeaturePriority(ProcessorFeatures Feat);
+LLVM_ABI char getCPUDispatchMangling(StringRef Name);
+LLVM_ABI bool validateCPUSpecificCPUDispatch(StringRef Name);
+LLVM_ABI std::array<uint32_t, 4> getCpuSupportsMask(ArrayRef<StringRef> FeatureStrs);
+LLVM_ABI unsigned getFeaturePriority(ProcessorFeatures Feat);
} // namespace X86
} // namespace llvm
>From 2dcc93d663b0239a8a95fb6421df88db4964e86b Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 9 Jun 2025 13:45:22 -0700
Subject: [PATCH 2/3] [llvm] manual fix-ups to IDS codemod of TargetParser
library
---
llvm/include/llvm/TargetParser/ARMTargetParser.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/llvm/include/llvm/TargetParser/ARMTargetParser.h b/llvm/include/llvm/TargetParser/ARMTargetParser.h
index e2e3033df72ef..c011e549d8dd1 100644
--- a/llvm/include/llvm/TargetParser/ARMTargetParser.h
+++ b/llvm/include/llvm/TargetParser/ARMTargetParser.h
@@ -249,7 +249,6 @@ LLVM_ABI ArchKind convertV9toV8(ArchKind AK);
LLVM_ABI FPUKind getDefaultFPU(StringRef CPU, ArchKind AK);
LLVM_ABI uint64_t getDefaultExtensions(StringRef CPU, ArchKind AK);
LLVM_ABI StringRef getDefaultCPU(StringRef Arch);
-StringRef getCanonicalArchName(StringRef Arch);
LLVM_ABI StringRef getFPUSynonym(StringRef FPU);
// Parser
>From 127f6f6d8139cd85dc67fbd557ce8859d571c8e7 Mon Sep 17 00:00:00 2001
From: Andrew Rogers <andrurogerz at gmail.com>
Date: Mon, 9 Jun 2025 13:46:03 -0700
Subject: [PATCH 3/3] [llvm] clang-format changes to TargetParser library
---
.../llvm/TargetParser/AArch64TargetParser.h | 21 +++++++------
.../llvm/TargetParser/ARMTargetParser.h | 17 ++++++-----
.../llvm/TargetParser/ARMTargetParserCommon.h | 4 +--
.../llvm/TargetParser/CSKYTargetParser.h | 5 ++--
.../llvm/TargetParser/PPCTargetParser.h | 8 +++--
llvm/include/llvm/TargetParser/RISCVISAInfo.h | 15 +++++-----
.../llvm/TargetParser/RISCVTargetParser.h | 17 ++++++-----
.../llvm/TargetParser/SubtargetFeature.h | 4 +--
llvm/include/llvm/TargetParser/TargetParser.h | 4 +--
llvm/include/llvm/TargetParser/Triple.h | 30 +++++++++++--------
.../llvm/TargetParser/X86TargetParser.h | 16 +++++-----
11 files changed, 80 insertions(+), 61 deletions(-)
diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h
index ea736789887a5..59e8117ccb730 100644
--- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h
+++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h
@@ -14,12 +14,12 @@
#ifndef LLVM_TARGETPARSER_AARCH64TARGETPARSER_H
#define LLVM_TARGETPARSER_AARCH64TARGETPARSER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Bitset.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/VersionTuple.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/SubtargetFeature.h"
@@ -203,14 +203,16 @@ struct ExtensionSet {
// the form "<name>" to enable a feature or "no<name>" to disable it. This
// will also enable or disable any features as required by the dependencies
// between them.
- LLVM_ABI bool parseModifier(StringRef Modifier, const bool AllowNoDashForm = false);
+ LLVM_ABI bool parseModifier(StringRef Modifier,
+ const bool AllowNoDashForm = false);
// Constructs a new ExtensionSet by toggling the corresponding bits for every
// feature in the \p Features list without expanding their dependencies. Used
// for reconstructing an ExtensionSet from the output of toLLVMFeatures().
// Features that are not recognized are pushed back to \p NonExtensions.
- LLVM_ABI void reconstructFromParsedFeatures(const std::vector<std::string> &Features,
- std::vector<std::string> &NonExtensions);
+ LLVM_ABI void
+ reconstructFromParsedFeatures(const std::vector<std::string> &Features,
+ std::vector<std::string> &NonExtensions);
// Convert the set of enabled extension to an LLVM feature list, appending
// them to Features.
@@ -242,9 +244,8 @@ struct Alias {
LLVM_ABI const ExtensionInfo &getExtensionByID(ArchExtKind(ExtID));
-LLVM_ABI bool getExtensionFeatures(
- const AArch64::ExtensionBitset &Extensions,
- std::vector<StringRef> &Features);
+LLVM_ABI bool getExtensionFeatures(const AArch64::ExtensionBitset &Extensions,
+ std::vector<StringRef> &Features);
LLVM_ABI StringRef getArchExtFeature(StringRef ArchExt);
LLVM_ABI StringRef resolveCPUAlias(StringRef CPU);
@@ -256,7 +257,8 @@ LLVM_ABI const ArchInfo *getArchForCpu(StringRef CPU);
LLVM_ABI const ArchInfo *parseArch(StringRef Arch);
// Return the extension which has the given -target-feature name.
-LLVM_ABI std::optional<ExtensionInfo> targetFeatureToExtension(StringRef TargetFeature);
+LLVM_ABI std::optional<ExtensionInfo>
+targetFeatureToExtension(StringRef TargetFeature);
// Parse a name as defined by the Extension class in tablegen.
LLVM_ABI std::optional<ExtensionInfo> parseArchExtension(StringRef Extension);
@@ -285,7 +287,8 @@ LLVM_ABI uint64_t getCpuSupportsMask(ArrayRef<StringRef> Features);
LLVM_ABI void PrintSupportedExtensions();
-LLVM_ABI void printEnabledExtensions(const std::set<StringRef> &EnabledFeatureNames);
+LLVM_ABI void
+printEnabledExtensions(const std::set<StringRef> &EnabledFeatureNames);
} // namespace AArch64
} // namespace llvm
diff --git a/llvm/include/llvm/TargetParser/ARMTargetParser.h b/llvm/include/llvm/TargetParser/ARMTargetParser.h
index c011e549d8dd1..798c578ced938 100644
--- a/llvm/include/llvm/TargetParser/ARMTargetParser.h
+++ b/llvm/include/llvm/TargetParser/ARMTargetParser.h
@@ -14,10 +14,10 @@
#ifndef LLVM_TARGETPARSER_ARMTARGETPARSER_H
#define LLVM_TARGETPARSER_ARMTARGETPARSER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ARMBuildAttributes.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/TargetParser/ARMTargetParserCommon.h"
#include <vector>
@@ -230,9 +230,10 @@ LLVM_ABI NeonSupportLevel getFPUNeonSupportLevel(FPUKind FPUKind);
LLVM_ABI FPURestriction getFPURestriction(FPUKind FPUKind);
LLVM_ABI bool getFPUFeatures(FPUKind FPUKind, std::vector<StringRef> &Features);
-LLVM_ABI bool getHWDivFeatures(uint64_t HWDivKind, std::vector<StringRef> &Features);
+LLVM_ABI bool getHWDivFeatures(uint64_t HWDivKind,
+ std::vector<StringRef> &Features);
LLVM_ABI bool getExtensionFeatures(uint64_t Extensions,
- std::vector<StringRef> &Features);
+ std::vector<StringRef> &Features);
LLVM_ABI StringRef getArchName(ArchKind AK);
LLVM_ABI unsigned getArchAttr(ArchKind AK);
@@ -240,9 +241,10 @@ LLVM_ABI StringRef getCPUAttr(ArchKind AK);
LLVM_ABI StringRef getSubArch(ArchKind AK);
LLVM_ABI StringRef getArchExtName(uint64_t ArchExtKind);
LLVM_ABI StringRef getArchExtFeature(StringRef ArchExt);
-LLVM_ABI bool appendArchExtFeatures(StringRef CPU, ARM::ArchKind AK, StringRef ArchExt,
- std::vector<StringRef> &Features,
- FPUKind &ArgFPUKind);
+LLVM_ABI bool appendArchExtFeatures(StringRef CPU, ARM::ArchKind AK,
+ StringRef ArchExt,
+ std::vector<StringRef> &Features,
+ FPUKind &ArgFPUKind);
LLVM_ABI ArchKind convertV9toV8(ArchKind AK);
// Information by Name
@@ -267,7 +269,8 @@ LLVM_ABI StringRef computeDefaultTargetABI(const Triple &TT, StringRef CPU);
///
/// \param Arch the architecture name (e.g., "armv7s"). If it is an empty
/// string then the triple's arch name is used.
-LLVM_ABI StringRef getARMCPUForArch(const llvm::Triple &Triple, StringRef MArch = {});
+LLVM_ABI StringRef getARMCPUForArch(const llvm::Triple &Triple,
+ StringRef MArch = {});
LLVM_ABI void PrintSupportedExtensions(StringMap<StringRef> DescMap);
diff --git a/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h b/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h
index a4d21a9c5d497..7c8030dd5576a 100644
--- a/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h
+++ b/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h
@@ -13,8 +13,8 @@
#ifndef LLVM_TARGETPARSER_ARMTARGETPARSERCOMMON_H
#define LLVM_TARGETPARSER_ARMTARGETPARSERCOMMON_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
namespace ARM {
@@ -47,7 +47,7 @@ struct ParsedBranchProtection {
};
LLVM_ABI bool parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP,
- StringRef &Err, bool EnablePAuthLR = false);
+ StringRef &Err, bool EnablePAuthLR = false);
} // namespace ARM
} // namespace llvm
diff --git a/llvm/include/llvm/TargetParser/CSKYTargetParser.h b/llvm/include/llvm/TargetParser/CSKYTargetParser.h
index 1d93055e67456..8eab03ca01490 100644
--- a/llvm/include/llvm/TargetParser/CSKYTargetParser.h
+++ b/llvm/include/llvm/TargetParser/CSKYTargetParser.h
@@ -183,13 +183,14 @@ LLVM_ABI StringRef getArchExtName(uint64_t ArchExtKind);
LLVM_ABI StringRef getArchExtFeature(StringRef ArchExt);
LLVM_ABI uint64_t getDefaultExtensions(StringRef CPU);
LLVM_ABI bool getExtensionFeatures(uint64_t Extensions,
- std::vector<StringRef> &Features);
+ std::vector<StringRef> &Features);
// Information by ID
LLVM_ABI StringRef getFPUName(unsigned FPUKind);
LLVM_ABI FPUVersion getFPUVersion(unsigned FPUKind);
-LLVM_ABI bool getFPUFeatures(CSKYFPUKind Kind, std::vector<StringRef> &Features);
+LLVM_ABI bool getFPUFeatures(CSKYFPUKind Kind,
+ std::vector<StringRef> &Features);
// Parser
LLVM_ABI ArchKind parseArch(StringRef Arch);
diff --git a/llvm/include/llvm/TargetParser/PPCTargetParser.h b/llvm/include/llvm/TargetParser/PPCTargetParser.h
index 56e07023f5f4f..59d9f867005a4 100644
--- a/llvm/include/llvm/TargetParser/PPCTargetParser.h
+++ b/llvm/include/llvm/TargetParser/PPCTargetParser.h
@@ -14,8 +14,8 @@
#ifndef LLVM_TARGETPARSER_PPCTARGETPARSER_H
#define LLVM_TARGETPARSER_PPCTARGETPARSER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/TargetParser/Triple.h"
namespace llvm {
@@ -27,10 +27,12 @@ LLVM_ABI void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values);
// Get target CPU name.
// If CPUName is empty or generic, return the default CPU name.
// If CPUName is not empty or generic, return the normalized CPU name.
-LLVM_ABI StringRef getNormalizedPPCTargetCPU(const Triple &T, StringRef CPUName = "");
+LLVM_ABI StringRef getNormalizedPPCTargetCPU(const Triple &T,
+ StringRef CPUName = "");
// Get the tune CPU name.
-LLVM_ABI StringRef getNormalizedPPCTuneCPU(const Triple &T, StringRef CPUName = "");
+LLVM_ABI StringRef getNormalizedPPCTuneCPU(const Triple &T,
+ StringRef CPUName = "");
// For PPC, there are some cpu names for same CPU, like pwr10 and power10,
// normalize them.
diff --git a/llvm/include/llvm/TargetParser/RISCVISAInfo.h b/llvm/include/llvm/TargetParser/RISCVISAInfo.h
index d4bfbd0bb184b..0c308cadba790 100644
--- a/llvm/include/llvm/TargetParser/RISCVISAInfo.h
+++ b/llvm/include/llvm/TargetParser/RISCVISAInfo.h
@@ -9,9 +9,9 @@
#ifndef LLVM_SUPPORT_RISCVISAINFO_H
#define LLVM_SUPPORT_RISCVISAINFO_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/RISCVISAUtils.h"
@@ -52,7 +52,7 @@ class RISCVISAInfo {
/// Convert RISC-V ISA info to a feature vector.
LLVM_ABI std::vector<std::string> toFeatures(bool AddAllExtensions = false,
- bool IgnoreUnknown = true) const;
+ bool IgnoreUnknown = true) const;
const RISCVISAUtils::OrderedExtensionMap &getExtensions() const {
return Exts;
@@ -72,14 +72,15 @@ class RISCVISAInfo {
LLVM_ABI static bool isSupportedExtensionFeature(StringRef Ext);
LLVM_ABI static bool isSupportedExtension(StringRef Ext);
LLVM_ABI static bool isSupportedExtensionWithVersion(StringRef Ext);
- LLVM_ABI static bool isSupportedExtension(StringRef Ext, unsigned MajorVersion,
- unsigned MinorVersion);
+ LLVM_ABI static bool isSupportedExtension(StringRef Ext,
+ unsigned MajorVersion,
+ unsigned MinorVersion);
LLVM_ABI static std::string getTargetFeatureForExtension(StringRef Ext);
LLVM_ABI static void printSupportedExtensions(StringMap<StringRef> &DescMap);
- LLVM_ABI static void printEnabledExtensions(bool IsRV64,
- std::set<StringRef> &EnabledFeatureNames,
- StringMap<StringRef> &DescMap);
+ LLVM_ABI static void
+ printEnabledExtensions(bool IsRV64, std::set<StringRef> &EnabledFeatureNames,
+ StringMap<StringRef> &DescMap);
/// Return the group id and bit position of __riscv_feature_bits. Returns
/// <-1, -1> if not supported.
diff --git a/llvm/include/llvm/TargetParser/RISCVTargetParser.h b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
index f35c85998e09c..41fdab6012aa0 100644
--- a/llvm/include/llvm/TargetParser/RISCVTargetParser.h
+++ b/llvm/include/llvm/TargetParser/RISCVTargetParser.h
@@ -14,8 +14,8 @@
#ifndef LLVM_TARGETPARSER_RISCVTARGETPARSER_H
#define LLVM_TARGETPARSER_RISCVTARGETPARSER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
@@ -45,13 +45,15 @@ static constexpr unsigned RVVBitsPerBlock = 64;
static constexpr unsigned RVVBytesPerBlock = RVVBitsPerBlock / 8;
LLVM_ABI void getFeaturesForCPU(StringRef CPU,
- SmallVectorImpl<std::string> &EnabledFeatures,
- bool NeedPlus = false);
+ SmallVectorImpl<std::string> &EnabledFeatures,
+ bool NeedPlus = false);
LLVM_ABI bool parseCPU(StringRef CPU, bool IsRV64);
LLVM_ABI bool parseTuneCPU(StringRef CPU, bool IsRV64);
LLVM_ABI StringRef getMArchFromMcpu(StringRef CPU);
-LLVM_ABI void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64);
-LLVM_ABI void fillValidTuneCPUArchList(SmallVectorImpl<StringRef> &Values, bool IsRV64);
+LLVM_ABI void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values,
+ bool IsRV64);
+LLVM_ABI void fillValidTuneCPUArchList(SmallVectorImpl<StringRef> &Values,
+ bool IsRV64);
LLVM_ABI bool hasFastScalarUnalignedAccess(StringRef CPU);
LLVM_ABI bool hasFastVectorUnalignedAccess(StringRef CPU);
LLVM_ABI bool hasValidCPUModel(StringRef CPU);
@@ -88,7 +90,7 @@ inline static bool isValidLMUL(unsigned LMUL, bool Fractional) {
}
LLVM_ABI unsigned encodeVTYPE(VLMUL VLMUL, unsigned SEW, bool TailAgnostic,
- bool MaskAgnostic);
+ bool MaskAgnostic);
LLVM_ABI unsigned encodeXSfmmVType(unsigned SEW, unsigned Widen, bool AltFmt);
@@ -153,7 +155,8 @@ LLVM_ABI void printVType(unsigned VType, raw_ostream &OS);
LLVM_ABI unsigned getSEWLMULRatio(unsigned SEW, VLMUL VLMul);
-LLVM_ABI std::optional<VLMUL> getSameRatioLMUL(unsigned SEW, VLMUL VLMUL, unsigned EEW);
+LLVM_ABI std::optional<VLMUL> getSameRatioLMUL(unsigned SEW, VLMUL VLMUL,
+ unsigned EEW);
} // namespace RISCVVType
} // namespace llvm
diff --git a/llvm/include/llvm/TargetParser/SubtargetFeature.h b/llvm/include/llvm/TargetParser/SubtargetFeature.h
index 63f8aa194ce1c..6f1723dec5d04 100644
--- a/llvm/include/llvm/TargetParser/SubtargetFeature.h
+++ b/llvm/include/llvm/TargetParser/SubtargetFeature.h
@@ -17,10 +17,10 @@
#ifndef LLVM_TARGETPARSER_SUBTARGETFEATURE_H
#define LLVM_TARGETPARSER_SUBTARGETFEATURE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/MathExtras.h"
#include <array>
#include <initializer_list>
@@ -196,7 +196,7 @@ class SubtargetFeatures {
LLVM_ABI void dump() const;
/// Adds the default features for the specified target triple.
- LLVM_ABI void getDefaultSubtargetFeatures(const Triple& Triple);
+ LLVM_ABI void getDefaultSubtargetFeatures(const Triple &Triple);
/// Determine if a feature has a flag; '+' or '-'
static bool hasFlag(StringRef Feature) {
diff --git a/llvm/include/llvm/TargetParser/TargetParser.h b/llvm/include/llvm/TargetParser/TargetParser.h
index 70137afa7b2bc..176205e17ae00 100644
--- a/llvm/include/llvm/TargetParser/TargetParser.h
+++ b/llvm/include/llvm/TargetParser/TargetParser.h
@@ -14,9 +14,9 @@
#ifndef LLVM_TARGETPARSER_TARGETPARSER_H
#define LLVM_TARGETPARSER_TARGETPARSER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
namespace llvm {
@@ -182,7 +182,7 @@ LLVM_ABI IsaVersion getIsaVersion(StringRef GPU);
/// Fills Features map with default values for given target GPU
LLVM_ABI void fillAMDGPUFeatureMap(StringRef GPU, const Triple &T,
- StringMap<bool> &Features);
+ StringMap<bool> &Features);
/// Inserts wave size feature for given GPU into features map
LLVM_ABI std::pair<FeatureError, StringRef>
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index 372feacacdd71..b6f15ef13191f 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -9,8 +9,8 @@
#ifndef LLVM_TARGETPARSER_TRIPLE_H
#define LLVM_TARGETPARSER_TRIPLE_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Compiler.h"
#include "llvm/Support/VersionTuple.h"
// Some system headers or GCC predefined macros conflict with identifiers in
@@ -350,9 +350,10 @@ class Triple {
Triple() = default;
LLVM_ABI explicit Triple(const Twine &Str);
- LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
- LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
- const Twine &EnvironmentStr);
+ LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr,
+ const Twine &OSStr);
+ LLVM_ABI Triple(const Twine &ArchStr, const Twine &VendorStr,
+ const Twine &OSStr, const Twine &EnvironmentStr);
bool operator==(const Triple &Other) const {
return Arch == Other.Arch && SubArch == Other.SubArch &&
@@ -382,8 +383,8 @@ class Triple {
/// reasonably be done). In particular, it handles the common case in which
/// otherwise valid components are in the wrong order. \p Form is used to
/// specify the output canonical form.
- LLVM_ABI static std::string normalize(StringRef Str,
- CanonicalForm Form = CanonicalForm::ANY);
+ LLVM_ABI static std::string
+ normalize(StringRef Str, CanonicalForm Form = CanonicalForm::ANY);
/// Return the normalized form of this triple's string.
std::string normalize(CanonicalForm Form = CanonicalForm::ANY) const {
@@ -546,7 +547,7 @@ class Triple {
/// Comparison function for checking OS X version compatibility, which handles
/// supporting skewed version numbering schemes used by the "darwin" triples.
LLVM_ABI bool isMacOSXVersionLT(unsigned Major, unsigned Minor = 0,
- unsigned Micro = 0) const;
+ unsigned Micro = 0) const;
/// Is this a Mac OS X triple. For legacy reasons, we support both "darwin"
/// and "osx" as OS X triples.
@@ -1269,7 +1270,8 @@ class Triple {
LLVM_ABI static StringRef getArchTypeName(ArchType Kind);
/// Get the architecture name based on \p Kind and \p SubArch.
- LLVM_ABI static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
+ LLVM_ABI static StringRef getArchName(ArchType Kind,
+ SubArchType SubArch = NoSubArch);
/// Get the "prefix" canonical name for the \p Kind architecture. This is the
/// prefix used by the architecture specific builtins, and is suitable for
@@ -1288,7 +1290,8 @@ class Triple {
LLVM_ABI static StringRef getEnvironmentTypeName(EnvironmentType Kind);
/// Get the name for the \p Object format.
- LLVM_ABI static StringRef getObjectFormatTypeName(ObjectFormatType ObjectFormat);
+ LLVM_ABI static StringRef
+ getObjectFormatTypeName(ObjectFormatType ObjectFormat);
/// @}
/// @name Static helpers for converting alternate architecture names.
@@ -1300,12 +1303,13 @@ class Triple {
/// @}
/// Returns a canonicalized OS version number for the specified OS.
- LLVM_ABI static VersionTuple getCanonicalVersionForOS(OSType OSKind,
- const VersionTuple &Version,
- bool IsInValidRange);
+ LLVM_ABI static VersionTuple
+ getCanonicalVersionForOS(OSType OSKind, const VersionTuple &Version,
+ bool IsInValidRange);
/// Returns whether an OS version is invalid and would not map to an Apple OS.
- LLVM_ABI static bool isValidVersionForOS(OSType OSKind, const VersionTuple &Version);
+ LLVM_ABI static bool isValidVersionForOS(OSType OSKind,
+ const VersionTuple &Version);
};
} // End llvm namespace
diff --git a/llvm/include/llvm/TargetParser/X86TargetParser.h b/llvm/include/llvm/TargetParser/X86TargetParser.h
index c9bb015b18dbc..f6aeaada346e7 100644
--- a/llvm/include/llvm/TargetParser/X86TargetParser.h
+++ b/llvm/include/llvm/TargetParser/X86TargetParser.h
@@ -13,9 +13,9 @@
#ifndef LLVM_TARGETPARSER_X86TARGETPARSER_H
#define LLVM_TARGETPARSER_X86TARGETPARSER_H
-#include "llvm/Support/Compiler.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/Support/Compiler.h"
#include <array>
namespace llvm {
@@ -160,27 +160,29 @@ LLVM_ABI CPUKind parseTuneCPU(StringRef CPU, bool Only64Bit = false);
/// Provide a list of valid CPU names. If \p Only64Bit is true, the list will
/// only contain 64-bit capable CPUs.
LLVM_ABI void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values,
- bool Only64Bit = false);
+ bool Only64Bit = false);
/// Provide a list of valid -mtune names.
LLVM_ABI void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values,
- bool Only64Bit = false);
+ bool Only64Bit = false);
/// Get the key feature prioritizing target multiversioning.
LLVM_ABI ProcessorFeatures getKeyFeature(CPUKind Kind);
/// Fill in the features that \p CPU supports into \p Features.
/// "+" will be append in front of each feature if NeedPlus is true.
-LLVM_ABI void getFeaturesForCPU(StringRef CPU, SmallVectorImpl<StringRef> &Features,
- bool NeedPlus = false);
+LLVM_ABI void getFeaturesForCPU(StringRef CPU,
+ SmallVectorImpl<StringRef> &Features,
+ bool NeedPlus = false);
/// Set or clear entries in \p Features that are implied to be enabled/disabled
/// by the provided \p Feature.
LLVM_ABI void updateImpliedFeatures(StringRef Feature, bool Enabled,
- StringMap<bool> &Features);
+ StringMap<bool> &Features);
LLVM_ABI char getCPUDispatchMangling(StringRef Name);
LLVM_ABI bool validateCPUSpecificCPUDispatch(StringRef Name);
-LLVM_ABI std::array<uint32_t, 4> getCpuSupportsMask(ArrayRef<StringRef> FeatureStrs);
+LLVM_ABI std::array<uint32_t, 4>
+getCpuSupportsMask(ArrayRef<StringRef> FeatureStrs);
LLVM_ABI unsigned getFeaturePriority(ProcessorFeatures Feat);
} // namespace X86
More information about the llvm-commits
mailing list