mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-09 13:41:35 +00:00
[ARM] Add +feature names to TargetParser extensions table
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253470 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3a7d5cfa3b
commit
fbbc259e37
@ -104,23 +104,24 @@ ARM_ARCH("armv7k", AK_ARMV7K, "7-K", "v7k", ARMBuildAttrs::CPUArch::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
|
||||
|
@ -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
|
||||
|
@ -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(unsigned ArchExtKind) {
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user