[llvm] r253470 - [ARM] Add +feature names to TargetParser extensions table
Bradley Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 18 08:32:12 PST 2015
Author: brasmi01
Date: Wed Nov 18 10:32:12 2015
New Revision: 253470
URL: http://llvm.org/viewvc/llvm-project?rev=253470&view=rev
Log:
[ARM] Add +feature names to TargetParser extensions table
Modified:
llvm/trunk/include/llvm/Support/ARMTargetParser.def
llvm/trunk/include/llvm/Support/TargetParser.h
llvm/trunk/lib/Support/TargetParser.cpp
Modified: llvm/trunk/include/llvm/Support/ARMTargetParser.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ARMTargetParser.def?rev=253470&r1=253469&r2=253470&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ARMTargetParser.def (original)
+++ llvm/trunk/include/llvm/Support/ARMTargetParser.def Wed Nov 18 10:32:12 2015
@@ -104,23 +104,24 @@ ARM_ARCH("armv7k", AK_ARMV7K, "7-K", "v7
#undef ARM_ARCH
#ifndef ARM_ARCH_EXT_NAME
-#define ARM_ARCH_EXT_NAME(NAME, ID)
+#define ARM_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE)
#endif
-ARM_ARCH_EXT_NAME("invalid", AEK_INVALID)
-ARM_ARCH_EXT_NAME("none", AEK_NONE)
-ARM_ARCH_EXT_NAME("crc", AEK_CRC)
-ARM_ARCH_EXT_NAME("crypto", AEK_CRYPTO)
-ARM_ARCH_EXT_NAME("fp", AEK_FP)
-ARM_ARCH_EXT_NAME("idiv", (AEK_HWDIVARM | AEK_HWDIV))
-ARM_ARCH_EXT_NAME("mp", AEK_MP)
-ARM_ARCH_EXT_NAME("simd", AEK_SIMD)
-ARM_ARCH_EXT_NAME("sec", AEK_SEC)
-ARM_ARCH_EXT_NAME("virt", AEK_VIRT)
-ARM_ARCH_EXT_NAME("os", AEK_OS)
-ARM_ARCH_EXT_NAME("iwmmxt", AEK_IWMMXT)
-ARM_ARCH_EXT_NAME("iwmmxt2", AEK_IWMMXT2)
-ARM_ARCH_EXT_NAME("maverick", AEK_MAVERICK)
-ARM_ARCH_EXT_NAME("xscale", AEK_XSCALE)
+// FIXME: This would be nicer were it tablegen
+ARM_ARCH_EXT_NAME("invalid", AEK_INVALID, nullptr, nullptr)
+ARM_ARCH_EXT_NAME("none", AEK_NONE, nullptr, nullptr)
+ARM_ARCH_EXT_NAME("crc", AEK_CRC, "+crc", "-crc")
+ARM_ARCH_EXT_NAME("crypto", AEK_CRYPTO, "+crypto","-crypto")
+ARM_ARCH_EXT_NAME("fp", AEK_FP, nullptr, nullptr)
+ARM_ARCH_EXT_NAME("idiv", (AEK_HWDIVARM | AEK_HWDIV), nullptr, nullptr)
+ARM_ARCH_EXT_NAME("mp", AEK_MP, nullptr, nullptr)
+ARM_ARCH_EXT_NAME("simd", AEK_SIMD, nullptr, nullptr)
+ARM_ARCH_EXT_NAME("sec", AEK_SEC, nullptr, nullptr)
+ARM_ARCH_EXT_NAME("virt", AEK_VIRT, nullptr, nullptr)
+ARM_ARCH_EXT_NAME("os", AEK_OS, nullptr, nullptr)
+ARM_ARCH_EXT_NAME("iwmmxt", AEK_IWMMXT, nullptr, nullptr)
+ARM_ARCH_EXT_NAME("iwmmxt2", AEK_IWMMXT2, nullptr, nullptr)
+ARM_ARCH_EXT_NAME("maverick", AEK_MAVERICK, nullptr, nullptr)
+ARM_ARCH_EXT_NAME("xscale", AEK_XSCALE, nullptr, nullptr)
#undef ARM_ARCH_EXT_NAME
#ifndef ARM_HW_DIV_NAME
Modified: llvm/trunk/include/llvm/Support/TargetParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TargetParser.h?rev=253470&r1=253469&r2=253470&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/TargetParser.h (original)
+++ llvm/trunk/include/llvm/Support/TargetParser.h Wed Nov 18 10:32:12 2015
@@ -119,6 +119,7 @@ unsigned getArchAttr(unsigned ArchKind);
StringRef getCPUAttr(unsigned ArchKind);
StringRef getSubArch(unsigned ArchKind);
StringRef getArchExtName(unsigned ArchExtKind);
+const char *getArchExtFeature(StringRef ArchExt);
StringRef getHWDivName(unsigned HWDivKind);
// Information by Name
Modified: llvm/trunk/lib/Support/TargetParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/TargetParser.cpp?rev=253470&r1=253469&r2=253470&view=diff
==============================================================================
--- llvm/trunk/lib/Support/TargetParser.cpp (original)
+++ llvm/trunk/lib/Support/TargetParser.cpp Wed Nov 18 10:32:12 2015
@@ -16,6 +16,7 @@
#include "llvm/Support/TargetParser.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/ADT/Twine.h"
#include <cctype>
using namespace llvm;
@@ -82,10 +83,14 @@ static const struct {
const char *NameCStr;
size_t NameLength;
unsigned ID;
+ const char *Feature;
+ const char *NegFeature;
StringRef getName() const { return StringRef(NameCStr, NameLength); }
+ StringRef getNegName() const { return (Twine("no") + getName()).str(); }
} ARCHExtNames[] = {
-#define ARM_ARCH_EXT_NAME(NAME, ID) { NAME, sizeof(NAME) - 1, ID },
+#define ARM_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE) \
+ { NAME, sizeof(NAME) - 1, ID, FEATURE, NEGFEATURE },
#include "llvm/Support/ARMTargetParser.def"
};
@@ -326,6 +331,17 @@ StringRef llvm::ARM::getArchExtName(unsi
return StringRef();
}
+const char *llvm::ARM::getArchExtFeature(StringRef ArchExt) {
+ for (const auto AE : ARCHExtNames) {
+ if (AE.Feature && ArchExt == AE.getName())
+ return AE.Feature;
+ else if (AE.NegFeature && ArchExt == AE.getNegName())
+ return AE.NegFeature;
+ }
+
+ return nullptr;
+}
+
StringRef llvm::ARM::getHWDivName(unsigned HWDivKind) {
for (const auto D : HWDivNames) {
if (HWDivKind == D.ID)
More information about the llvm-commits
mailing list