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.
54 FK_CRYPTO_NEON_FP_ARMV8,
69 // An FPU name implies one of three levels of Neon support:
70 enum NeonSupportLevel {
71 NS_None = 0, ///< No Neon
73 NS_Crypto ///< Neon with Crypto
76 // An FPU name restricts the FPU in one of three ways:
78 FR_None = 0, ///< No restriction
79 FR_D16, ///< Only 16 D registers
80 FR_SP_D16 ///< Only single-precision instructions, with 16 D registers
108 // Non-standard Arch names.
124 // Arch extension modifiers for CPUs.
125 enum ArchExtKind : unsigned {
137 // Unsupported extensions.
139 AEK_IWMMXT = 0x10000000,
140 AEK_IWMMXT2 = 0x20000000,
141 AEK_MAVERICK = 0x40000000,
142 AEK_XSCALE = 0x80000000,
154 // FIXME: BE8 vs. BE32?
169 StringRef getCanonicalArchName(StringRef Arch);
172 const char * getFPUName(unsigned FPUKind);
173 unsigned getFPUVersion(unsigned FPUKind);
174 unsigned getFPUNeonSupportLevel(unsigned FPUKind);
175 unsigned getFPURestriction(unsigned FPUKind);
176 unsigned getDefaultFPU(StringRef CPU);
177 // FIXME: This should be moved to TargetTuple once it exists
178 bool getFPUFeatures(unsigned FPUKind, std::vector<const char *> &Features);
179 bool getHWDivFeatures(unsigned HWDivKind,
180 std::vector<const char *> &Features);
181 const char *getArchName(unsigned ArchKind);
182 unsigned getArchAttr(unsigned ArchKind);
183 const char *getCPUAttr(unsigned ArchKind);
184 const char *getSubArch(unsigned ArchKind);
185 const char *getArchExtName(unsigned ArchExtKind);
186 const char *getHWDivName(unsigned HWDivKind);
187 const char *getDefaultCPU(StringRef Arch);
190 unsigned parseHWDiv(StringRef HWDiv);
191 unsigned parseFPU(StringRef FPU);
192 unsigned parseArch(StringRef Arch);
193 unsigned parseArchExt(StringRef ArchExt);
194 unsigned parseCPUArch(StringRef CPU);
195 unsigned parseArchISA(StringRef Arch);
196 unsigned parseArchEndian(StringRef Arch);
197 unsigned parseArchProfile(StringRef Arch);
198 unsigned parseArchVersion(StringRef Arch);