1 //===-- TargetParser - Parser for target features ---------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements a target parser to recognise hardware features such as
11 // FPU/CPU/ARCH names as well as specific support such as HDIV, etc.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_SUPPORT_TARGETPARSER_H
16 #define LLVM_SUPPORT_TARGETPARSER_H
18 // FIXME: vector is used because that's what clang uses for subtarget feature
19 // lists, but SmallVector would probably be better
25 // Target specific information into their own namespaces. These should be
26 // generated from TableGen because the information is already there, and there
27 // is where new information about targets will be added.
28 // FIXME: To TableGen this we need to make some table generated files available
29 // even if the back-end is not compiled with LLVM, plus we need to create a new
30 // back-end to TableGen to create these clean tables.
49 FK_CRYPTO_NEON_FP_ARMV8,
54 // An FPU name implies one of three levels of Neon support:
55 enum NeonSupportLevel {
56 NS_None = 0, ///< No Neon
58 NS_Crypto ///< Neon with Crypto
61 // An FPU name restricts the FPU in one of three ways:
63 FR_None = 0, ///< No restriction
64 FR_D16, ///< Only 16 D registers
65 FR_SP_D16 ///< Only single-precision instructions, with 16 D registers
93 // Non-standard Arch names.
108 // Arch extension modifiers for CPUs.
119 // Unsupported extensions.
137 // FIXME: BE8 vs. BE32?
153 // Target Parsers, one per architecture.
154 class ARMTargetParser {
155 static StringRef getFPUSynonym(StringRef FPU);
156 static StringRef getArchSynonym(StringRef Arch);
159 static StringRef getCanonicalArchName(StringRef Arch);
162 static const char * getFPUName(unsigned FPUKind);
163 static unsigned getFPUVersion(unsigned FPUKind);
164 static unsigned getFPUNeonSupportLevel(unsigned FPUKind);
165 static unsigned getFPURestriction(unsigned FPUKind);
166 // FIXME: This should be moved to TargetTuple once it exists
167 static bool getFPUFeatures(unsigned FPUKind,
168 std::vector<const char*> &Features);
169 static const char * getArchName(unsigned ArchKind);
170 static unsigned getArchAttr(unsigned ArchKind);
171 static const char * getCPUAttr(unsigned ArchKind);
172 static const char * getSubArch(unsigned ArchKind);
173 static const char * getArchExtName(unsigned ArchExtKind);
174 static const char * getDefaultCPU(StringRef Arch);
177 static unsigned parseFPU(StringRef FPU);
178 static unsigned parseArch(StringRef Arch);
179 static unsigned parseArchExt(StringRef ArchExt);
180 static unsigned parseCPUArch(StringRef CPU);
181 static unsigned parseArchISA(StringRef Arch);
182 static unsigned parseArchEndian(StringRef Arch);
183 static unsigned parseArchProfile(StringRef Arch);
184 static unsigned parseArchVersion(StringRef Arch);