LLVM  10.0.0svn
TargetParser.h
Go to the documentation of this file.
1 //===-- TargetParser - Parser for target features ---------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements a target parser to recognise hardware features such as
10 // FPU/CPU/ARCH names as well as specific support such as HDIV, etc.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_SUPPORT_TARGETPARSER_H
15 #define LLVM_SUPPORT_TARGETPARSER_H
16 
17 // FIXME: vector is used because that's what clang uses for subtarget feature
18 // lists, but SmallVector would probably be better
19 #include "llvm/ADT/Triple.h"
22 #include <vector>
23 
24 namespace llvm {
25 class StringRef;
26 
27 // Target specific information in their own namespaces.
28 // (ARM/AArch64 are declared in ARM/AArch64TargetParser.h)
29 // These should be generated from TableGen because the information is already
30 // there, and there is where new information about targets will be added.
31 // FIXME: To TableGen this we need to make some table generated files available
32 // even if the back-end is not compiled with LLVM, plus we need to create a new
33 // back-end to TableGen to create these clean tables.
34 namespace X86 {
35 
36 // This should be kept in sync with libcc/compiler-rt as its included by clang
37 // as a proxy for what's in libgcc/compiler-rt.
38 enum ProcessorVendors : unsigned {
40 #define X86_VENDOR(ENUM, STRING) \
41  ENUM,
42 #include "llvm/Support/X86TargetParser.def"
44 };
45 
46 // This should be kept in sync with libcc/compiler-rt as its included by clang
47 // as a proxy for what's in libgcc/compiler-rt.
48 enum ProcessorTypes : unsigned {
50 #define X86_CPU_TYPE(ARCHNAME, ENUM) \
51  ENUM,
52 #include "llvm/Support/X86TargetParser.def"
54 };
55 
56 // This should be kept in sync with libcc/compiler-rt as its included by clang
57 // as a proxy for what's in libgcc/compiler-rt.
58 enum ProcessorSubtypes : unsigned {
60 #define X86_CPU_SUBTYPE(ARCHNAME, ENUM) \
61  ENUM,
62 #include "llvm/Support/X86TargetParser.def"
64 };
65 
66 // This should be kept in sync with libcc/compiler-rt as it should be used
67 // by clang as a proxy for what's in libgcc/compiler-rt.
69 #define X86_FEATURE(VAL, ENUM) \
70  ENUM = VAL,
71 #include "llvm/Support/X86TargetParser.def"
72 
73 };
74 
75 } // namespace X86
76 
77 namespace AMDGPU {
78 
79 /// GPU kinds supported by the AMDGPU target.
80 enum GPUKind : uint32_t {
81  // Not specified processor.
82  GK_NONE = 0,
83 
84  // R600-based processors.
85  GK_R600 = 1,
86  GK_R630 = 2,
87  GK_RS880 = 3,
88  GK_RV670 = 4,
89  GK_RV710 = 5,
90  GK_RV730 = 6,
91  GK_RV770 = 7,
92  GK_CEDAR = 8,
94  GK_JUNIPER = 10,
95  GK_REDWOOD = 11,
96  GK_SUMO = 12,
97  GK_BARTS = 13,
98  GK_CAICOS = 14,
99  GK_CAYMAN = 15,
100  GK_TURKS = 16,
101 
104 
105  // AMDGCN-based processors.
106  GK_GFX600 = 32,
107  GK_GFX601 = 33,
108 
109  GK_GFX700 = 40,
110  GK_GFX701 = 41,
111  GK_GFX702 = 42,
112  GK_GFX703 = 43,
113  GK_GFX704 = 44,
114 
115  GK_GFX801 = 50,
116  GK_GFX802 = 51,
117  GK_GFX803 = 52,
118  GK_GFX810 = 53,
119 
120  GK_GFX900 = 60,
121  GK_GFX902 = 61,
122  GK_GFX904 = 62,
123  GK_GFX906 = 63,
124  GK_GFX908 = 64,
125  GK_GFX909 = 65,
126 
130 
133 };
134 
135 /// Instruction set architecture version.
136 struct IsaVersion {
137  unsigned Major;
138  unsigned Minor;
139  unsigned Stepping;
140 };
141 
142 // This isn't comprehensive for now, just things that are needed from the
143 // frontend driver.
146 
147  // These features only exist for r600, and are implied true for amdgcn.
148  FEATURE_FMA = 1 << 1,
149  FEATURE_LDEXP = 1 << 2,
150  FEATURE_FP64 = 1 << 3,
151 
152  // Common features.
155 };
156 
162 unsigned getArchAttrAMDGCN(GPUKind AK);
163 unsigned getArchAttrR600(GPUKind AK);
164 
167 
169 
170 } // namespace AMDGPU
171 
172 } // namespace llvm
173 
174 #endif
StringRef getArchNameR600(GPUKind AK)
This class represents lattice values for constants.
Definition: AllocatorList.h:23
Instruction set architecture version.
Definition: TargetParser.h:136
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:80
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:48
GPUKind parseArchR600(StringRef CPU)