Change TargetParser enum names to avoid macro conflicts (llvm)
[oota-llvm.git] / include / llvm / Support / TargetParser.h
1 //===-- TargetParser - Parser for target features ---------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
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.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_SUPPORT_TARGETPARSER_H
16 #define LLVM_SUPPORT_TARGETPARSER_H
17
18 namespace llvm {
19   class StringRef;
20
21 // Target specific information into their own namespaces. These should be
22 // generated from TableGen because the information is already there, and there
23 // is where new information about targets will be added.
24 // FIXME: To TableGen this we need to make some table generated files available
25 // even if the back-end is not compiled with LLVM, plus we need to create a new
26 // back-end to TableGen to create these clean tables.
27 namespace ARM {
28   // FPU names.
29   enum FPUKind {
30     FK_INVALID = 0,
31     FK_VFP,
32     FK_VFPV2,
33     FK_VFPV3,
34     FK_VFPV3_D16,
35     FK_VFPV4,
36     FK_VFPV4_D16,
37     FK_FPV5_D16,
38     FK_FP_ARMV8,
39     FK_NEON,
40     FK_NEON_VFPV4,
41     FK_NEON_FP_ARMV8,
42     FK_CRYPTO_NEON_FP_ARMV8,
43     FK_SOFTVFP,
44     FK_LAST
45   };
46
47   // Arch names.
48   enum ArchKind {
49     AK_INVALID = 0,
50     AK_ARMV2,
51     AK_ARMV2A,
52     AK_ARMV3,
53     AK_ARMV3M,
54     AK_ARMV4,
55     AK_ARMV4T,
56     AK_ARMV5,
57     AK_ARMV5T,
58     AK_ARMV5TE,
59     AK_ARMV6,
60     AK_ARMV6J,
61     AK_ARMV6K,
62     AK_ARMV6T2,
63     AK_ARMV6Z,
64     AK_ARMV6ZK,
65     AK_ARMV6M,
66     AK_ARMV7,
67     AK_ARMV7A,
68     AK_ARMV7R,
69     AK_ARMV7M,
70     AK_ARMV8A,
71     AK_ARMV8_1A,
72     AK_IWMMXT,
73     AK_IWMMXT2,
74     AK_LAST
75   };
76
77   // Arch extension modifiers for CPUs.
78   enum ArchExtKind {
79     AEK_INVALID = 0,
80     AEK_CRC,
81     AEK_CRYPTO,
82     AEK_FP,
83     AEK_HWDIV,
84     AEK_MP,
85     AEK_SEC,
86     AEK_VIRT,
87     AEK_LAST
88   };
89
90 } // namespace ARM
91
92 // Target Parsers, one per architecture.
93 class ARMTargetParser {
94   static StringRef getFPUSynonym(StringRef FPU);
95   static StringRef getArchSynonym(StringRef Arch);
96
97 public:
98   // Information by ID
99   static const char * getFPUName(unsigned ID);
100   static const char * getArchName(unsigned ID);
101   static unsigned getArchDefaultCPUArch(unsigned ID);
102   static const char * getArchDefaultCPUName(unsigned ID);
103   static const char * getArchExtName(unsigned ID);
104
105   // Parser
106   static unsigned parseFPU(StringRef FPU);
107   static unsigned parseArch(StringRef Arch);
108   static unsigned parseArchExt(StringRef ArchExt);
109 };
110
111 } // namespace llvm
112
113 #endif