LLVM  8.0.1
TargetParser.h
Go to the documentation of this file.
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 // FIXME: vector is used because that's what clang uses for subtarget feature
19 // lists, but SmallVector would probably be better
20 #include "llvm/ADT/Triple.h"
23 #include <vector>
24 
25 namespace llvm {
26 class StringRef;
27 
28 // Target specific information in their own namespaces.
29 // (ARM/AArch64 are declared in ARM/AArch64TargetParser.h)
30 // These should be generated from TableGen because the information is already
31 // there, and there is where new information about targets will be added.
32 // FIXME: To TableGen this we need to make some table generated files available
33 // even if the back-end is not compiled with LLVM, plus we need to create a new
34 // back-end to TableGen to create these clean tables.
35 namespace X86 {
36 
37 // This should be kept in sync with libcc/compiler-rt as its included by clang
38 // as a proxy for what's in libgcc/compiler-rt.
39 enum ProcessorVendors : unsigned {
41 #define X86_VENDOR(ENUM, STRING) \
42  ENUM,
43 #include "llvm/Support/X86TargetParser.def"
45 };
46 
47 // This should be kept in sync with libcc/compiler-rt as its included by clang
48 // as a proxy for what's in libgcc/compiler-rt.
49 enum ProcessorTypes : unsigned {
51 #define X86_CPU_TYPE(ARCHNAME, ENUM) \
52  ENUM,
53 #include "llvm/Support/X86TargetParser.def"
55 };
56 
57 // This should be kept in sync with libcc/compiler-rt as its included by clang
58 // as a proxy for what's in libgcc/compiler-rt.
59 enum ProcessorSubtypes : unsigned {
61 #define X86_CPU_SUBTYPE(ARCHNAME, ENUM) \
62  ENUM,
63 #include "llvm/Support/X86TargetParser.def"
65 };
66 
67 // This should be kept in sync with libcc/compiler-rt as it should be used
68 // by clang as a proxy for what's in libgcc/compiler-rt.
70 #define X86_FEATURE(VAL, ENUM) \
71  ENUM = VAL,
72 #include "llvm/Support/X86TargetParser.def"
73 
74 };
75 
76 } // namespace X86
77 
78 namespace AMDGPU {
79 
80 /// GPU kinds supported by the AMDGPU target.
81 enum GPUKind : uint32_t {
82  // Not specified processor.
83  GK_NONE = 0,
84 
85  // R600-based processors.
86  GK_R600 = 1,
87  GK_R630 = 2,
88  GK_RS880 = 3,
89  GK_RV670 = 4,
90  GK_RV710 = 5,
91  GK_RV730 = 6,
92  GK_RV770 = 7,
93  GK_CEDAR = 8,
95  GK_JUNIPER = 10,
96  GK_REDWOOD = 11,
97  GK_SUMO = 12,
98  GK_BARTS = 13,
99  GK_CAICOS = 14,
100  GK_CAYMAN = 15,
101  GK_TURKS = 16,
102 
105 
106  // AMDGCN-based processors.
107  GK_GFX600 = 32,
108  GK_GFX601 = 33,
109 
110  GK_GFX700 = 40,
111  GK_GFX701 = 41,
112  GK_GFX702 = 42,
113  GK_GFX703 = 43,
114  GK_GFX704 = 44,
115 
116  GK_GFX801 = 50,
117  GK_GFX802 = 51,
118  GK_GFX803 = 52,
119  GK_GFX810 = 53,
120 
121  GK_GFX900 = 60,
122  GK_GFX902 = 61,
123  GK_GFX904 = 62,
124  GK_GFX906 = 63,
125  GK_GFX909 = 65,
126 
129 };
130 
131 /// Instruction set architecture version.
132 struct IsaVersion {
133  unsigned Major;
134  unsigned Minor;
135  unsigned Stepping;
136 };
137 
138 // This isn't comprehensive for now, just things that are needed from the
139 // frontend driver.
142 
143  // These features only exist for r600, and are implied true for amdgcn.
144  FEATURE_FMA = 1 << 1,
145  FEATURE_LDEXP = 1 << 2,
146  FEATURE_FP64 = 1 << 3,
147 
148  // Common features.
151 };
152 
158 unsigned getArchAttrAMDGCN(GPUKind AK);
159 unsigned getArchAttrR600(GPUKind AK);
160 
163 
165 
166 } // namespace AMDGPU
167 
168 } // namespace llvm
169 
170 #endif
StringRef getArchNameR600(GPUKind AK)
This class represents lattice values for constants.
Definition: AllocatorList.h:24
Instruction set architecture version.
Definition: TargetParser.h:132
void fillValidArchListAMDGCN(SmallVectorImpl< StringRef > &Values)
StringRef getCanonicalArchName(StringRef Arch)
StringRef getArchNameAMDGCN(GPUKind AK)
unsigned getArchAttrR600(GPUKind AK)
void fillValidArchListR600(SmallVectorImpl< StringRef > &Values)
GPUKind
GPU kinds supported by the AMDGPU target.
Definition: TargetParser.h:81
GPUKind parseArchAMDGCN(StringRef CPU)
unsigned getArchAttrAMDGCN(GPUKind AK)
IsaVersion getIsaVersion(StringRef GPU)
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
GPUKind parseArchR600(StringRef CPU)