9
9
#ifndef LLVM_TARGETPARSER_TRIPLE_H
10
10
#define LLVM_TARGETPARSER_TRIPLE_H
11
11
12
+ #include " llvm/Support/Compiler.h"
12
13
#include " llvm/ADT/Twine.h"
13
14
#include " llvm/Support/VersionTuple.h"
14
15
@@ -348,9 +349,9 @@ class Triple {
348
349
// / triple fields unknown.
349
350
Triple () = default ;
350
351
351
- explicit Triple (const Twine &Str);
352
- Triple (const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
353
- Triple (const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
352
+ LLVM_ABI explicit Triple (const Twine &Str);
353
+ LLVM_ABI Triple (const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr);
354
+ LLVM_ABI Triple (const Twine &ArchStr, const Twine &VendorStr, const Twine &OSStr,
354
355
const Twine &EnvironmentStr);
355
356
356
357
bool operator ==(const Triple &Other) const {
@@ -381,7 +382,7 @@ class Triple {
381
382
// / reasonably be done). In particular, it handles the common case in which
382
383
// / otherwise valid components are in the wrong order. \p Form is used to
383
384
// / specify the output canonical form.
384
- static std::string normalize (StringRef Str,
385
+ LLVM_ABI static std::string normalize (StringRef Str,
385
386
CanonicalForm Form = CanonicalForm::ANY);
386
387
387
388
// / Return the normalized form of this triple's string.
@@ -417,7 +418,7 @@ class Triple {
417
418
// / triple, if present.
418
419
// /
419
420
// / For example, "fooos1.2.3" would return (1, 2, 3).
420
- VersionTuple getEnvironmentVersion () const ;
421
+ LLVM_ABI VersionTuple getEnvironmentVersion () const ;
421
422
422
423
// / Get the object format for this triple.
423
424
ObjectFormatType getObjectFormat () const { return ObjectFormat; }
@@ -426,7 +427,7 @@ class Triple {
426
427
// / present.
427
428
// /
428
429
// / For example, "fooos1.2.3" would return (1, 2, 3).
429
- VersionTuple getOSVersion () const ;
430
+ LLVM_ABI VersionTuple getOSVersion () const ;
430
431
431
432
// / Return just the major version number, this is specialized because it is a
432
433
// / common query.
@@ -436,26 +437,26 @@ class Triple {
436
437
// / "darwin" versions to the corresponding OS X versions. This may also be
437
438
// / called with IOS triples but the OS X version number is just set to a
438
439
// / constant 10.4.0 in that case. Returns true if successful.
439
- bool getMacOSXVersion (VersionTuple &Version) const ;
440
+ LLVM_ABI bool getMacOSXVersion (VersionTuple &Version) const ;
440
441
441
442
// / Parse the version number as with getOSVersion. This should only be called
442
443
// / with IOS or generic triples.
443
- VersionTuple getiOSVersion () const ;
444
+ LLVM_ABI VersionTuple getiOSVersion () const ;
444
445
445
446
// / Parse the version number as with getOSVersion. This should only be called
446
447
// / with WatchOS or generic triples.
447
- VersionTuple getWatchOSVersion () const ;
448
+ LLVM_ABI VersionTuple getWatchOSVersion () const ;
448
449
449
450
// / Parse the version number as with getOSVersion.
450
- VersionTuple getDriverKitVersion () const ;
451
+ LLVM_ABI VersionTuple getDriverKitVersion () const ;
451
452
452
453
// / Parse the Vulkan version number from the OSVersion and SPIR-V version
453
454
// / (SubArch). This should only be called with Vulkan SPIR-V triples.
454
- VersionTuple getVulkanVersion () const ;
455
+ LLVM_ABI VersionTuple getVulkanVersion () const ;
455
456
456
457
// / Parse the DXIL version number from the OSVersion and DXIL version
457
458
// / (SubArch). This should only be called with DXIL triples.
458
- VersionTuple getDXILVersion () const ;
459
+ LLVM_ABI VersionTuple getDXILVersion () const ;
459
460
460
461
// / @}
461
462
// / @name Direct Component Access
@@ -469,42 +470,42 @@ class Triple {
469
470
bool empty () const { return Data.empty (); }
470
471
471
472
// / Get the architecture (first) component of the triple.
472
- StringRef getArchName () const ;
473
+ LLVM_ABI StringRef getArchName () const ;
473
474
474
475
// / Get the vendor (second) component of the triple.
475
- StringRef getVendorName () const ;
476
+ LLVM_ABI StringRef getVendorName () const ;
476
477
477
478
// / Get the operating system (third) component of the triple.
478
- StringRef getOSName () const ;
479
+ LLVM_ABI StringRef getOSName () const ;
479
480
480
481
// / Get the optional environment (fourth) component of the triple, or "" if
481
482
// / empty.
482
- StringRef getEnvironmentName () const ;
483
+ LLVM_ABI StringRef getEnvironmentName () const ;
483
484
484
485
// / Get the operating system and optional environment components as a single
485
486
// / string (separated by a '-' if the environment component is present).
486
- StringRef getOSAndEnvironmentName () const ;
487
+ LLVM_ABI StringRef getOSAndEnvironmentName () const ;
487
488
488
489
// / Get the version component of the environment component as a single
489
490
// / string (the version after the environment).
490
491
// /
491
492
// / For example, "fooos1.2.3" would return "1.2.3".
492
- StringRef getEnvironmentVersionString () const ;
493
+ LLVM_ABI StringRef getEnvironmentVersionString () const ;
493
494
494
495
// / @}
495
496
// / @name Convenience Predicates
496
497
// / @{
497
498
498
499
// / Returns the pointer width of this architecture.
499
- static unsigned getArchPointerBitWidth (llvm::Triple::ArchType Arch);
500
+ LLVM_ABI static unsigned getArchPointerBitWidth (llvm::Triple::ArchType Arch);
500
501
501
502
// / Returns the pointer width of this architecture.
502
503
unsigned getArchPointerBitWidth () const {
503
504
return getArchPointerBitWidth (getArch ());
504
505
}
505
506
506
507
// / Returns the trampoline size in bytes for this configuration.
507
- unsigned getTrampolineSize () const ;
508
+ LLVM_ABI unsigned getTrampolineSize () const ;
508
509
509
510
// / Test whether the architecture is 64-bit
510
511
// /
@@ -513,17 +514,17 @@ class Triple {
513
514
// / 16-bit. The inner details of pointer width for particular architectures
514
515
// / is not summed up in the triple, and so only a coarse grained predicate
515
516
// / system is provided.
516
- bool isArch64Bit () const ;
517
+ LLVM_ABI bool isArch64Bit () const ;
517
518
518
519
// / Test whether the architecture is 32-bit
519
520
// /
520
521
// / Note that this tests for 32-bit pointer width, and nothing else.
521
- bool isArch32Bit () const ;
522
+ LLVM_ABI bool isArch32Bit () const ;
522
523
523
524
// / Test whether the architecture is 16-bit
524
525
// /
525
526
// / Note that this tests for 16-bit pointer width, and nothing else.
526
- bool isArch16Bit () const ;
527
+ LLVM_ABI bool isArch16Bit () const ;
527
528
528
529
// / Helper function for doing comparisons against version numbers included in
529
530
// / the target triple.
@@ -544,7 +545,7 @@ class Triple {
544
545
545
546
// / Comparison function for checking OS X version compatibility, which handles
546
547
// / supporting skewed version numbering schemes used by the "darwin" triples.
547
- bool isMacOSXVersionLT (unsigned Major, unsigned Minor = 0 ,
548
+ LLVM_ABI bool isMacOSXVersionLT (unsigned Major, unsigned Minor = 0 ,
548
549
unsigned Micro = 0 ) const ;
549
550
550
551
// / Is this a Mac OS X triple. For legacy reasons, we support both "darwin"
@@ -1143,38 +1144,38 @@ class Triple {
1143
1144
// / @{
1144
1145
1145
1146
// / Set the architecture (first) component of the triple to a known type.
1146
- void setArch (ArchType Kind, SubArchType SubArch = NoSubArch);
1147
+ LLVM_ABI void setArch (ArchType Kind, SubArchType SubArch = NoSubArch);
1147
1148
1148
1149
// / Set the vendor (second) component of the triple to a known type.
1149
- void setVendor (VendorType Kind);
1150
+ LLVM_ABI void setVendor (VendorType Kind);
1150
1151
1151
1152
// / Set the operating system (third) component of the triple to a known type.
1152
- void setOS (OSType Kind);
1153
+ LLVM_ABI void setOS (OSType Kind);
1153
1154
1154
1155
// / Set the environment (fourth) component of the triple to a known type.
1155
- void setEnvironment (EnvironmentType Kind);
1156
+ LLVM_ABI void setEnvironment (EnvironmentType Kind);
1156
1157
1157
1158
// / Set the object file format.
1158
- void setObjectFormat (ObjectFormatType Kind);
1159
+ LLVM_ABI void setObjectFormat (ObjectFormatType Kind);
1159
1160
1160
1161
// / Set all components to the new triple \p Str.
1161
- void setTriple (const Twine &Str);
1162
+ LLVM_ABI void setTriple (const Twine &Str);
1162
1163
1163
1164
// / Set the architecture (first) component of the triple by name.
1164
- void setArchName (StringRef Str);
1165
+ LLVM_ABI void setArchName (StringRef Str);
1165
1166
1166
1167
// / Set the vendor (second) component of the triple by name.
1167
- void setVendorName (StringRef Str);
1168
+ LLVM_ABI void setVendorName (StringRef Str);
1168
1169
1169
1170
// / Set the operating system (third) component of the triple by name.
1170
- void setOSName (StringRef Str);
1171
+ LLVM_ABI void setOSName (StringRef Str);
1171
1172
1172
1173
// / Set the optional environment (fourth) component of the triple by name.
1173
- void setEnvironmentName (StringRef Str);
1174
+ LLVM_ABI void setEnvironmentName (StringRef Str);
1174
1175
1175
1176
// / Set the operating system and optional environment components with a single
1176
1177
// / string.
1177
- void setOSAndEnvironmentName (StringRef Str);
1178
+ LLVM_ABI void setOSAndEnvironmentName (StringRef Str);
1178
1179
1179
1180
// / @}
1180
1181
// / @name Helpers to build variants of a particular triple.
@@ -1186,92 +1187,92 @@ class Triple {
1186
1187
// /
1187
1188
// / \returns A new triple with a 32-bit architecture or an unknown
1188
1189
// / architecture if no such variant can be found.
1189
- llvm::Triple get32BitArchVariant () const ;
1190
+ LLVM_ABI llvm::Triple get32BitArchVariant () const ;
1190
1191
1191
1192
// / Form a triple with a 64-bit variant of the current architecture.
1192
1193
// /
1193
1194
// / This can be used to move across "families" of architectures where useful.
1194
1195
// /
1195
1196
// / \returns A new triple with a 64-bit architecture or an unknown
1196
1197
// / architecture if no such variant can be found.
1197
- llvm::Triple get64BitArchVariant () const ;
1198
+ LLVM_ABI llvm::Triple get64BitArchVariant () const ;
1198
1199
1199
1200
// / Form a triple with a big endian variant of the current architecture.
1200
1201
// /
1201
1202
// / This can be used to move across "families" of architectures where useful.
1202
1203
// /
1203
1204
// / \returns A new triple with a big endian architecture or an unknown
1204
1205
// / architecture if no such variant can be found.
1205
- llvm::Triple getBigEndianArchVariant () const ;
1206
+ LLVM_ABI llvm::Triple getBigEndianArchVariant () const ;
1206
1207
1207
1208
// / Form a triple with a little endian variant of the current architecture.
1208
1209
// /
1209
1210
// / This can be used to move across "families" of architectures where useful.
1210
1211
// /
1211
1212
// / \returns A new triple with a little endian architecture or an unknown
1212
1213
// / architecture if no such variant can be found.
1213
- llvm::Triple getLittleEndianArchVariant () const ;
1214
+ LLVM_ABI llvm::Triple getLittleEndianArchVariant () const ;
1214
1215
1215
1216
// / Tests whether the target triple is little endian.
1216
1217
// /
1217
1218
// / \returns true if the triple is little endian, false otherwise.
1218
- bool isLittleEndian () const ;
1219
+ LLVM_ABI bool isLittleEndian () const ;
1219
1220
1220
1221
// / Test whether target triples are compatible.
1221
- bool isCompatibleWith (const Triple &Other) const ;
1222
+ LLVM_ABI bool isCompatibleWith (const Triple &Other) const ;
1222
1223
1223
1224
// / Test whether the target triple is for a GPU.
1224
1225
bool isGPU () const { return isSPIRV () || isNVPTX () || isAMDGPU (); }
1225
1226
1226
1227
// / Merge target triples.
1227
- std::string merge (const Triple &Other) const ;
1228
+ LLVM_ABI std::string merge (const Triple &Other) const ;
1228
1229
1229
1230
// / Some platforms have different minimum supported OS versions that
1230
1231
// / varies by the architecture specified in the triple. This function
1231
1232
// / returns the minimum supported OS version for this triple if one an exists,
1232
1233
// / or an invalid version tuple if this triple doesn't have one.
1233
- VersionTuple getMinimumSupportedOSVersion () const ;
1234
+ LLVM_ABI VersionTuple getMinimumSupportedOSVersion () const ;
1234
1235
1235
1236
// / @}
1236
1237
// / @name Static helpers for IDs.
1237
1238
// / @{
1238
1239
1239
1240
// / Get the canonical name for the \p Kind architecture.
1240
- static StringRef getArchTypeName (ArchType Kind);
1241
+ LLVM_ABI static StringRef getArchTypeName (ArchType Kind);
1241
1242
1242
1243
// / Get the architecture name based on \p Kind and \p SubArch.
1243
- static StringRef getArchName (ArchType Kind, SubArchType SubArch = NoSubArch);
1244
+ LLVM_ABI static StringRef getArchName (ArchType Kind, SubArchType SubArch = NoSubArch);
1244
1245
1245
1246
// / Get the "prefix" canonical name for the \p Kind architecture. This is the
1246
1247
// / prefix used by the architecture specific builtins, and is suitable for
1247
1248
// / passing to \see Intrinsic::getIntrinsicForClangBuiltin().
1248
1249
// /
1249
1250
// / \return - The architecture prefix, or 0 if none is defined.
1250
- static StringRef getArchTypePrefix (ArchType Kind);
1251
+ LLVM_ABI static StringRef getArchTypePrefix (ArchType Kind);
1251
1252
1252
1253
// / Get the canonical name for the \p Kind vendor.
1253
- static StringRef getVendorTypeName (VendorType Kind);
1254
+ LLVM_ABI static StringRef getVendorTypeName (VendorType Kind);
1254
1255
1255
1256
// / Get the canonical name for the \p Kind operating system.
1256
- static StringRef getOSTypeName (OSType Kind);
1257
+ LLVM_ABI static StringRef getOSTypeName (OSType Kind);
1257
1258
1258
1259
// / Get the canonical name for the \p Kind environment.
1259
- static StringRef getEnvironmentTypeName (EnvironmentType Kind);
1260
+ LLVM_ABI static StringRef getEnvironmentTypeName (EnvironmentType Kind);
1260
1261
1261
1262
// / Get the name for the \p Object format.
1262
- static StringRef getObjectFormatTypeName (ObjectFormatType ObjectFormat);
1263
+ LLVM_ABI static StringRef getObjectFormatTypeName (ObjectFormatType ObjectFormat);
1263
1264
1264
1265
// / @}
1265
1266
// / @name Static helpers for converting alternate architecture names.
1266
1267
// / @{
1267
1268
1268
1269
// / The canonical type for the given LLVM architecture name (e.g., "x86").
1269
- static ArchType getArchTypeForLLVMName (StringRef Str);
1270
+ LLVM_ABI static ArchType getArchTypeForLLVMName (StringRef Str);
1270
1271
1271
1272
// / @}
1272
1273
1273
1274
// / Returns a canonicalized OS version number for the specified OS.
1274
- static VersionTuple getCanonicalVersionForOS (OSType OSKind,
1275
+ LLVM_ABI static VersionTuple getCanonicalVersionForOS (OSType OSKind,
1275
1276
const VersionTuple &Version);
1276
1277
};
1277
1278
0 commit comments