Skip to content

Commit 230d298

Browse files
committed
[ARMTargetParser] Move IAS arch ext parser. NFC
The plan was to move the whole table into the already existing ArchExtNames but some fields depend on a table-generated file, and we don't yet have this feature in the generic lib/Support side. Once the minimum target-specific table-generated files are available in a generic fashion to these libraries, we'll have to keep it in the ASM parser. llvm-svn: 238651
1 parent 11e6f8f commit 230d298

File tree

3 files changed

+36
-21
lines changed

3 files changed

+36
-21
lines changed

llvm/include/llvm/Support/TargetParser.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,15 @@ namespace ARM {
9292
AEK_FP,
9393
AEK_HWDIV,
9494
AEK_MP,
95+
AEK_SIMD,
9596
AEK_SEC,
9697
AEK_VIRT,
98+
// Unsupported extensions.
99+
AEK_OS,
100+
AEK_IWMMXT,
101+
AEK_IWMMXT2,
102+
AEK_MAVERICK,
103+
AEK_XSCALE,
97104
AEK_LAST
98105
};
99106

llvm/lib/Support/TargetParser.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,14 @@ struct {
106106
{ "fp", ARM::AEK_FP },
107107
{ "idiv", ARM::AEK_HWDIV },
108108
{ "mp", ARM::AEK_MP },
109+
{ "simd", ARM::AEK_SIMD },
109110
{ "sec", ARM::AEK_SEC },
110-
{ "virt", ARM::AEK_VIRT }
111+
{ "virt", ARM::AEK_VIRT },
112+
{ "os", ARM::AEK_OS },
113+
{ "iwmmxt", ARM::AEK_IWMMXT },
114+
{ "iwmmxt2", ARM::AEK_IWMMXT2 },
115+
{ "maverick", ARM::AEK_MAVERICK },
116+
{ "xscale", ARM::AEK_XSCALE }
111117
};
112118
// List of CPU names and their arches.
113119
// The same CPU can have multiple arches and can be default on multiple arches.

llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9982,33 +9982,32 @@ extern "C" void LLVMInitializeARMAsmParser() {
99829982
#define GET_MATCHER_IMPLEMENTATION
99839983
#include "ARMGenAsmMatcher.inc"
99849984

9985+
// FIXME: This structure should be moved inside ARMTargetParser
9986+
// when we start to table-generate them, and we can use the ARM
9987+
// flags below, that were generated by table-gen.
99859988
static const struct {
9986-
const char *Name;
9989+
const ARM::ArchExtKind Kind;
99879990
const unsigned ArchCheck;
99889991
const FeatureBitset Features;
99899992
} Extensions[] = {
9990-
{ "crc", Feature_HasV8, {ARM::FeatureCRC} },
9991-
{ "crypto", Feature_HasV8,
9993+
{ ARM::AEK_CRC, Feature_HasV8, {ARM::FeatureCRC} },
9994+
{ ARM::AEK_CRYPTO, Feature_HasV8,
99929995
{ARM::FeatureCrypto, ARM::FeatureNEON, ARM::FeatureFPARMv8} },
9993-
{ "fp", Feature_HasV8, {ARM::FeatureFPARMv8} },
9994-
{ "idiv", Feature_HasV7 | Feature_IsNotMClass,
9996+
{ ARM::AEK_FP, Feature_HasV8, {ARM::FeatureFPARMv8} },
9997+
{ ARM::AEK_HWDIV, Feature_HasV7 | Feature_IsNotMClass,
99959998
{ARM::FeatureHWDiv, ARM::FeatureHWDivARM} },
9996-
// FIXME: iWMMXT not supported
9997-
{ "iwmmxt", Feature_None, {} },
9998-
// FIXME: iWMMXT2 not supported
9999-
{ "iwmmxt2", Feature_None, {} },
10000-
// FIXME: Maverick not supported
10001-
{ "maverick", Feature_None, {} },
10002-
{ "mp", Feature_HasV7 | Feature_IsNotMClass, {ARM::FeatureMP} },
10003-
// FIXME: ARMv6-m OS Extensions feature not checked
10004-
{ "os", Feature_None, {} },
9999+
{ ARM::AEK_MP, Feature_HasV7 | Feature_IsNotMClass, {ARM::FeatureMP} },
10000+
{ ARM::AEK_SIMD, Feature_HasV8, {ARM::FeatureNEON, ARM::FeatureFPARMv8} },
1000510001
// FIXME: Also available in ARMv6-K
10006-
{ "sec", Feature_HasV7, {ARM::FeatureTrustZone} },
10007-
{ "simd", Feature_HasV8, {ARM::FeatureNEON, ARM::FeatureFPARMv8} },
10002+
{ ARM::AEK_SEC, Feature_HasV7, {ARM::FeatureTrustZone} },
1000810003
// FIXME: Only available in A-class, isel not predicated
10009-
{ "virt", Feature_HasV7, {ARM::FeatureVirtualization} },
10010-
// FIXME: xscale not supported
10011-
{ "xscale", Feature_None, {} },
10004+
{ ARM::AEK_VIRT, Feature_HasV7, {ARM::FeatureVirtualization} },
10005+
// FIXME: Unsupported extensions.
10006+
{ ARM::AEK_OS, Feature_None, {} },
10007+
{ ARM::AEK_IWMMXT, Feature_None, {} },
10008+
{ ARM::AEK_IWMMXT2, Feature_None, {} },
10009+
{ ARM::AEK_MAVERICK, Feature_None, {} },
10010+
{ ARM::AEK_XSCALE, Feature_None, {} },
1001210011
};
1001310012

1001410013
/// parseDirectiveArchExtension
@@ -10031,9 +10030,12 @@ bool ARMAsmParser::parseDirectiveArchExtension(SMLoc L) {
1003110030
EnableFeature = false;
1003210031
Name = Name.substr(2);
1003310032
}
10033+
unsigned FeatureKind = ARMTargetParser::parseArchExt(Name);
10034+
if (FeatureKind == ARM::AEK_INVALID)
10035+
Error(ExtLoc, "unknown architectural extension: " + Name);
1003410036

1003510037
for (const auto &Extension : Extensions) {
10036-
if (Extension.Name != Name)
10038+
if (Extension.Kind != FeatureKind)
1003710039
continue;
1003810040

1003910041
if (Extension.Features.none())

0 commit comments

Comments
 (0)