19
19
#include " llvm/ADT/StringExtras.h"
20
20
#include " llvm/ADT/StringMap.h"
21
21
#include " llvm/ADT/StringRef.h"
22
+ #include " llvm/Support/Compiler.h"
22
23
#include " llvm/Support/VersionTuple.h"
23
24
#include " llvm/Support/raw_ostream.h"
24
25
#include " llvm/TargetParser/SubtargetFeature.h"
@@ -79,7 +80,7 @@ struct FMVInfo {
79
80
: Name(Name), FeatureBit(FeatureBit), PriorityBit(PriorityBit), ID(ID) {};
80
81
};
81
82
82
- const std::vector<FMVInfo> &getFMVInfo ();
83
+ LLVM_ABI const std::vector<FMVInfo> &getFMVInfo ();
83
84
84
85
// Represents a dependency between two architecture extensions. Later is the
85
86
// feature which was added to the architecture after Earlier, and expands the
@@ -146,7 +147,7 @@ struct ArchInfo {
146
147
StringRef getSubArch () const { return ArchFeature.substr (1 ); }
147
148
148
149
// Search for ArchInfo by SubArch name
149
- static std::optional<ArchInfo> findBySubArch (StringRef SubArch);
150
+ LLVM_ABI static std::optional<ArchInfo> findBySubArch (StringRef SubArch);
150
151
};
151
152
152
153
#define EMIT_ARCHITECTURES
@@ -182,34 +183,36 @@ struct ExtensionSet {
182
183
// Enable the given architecture extension, and any other extensions it
183
184
// depends on. Does not change the base architecture, or follow dependencies
184
185
// between features which are only related by required arcitecture versions.
185
- void enable (ArchExtKind E);
186
+ LLVM_ABI void enable (ArchExtKind E);
186
187
187
188
// Disable the given architecture extension, and any other extensions which
188
189
// depend on it. Does not change the base architecture, or follow
189
190
// dependencies between features which are only related by required
190
191
// arcitecture versions.
191
- void disable (ArchExtKind E);
192
+ LLVM_ABI void disable (ArchExtKind E);
192
193
193
194
// Add default extensions for the given CPU. Records the base architecture,
194
195
// to later resolve dependencies which depend on it.
195
- void addCPUDefaults (const CpuInfo &CPU);
196
+ LLVM_ABI void addCPUDefaults (const CpuInfo &CPU);
196
197
197
198
// Add default extensions for the given architecture version. Records the
198
199
// base architecture, to later resolve dependencies which depend on it.
199
- void addArchDefaults (const ArchInfo &Arch);
200
+ LLVM_ABI void addArchDefaults (const ArchInfo &Arch);
200
201
201
202
// Add or remove a feature based on a modifier string. The string must be of
202
203
// the form "<name>" to enable a feature or "no<name>" to disable it. This
203
204
// will also enable or disable any features as required by the dependencies
204
205
// between them.
205
- bool parseModifier (StringRef Modifier, const bool AllowNoDashForm = false );
206
+ LLVM_ABI bool parseModifier (StringRef Modifier,
207
+ const bool AllowNoDashForm = false );
206
208
207
209
// Constructs a new ExtensionSet by toggling the corresponding bits for every
208
210
// feature in the \p Features list without expanding their dependencies. Used
209
211
// for reconstructing an ExtensionSet from the output of toLLVMFeatures().
210
212
// 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);
213
216
214
217
// Convert the set of enabled extension to an LLVM feature list, appending
215
218
// them to Features.
@@ -227,7 +230,7 @@ struct ExtensionSet {
227
230
}
228
231
}
229
232
230
- void dump () const ;
233
+ LLVM_ABI void dump () const ;
231
234
};
232
235
233
236
// Name alias.
@@ -239,52 +242,53 @@ struct Alias {
239
242
#define EMIT_CPU_ALIAS
240
243
#include " llvm/TargetParser/AArch64TargetParserDef.inc"
241
244
242
- const ExtensionInfo &getExtensionByID (ArchExtKind(ExtID));
245
+ LLVM_ABI const ExtensionInfo &getExtensionByID (ArchExtKind(ExtID));
243
246
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);
247
249
248
- StringRef getArchExtFeature (StringRef ArchExt);
249
- StringRef resolveCPUAlias (StringRef CPU);
250
+ LLVM_ABI StringRef getArchExtFeature (StringRef ArchExt);
251
+ LLVM_ABI StringRef resolveCPUAlias (StringRef CPU);
250
252
251
253
// Information by Name
252
- const ArchInfo *getArchForCpu (StringRef CPU);
254
+ LLVM_ABI const ArchInfo *getArchForCpu (StringRef CPU);
253
255
254
256
// Parser
255
- const ArchInfo *parseArch (StringRef Arch);
257
+ LLVM_ABI const ArchInfo *parseArch (StringRef Arch);
256
258
257
259
// 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);
259
262
260
263
// 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);
262
265
263
266
// 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);
265
268
266
269
// 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);
268
271
// Used by target parser tests
269
- void fillValidCPUArchList (SmallVectorImpl<StringRef> &Values);
272
+ LLVM_ABI void fillValidCPUArchList (SmallVectorImpl<StringRef> &Values);
270
273
271
- bool isX18ReservedByDefault (const Triple &TT);
274
+ LLVM_ABI bool isX18ReservedByDefault (const Triple &TT);
272
275
273
276
// For a given set of feature names, which can be either target-features, or
274
277
// fmv-features metadata, expand their dependencies and then return a bitmask
275
278
// corresponding to the entries of AArch64::FeatPriorities.
276
- uint64_t getFMVPriority (ArrayRef<StringRef> Features);
279
+ LLVM_ABI uint64_t getFMVPriority (ArrayRef<StringRef> Features);
277
280
278
281
// For a given set of FMV feature names, expand their dependencies and then
279
282
// return a bitmask corresponding to the entries of AArch64::CPUFeatures.
280
283
// The values in CPUFeatures are not bitmasks themselves, they are sequential
281
284
// (0, 1, 2, 3, ...). The resulting bitmask is used at runtime to test whether
282
285
// 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);
284
287
285
- void PrintSupportedExtensions ();
288
+ LLVM_ABI void PrintSupportedExtensions ();
286
289
287
- void printEnabledExtensions (const std::set<StringRef> &EnabledFeatureNames);
290
+ LLVM_ABI void
291
+ printEnabledExtensions (const std::set<StringRef> &EnabledFeatureNames);
288
292
289
293
} // namespace AArch64
290
294
} // namespace llvm
0 commit comments