1919#include " llvm/ADT/StringExtras.h"
2020#include " llvm/ADT/StringMap.h"
2121#include " llvm/ADT/StringRef.h"
22+ #include " llvm/Support/Compiler.h"
2223#include " llvm/Support/VersionTuple.h"
2324#include " llvm/Support/raw_ostream.h"
2425#include " llvm/TargetParser/SubtargetFeature.h"
@@ -79,7 +80,7 @@ struct FMVInfo {
7980 : Name(Name), FeatureBit(FeatureBit), PriorityBit(PriorityBit), ID(ID) {};
8081};
8182
82- const std::vector<FMVInfo> &getFMVInfo ();
83+ LLVM_ABI const std::vector<FMVInfo> &getFMVInfo ();
8384
8485// Represents a dependency between two architecture extensions. Later is the
8586// feature which was added to the architecture after Earlier, and expands the
@@ -146,7 +147,7 @@ struct ArchInfo {
146147 StringRef getSubArch () const { return ArchFeature.substr (1 ); }
147148
148149 // Search for ArchInfo by SubArch name
149- static std::optional<ArchInfo> findBySubArch (StringRef SubArch);
150+ LLVM_ABI static std::optional<ArchInfo> findBySubArch (StringRef SubArch);
150151};
151152
152153#define EMIT_ARCHITECTURES
@@ -182,34 +183,36 @@ struct ExtensionSet {
182183 // Enable the given architecture extension, and any other extensions it
183184 // depends on. Does not change the base architecture, or follow dependencies
184185 // between features which are only related by required arcitecture versions.
185- void enable (ArchExtKind E);
186+ LLVM_ABI void enable (ArchExtKind E);
186187
187188 // Disable the given architecture extension, and any other extensions which
188189 // depend on it. Does not change the base architecture, or follow
189190 // dependencies between features which are only related by required
190191 // arcitecture versions.
191- void disable (ArchExtKind E);
192+ LLVM_ABI void disable (ArchExtKind E);
192193
193194 // Add default extensions for the given CPU. Records the base architecture,
194195 // to later resolve dependencies which depend on it.
195- void addCPUDefaults (const CpuInfo &CPU);
196+ LLVM_ABI void addCPUDefaults (const CpuInfo &CPU);
196197
197198 // Add default extensions for the given architecture version. Records the
198199 // base architecture, to later resolve dependencies which depend on it.
199- void addArchDefaults (const ArchInfo &Arch);
200+ LLVM_ABI void addArchDefaults (const ArchInfo &Arch);
200201
201202 // Add or remove a feature based on a modifier string. The string must be of
202203 // the form "<name>" to enable a feature or "no<name>" to disable it. This
203204 // will also enable or disable any features as required by the dependencies
204205 // between them.
205- bool parseModifier (StringRef Modifier, const bool AllowNoDashForm = false );
206+ LLVM_ABI bool parseModifier (StringRef Modifier,
207+ const bool AllowNoDashForm = false );
206208
207209 // Constructs a new ExtensionSet by toggling the corresponding bits for every
208210 // feature in the \p Features list without expanding their dependencies. Used
209211 // for reconstructing an ExtensionSet from the output of toLLVMFeatures().
210212 // Features that are not recognized are pushed back to \p NonExtensions.
211- void reconstructFromParsedFeatures (const std::vector<std::string> &Features,
212- std::vector<std::string> &NonExtensions);
213+ LLVM_ABI void
214+ reconstructFromParsedFeatures (const std::vector<std::string> &Features,
215+ std::vector<std::string> &NonExtensions);
213216
214217 // Convert the set of enabled extension to an LLVM feature list, appending
215218 // them to Features.
@@ -227,7 +230,7 @@ struct ExtensionSet {
227230 }
228231 }
229232
230- void dump () const ;
233+ LLVM_ABI void dump () const ;
231234};
232235
233236// Name alias.
@@ -239,52 +242,53 @@ struct Alias {
239242#define EMIT_CPU_ALIAS
240243#include " llvm/TargetParser/AArch64TargetParserDef.inc"
241244
242- const ExtensionInfo &getExtensionByID (ArchExtKind(ExtID));
245+ LLVM_ABI const ExtensionInfo &getExtensionByID (ArchExtKind(ExtID));
243246
244- bool getExtensionFeatures (
245- const AArch64::ExtensionBitset &Extensions,
246- std::vector<StringRef> &Features);
247+ LLVM_ABI bool getExtensionFeatures (const AArch64::ExtensionBitset &Extensions,
248+ std::vector<StringRef> &Features);
247249
248- StringRef getArchExtFeature (StringRef ArchExt);
249- StringRef resolveCPUAlias (StringRef CPU);
250+ LLVM_ABI StringRef getArchExtFeature (StringRef ArchExt);
251+ LLVM_ABI StringRef resolveCPUAlias (StringRef CPU);
250252
251253// Information by Name
252- const ArchInfo *getArchForCpu (StringRef CPU);
254+ LLVM_ABI const ArchInfo *getArchForCpu (StringRef CPU);
253255
254256// Parser
255- const ArchInfo *parseArch (StringRef Arch);
257+ LLVM_ABI const ArchInfo *parseArch (StringRef Arch);
256258
257259// Return the extension which has the given -target-feature name.
258- std::optional<ExtensionInfo> targetFeatureToExtension (StringRef TargetFeature);
260+ LLVM_ABI std::optional<ExtensionInfo>
261+ targetFeatureToExtension (StringRef TargetFeature);
259262
260263// Parse a name as defined by the Extension class in tablegen.
261- std::optional<ExtensionInfo> parseArchExtension (StringRef Extension);
264+ LLVM_ABI std::optional<ExtensionInfo> parseArchExtension (StringRef Extension);
262265
263266// Parse a name as defined by the FMVInfo class in tablegen.
264- std::optional<FMVInfo> parseFMVExtension (StringRef Extension);
267+ LLVM_ABI std::optional<FMVInfo> parseFMVExtension (StringRef Extension);
265268
266269// Given the name of a CPU or alias, return the correponding CpuInfo.
267- std::optional<CpuInfo> parseCpu (StringRef Name);
270+ LLVM_ABI std::optional<CpuInfo> parseCpu (StringRef Name);
268271// Used by target parser tests
269- void fillValidCPUArchList (SmallVectorImpl<StringRef> &Values);
272+ LLVM_ABI void fillValidCPUArchList (SmallVectorImpl<StringRef> &Values);
270273
271- bool isX18ReservedByDefault (const Triple &TT);
274+ LLVM_ABI bool isX18ReservedByDefault (const Triple &TT);
272275
273276// For a given set of feature names, which can be either target-features, or
274277// fmv-features metadata, expand their dependencies and then return a bitmask
275278// corresponding to the entries of AArch64::FeatPriorities.
276- uint64_t getFMVPriority (ArrayRef<StringRef> Features);
279+ LLVM_ABI uint64_t getFMVPriority (ArrayRef<StringRef> Features);
277280
278281// For a given set of FMV feature names, expand their dependencies and then
279282// return a bitmask corresponding to the entries of AArch64::CPUFeatures.
280283// The values in CPUFeatures are not bitmasks themselves, they are sequential
281284// (0, 1, 2, 3, ...). The resulting bitmask is used at runtime to test whether
282285// a certain FMV feature is available on the host.
283- uint64_t getCpuSupportsMask (ArrayRef<StringRef> Features);
286+ LLVM_ABI uint64_t getCpuSupportsMask (ArrayRef<StringRef> Features);
284287
285- void PrintSupportedExtensions ();
288+ LLVM_ABI void PrintSupportedExtensions ();
286289
287- void printEnabledExtensions (const std::set<StringRef> &EnabledFeatureNames);
290+ LLVM_ABI void
291+ printEnabledExtensions (const std::set<StringRef> &EnabledFeatureNames);
288292
289293} // namespace AArch64
290294} // namespace llvm
0 commit comments