diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h index 0338770593bc4..59e8117ccb730 100644 --- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h +++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h @@ -19,6 +19,7 @@ #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" @@ -79,7 +80,7 @@ struct FMVInfo { : Name(Name), FeatureBit(FeatureBit), PriorityBit(PriorityBit), ID(ID) {}; }; -const std::vector &getFMVInfo(); +LLVM_ABI const std::vector &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 findBySubArch(StringRef SubArch); + LLVM_ABI static std::optional findBySubArch(StringRef SubArch); }; #define EMIT_ARCHITECTURES @@ -182,34 +183,36 @@ 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 "" to enable a feature or "no" 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 &Features, - std::vector &NonExtensions); + LLVM_ABI void + reconstructFromParsedFeatures(const std::vector &Features, + std::vector &NonExtensions); // Convert the set of enabled extension to an LLVM feature list, appending // them to Features. @@ -227,7 +230,7 @@ struct ExtensionSet { } } - void dump() const; + LLVM_ABI void dump() const; }; // Name alias. @@ -239,52 +242,53 @@ 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( - const AArch64::ExtensionBitset &Extensions, - std::vector &Features); +LLVM_ABI bool getExtensionFeatures(const AArch64::ExtensionBitset &Extensions, + std::vector &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 targetFeatureToExtension(StringRef TargetFeature); +LLVM_ABI std::optional +targetFeatureToExtension(StringRef TargetFeature); // Parse a name as defined by the Extension class in tablegen. -std::optional parseArchExtension(StringRef Extension); +LLVM_ABI std::optional parseArchExtension(StringRef Extension); // Parse a name as defined by the FMVInfo class in tablegen. -std::optional parseFMVExtension(StringRef Extension); +LLVM_ABI std::optional parseFMVExtension(StringRef Extension); // Given the name of a CPU or alias, return the correponding CpuInfo. -std::optional parseCpu(StringRef Name); +LLVM_ABI std::optional parseCpu(StringRef Name); // Used by target parser tests -void fillValidCPUArchList(SmallVectorImpl &Values); +LLVM_ABI void fillValidCPUArchList(SmallVectorImpl &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 Features); +LLVM_ABI uint64_t getFMVPriority(ArrayRef 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 Features); +LLVM_ABI uint64_t getCpuSupportsMask(ArrayRef Features); -void PrintSupportedExtensions(); +LLVM_ABI void PrintSupportedExtensions(); -void printEnabledExtensions(const std::set &EnabledFeatureNames); +LLVM_ABI void +printEnabledExtensions(const std::set &EnabledFeatureNames); } // namespace AArch64 } // namespace llvm diff --git a/llvm/include/llvm/TargetParser/ARMTargetParser.h b/llvm/include/llvm/TargetParser/ARMTargetParser.h index b2403f42f1b79..798c578ced938 100644 --- a/llvm/include/llvm/TargetParser/ARMTargetParser.h +++ b/llvm/include/llvm/TargetParser/ARMTargetParser.h @@ -17,6 +17,7 @@ #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 @@ -223,53 +224,55 @@ 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 &Features); -bool getHWDivFeatures(uint64_t HWDivKind, std::vector &Features); -bool getExtensionFeatures(uint64_t Extensions, - std::vector &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, - std::vector &Features, - FPUKind &ArgFPUKind); -ArchKind convertV9toV8(ArchKind AK); +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 &Features); +LLVM_ABI bool getHWDivFeatures(uint64_t HWDivKind, + std::vector &Features); +LLVM_ABI bool getExtensionFeatures(uint64_t Extensions, + std::vector &Features); + +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 &Features, + FPUKind &ArgFPUKind); +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); -StringRef getCanonicalArchName(StringRef Arch); -StringRef getFPUSynonym(StringRef FPU); +LLVM_ABI FPUKind getDefaultFPU(StringRef CPU, ArchKind AK); +LLVM_ABI uint64_t getDefaultExtensions(StringRef CPU, ArchKind AK); +LLVM_ABI StringRef getDefaultCPU(StringRef Arch); +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 &Values); -StringRef computeDefaultTargetABI(const Triple &TT, StringRef CPU); +LLVM_ABI void fillValidCPUArchList(SmallVectorImpl &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 DescMap); +LLVM_ABI void PrintSupportedExtensions(StringMap DescMap); } // namespace ARM } // namespace llvm diff --git a/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h b/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h index f6115718e9f5f..7c8030dd5576a 100644 --- a/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h +++ b/llvm/include/llvm/TargetParser/ARMTargetParserCommon.h @@ -14,6 +14,7 @@ #define LLVM_TARGETPARSER_ARMTARGETPARSERCOMMON_H #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" namespace llvm { namespace ARM { @@ -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,8 +46,8 @@ struct ParsedBranchProtection { bool GuardedControlStack; }; -bool parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP, - StringRef &Err, bool EnablePAuthLR = false); +LLVM_ABI bool parseBranchProtection(StringRef Spec, ParsedBranchProtection &PBP, + 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 4c4ec06f758a8..8eab03ca01490 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 @@ -176,25 +177,26 @@ const ArchNames 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, - std::vector &Features); +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 &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 &Features); +LLVM_ABI bool getFPUFeatures(CSKYFPUKind Kind, + std::vector &Features); // Parser -ArchKind parseArch(StringRef Arch); -ArchKind parseCPUArch(StringRef CPU); -uint64_t parseArchExt(StringRef ArchExt); -void fillValidCPUArchList(SmallVectorImpl &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 &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 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 getHostCPUFeatures(); +LLVM_ABI const StringMap 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 @@ -84,12 +85,12 @@ struct ArchInfo { uint32_t Features; }; -bool isValidArchName(StringRef Arch); -bool isValidFeatureName(StringRef Feature); -bool getArchFeatures(StringRef Arch, std::vector &Features); -bool isValidCPUName(StringRef TuneCPU); -void fillValidCPUList(SmallVectorImpl &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 &Features); +LLVM_ABI bool isValidCPUName(StringRef TuneCPU); +LLVM_ABI void fillValidCPUList(SmallVectorImpl &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..59d9f867005a4 100644 --- a/llvm/include/llvm/TargetParser/PPCTargetParser.h +++ b/llvm/include/llvm/TargetParser/PPCTargetParser.h @@ -15,25 +15,28 @@ #define LLVM_TARGETPARSER_PPCTARGETPARSER_H #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" #include "llvm/TargetParser/Triple.h" namespace llvm { namespace PPC { -bool isValidCPU(StringRef CPU); -void fillValidCPUList(SmallVectorImpl &Values); -void fillValidTuneCPUList(SmallVectorImpl &Values); +LLVM_ABI bool isValidCPU(StringRef CPU); +LLVM_ABI void fillValidCPUList(SmallVectorImpl &Values); +LLVM_ABI void fillValidTuneCPUList(SmallVectorImpl &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..0c308cadba790 100644 --- a/llvm/include/llvm/TargetParser/RISCVISAInfo.h +++ b/llvm/include/llvm/TargetParser/RISCVISAInfo.h @@ -11,6 +11,7 @@ #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" @@ -31,27 +32,27 @@ 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> + LLVM_ABI static llvm::Expected> 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> + LLVM_ABI static llvm::Expected> parseNormalizedArchString(StringRef Arch); /// Parse RISC-V ISA info from feature vector. - static llvm::Expected> + LLVM_ABI static llvm::Expected> parseFeatures(unsigned XLen, const std::vector &Features); - static llvm::Expected> + LLVM_ABI static llvm::Expected> createFromExtMap(unsigned XLen, const RISCVISAUtils::OrderedExtensionMap &Exts); /// Convert RISC-V ISA info to a feature vector. - std::vector toFeatures(bool AddAllExtensions = false, - bool IgnoreUnknown = true) const; + LLVM_ABI std::vector toFeatures(bool AddAllExtensions = false, + bool IgnoreUnknown = true) const; const RISCVISAUtils::OrderedExtensionMap &getExtensions() const { return Exts; @@ -64,25 +65,26 @@ 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, - unsigned MinorVersion); - static std::string getTargetFeatureForExtension(StringRef Ext); + 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 std::string getTargetFeatureForExtension(StringRef Ext); - static void printSupportedExtensions(StringMap &DescMap); - static void printEnabledExtensions(bool IsRV64, - std::set &EnabledFeatureNames, - StringMap &DescMap); + LLVM_ABI static void printSupportedExtensions(StringMap &DescMap); + LLVM_ABI static void + printEnabledExtensions(bool IsRV64, std::set &EnabledFeatureNames, + StringMap &DescMap); /// Return the group id and bit position of __riscv_feature_bits. Returns /// <-1, -1> if not supported. - static std::pair getRISCVFeaturesBitsInfo(StringRef Ext); + LLVM_ABI static std::pair 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..41fdab6012aa0 100644 --- a/llvm/include/llvm/TargetParser/RISCVTargetParser.h +++ b/llvm/include/llvm/TargetParser/RISCVTargetParser.h @@ -15,6 +15,7 @@ #define LLVM_TARGETPARSER_RISCVTARGETPARSER_H #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" @@ -43,18 +44,20 @@ struct CPUInfo { static constexpr unsigned RVVBitsPerBlock = 64; static constexpr unsigned RVVBytesPerBlock = RVVBitsPerBlock / 8; -void getFeaturesForCPU(StringRef CPU, - SmallVectorImpl &EnabledFeatures, - bool NeedPlus = false); -bool parseCPU(StringRef CPU, bool IsRV64); -bool parseTuneCPU(StringRef CPU, bool IsRV64); -StringRef getMArchFromMcpu(StringRef CPU); -void fillValidCPUArchList(SmallVectorImpl &Values, bool IsRV64); -void fillValidTuneCPUArchList(SmallVectorImpl &Values, bool IsRV64); -bool hasFastScalarUnalignedAccess(StringRef CPU); -bool hasFastVectorUnalignedAccess(StringRef CPU); -bool hasValidCPUModel(StringRef CPU); -CPUModel getCPUModel(StringRef CPU); +LLVM_ABI void getFeaturesForCPU(StringRef CPU, + SmallVectorImpl &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 &Values, + bool IsRV64); +LLVM_ABI void fillValidTuneCPUArchList(SmallVectorImpl &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 +89,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, - bool MaskAgnostic); +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 +100,7 @@ inline static VLMUL getVLMUL(unsigned VType) { } // Decode VLMUL into 1,2,4,8 and fractional indicator. -std::pair decodeVLMUL(VLMUL VLMul); +LLVM_ABI std::pair decodeVLMUL(VLMUL VLMul); inline static VLMUL encodeLMUL(unsigned LMUL, bool Fractional) { assert(isValidLMUL(LMUL, Fractional) && "Unsupported LMUL"); @@ -148,11 +151,12 @@ 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 getSameRatioLMUL(unsigned SEW, VLMUL VLMUL, unsigned EEW); +LLVM_ABI std::optional 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..6f1723dec5d04 100644 --- a/llvm/include/llvm/TargetParser/SubtargetFeature.h +++ b/llvm/include/llvm/TargetParser/SubtargetFeature.h @@ -20,6 +20,7 @@ #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 #include @@ -175,27 +176,27 @@ class SubtargetFeatures { std::vector 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 OtherFeatures); + LLVM_ABI void addFeaturesVector(const ArrayRef OtherFeatures); /// Returns the vector of individual subtarget features. const std::vector &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 &V, StringRef S); + LLVM_ABI static void Split(std::vector &V, StringRef S); }; } // end namespace llvm diff --git a/llvm/include/llvm/TargetParser/TargetParser.h b/llvm/include/llvm/TargetParser/TargetParser.h index f776b41f3d7ca..176205e17ae00 100644 --- a/llvm/include/llvm/TargetParser/TargetParser.h +++ b/llvm/include/llvm/TargetParser/TargetParser.h @@ -16,6 +16,7 @@ #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/Compiler.h" namespace llvm { @@ -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 &Values); -void fillValidArchListR600(SmallVectorImpl &Values); +LLVM_ABI void fillValidArchListAMDGCN(SmallVectorImpl &Values); +LLVM_ABI void fillValidArchListR600(SmallVectorImpl &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, - StringMap &Features); +LLVM_ABI void fillAMDGPUFeatureMap(StringRef GPU, const Triple &T, + StringMap &Features); /// Inserts wave size feature for given GPU into features map -std::pair +LLVM_ABI std::pair insertWaveSizeFeature(StringRef GPU, const Triple &T, StringMap &Features); diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h index b56e6e18805e0..b6f15ef13191f 100644 --- a/llvm/include/llvm/TargetParser/Triple.h +++ b/llvm/include/llvm/TargetParser/Triple.h @@ -10,6 +10,7 @@ #define LLVM_TARGETPARSER_TRIPLE_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 @@ -348,10 +349,11 @@ 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, - const Twine &EnvironmentStr); + 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 { return Arch == Other.Arch && SubArch == Other.SubArch && @@ -381,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. - 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 { @@ -417,7 +419,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 +428,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 +438,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 +471,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 +506,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 +515,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,8 +546,8 @@ 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, - unsigned Micro = 0) const; + 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" /// and "osx" as OS X triples. @@ -1171,38 +1173,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 +1216,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 +1224,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 +1232,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 +1240,76 @@ 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, - 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. - 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..f6aeaada346e7 100644 --- a/llvm/include/llvm/TargetParser/X86TargetParser.h +++ b/llvm/include/llvm/TargetParser/X86TargetParser.h @@ -15,6 +15,7 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringMap.h" +#include "llvm/Support/Compiler.h" #include namespace llvm { @@ -153,34 +154,36 @@ 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 &Values, - bool Only64Bit = false); +LLVM_ABI void fillValidCPUArchList(SmallVectorImpl &Values, + bool Only64Bit = false); /// Provide a list of valid -mtune names. -void fillValidTuneCPUList(SmallVectorImpl &Values, - bool Only64Bit = false); +LLVM_ABI void fillValidTuneCPUList(SmallVectorImpl &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 &Features, - bool NeedPlus = false); +LLVM_ABI void getFeaturesForCPU(StringRef CPU, + SmallVectorImpl &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, - StringMap &Features); - -char getCPUDispatchMangling(StringRef Name); -bool validateCPUSpecificCPUDispatch(StringRef Name); -std::array getCpuSupportsMask(ArrayRef FeatureStrs); -unsigned getFeaturePriority(ProcessorFeatures Feat); +LLVM_ABI void updateImpliedFeatures(StringRef Feature, bool Enabled, + StringMap &Features); + +LLVM_ABI char getCPUDispatchMangling(StringRef Name); +LLVM_ABI bool validateCPUSpecificCPUDispatch(StringRef Name); +LLVM_ABI std::array +getCpuSupportsMask(ArrayRef FeatureStrs); +LLVM_ABI unsigned getFeaturePriority(ProcessorFeatures Feat); } // namespace X86 } // namespace llvm