LLVM 20.0.0git
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_TARGETPARSER_TARGETPARSER_H
15#define LLVM_TARGETPARSER_TARGETPARSER_H
16
17#include "llvm/ADT/StringMap.h"
18#include "llvm/ADT/StringRef.h"
19
20namespace llvm {
21
22template <typename T> class SmallVectorImpl;
23class Triple;
24
25// Target specific information in their own namespaces.
26// (ARM/AArch64/X86 are declared in ARM/AArch64/X86TargetParser.h)
27// These should be generated from TableGen because the information is already
28// there, and there is where new information about targets will be added.
29// FIXME: To TableGen this we need to make some table generated files available
30// even if the back-end is not compiled with LLVM, plus we need to create a new
31// back-end to TableGen to create these clean tables.
32namespace AMDGPU {
33
34/// GPU kinds supported by the AMDGPU target.
36 // Not specified processor.
38
39 // R600-based processors.
51 GK_SUMO = 12,
56
59
60 // AMDGCN-based processors.
64
71
77
90
102
111
114
117
124
127};
128
129/// Instruction set architecture version.
131 unsigned Major;
132 unsigned Minor;
133 unsigned Stepping;
134};
135
136// This isn't comprehensive for now, just things that are needed from the
137// frontend driver.
140
141 // These features only exist for r600, and are implied true for amdgcn.
142 FEATURE_FMA = 1 << 1,
144 FEATURE_FP64 = 1 << 3,
145
146 // Common features.
149
150 // Wavefront 32 is available.
152
153 // Xnack is available.
155
156 // Sram-ecc is available.
158
159 // WGP mode is supported.
160 FEATURE_WGP = 1 << 9,
161};
162
168
170
176unsigned getArchAttrAMDGCN(GPUKind AK);
177unsigned getArchAttrR600(GPUKind AK);
178
181
182IsaVersion getIsaVersion(StringRef GPU);
183
184/// Fills Features map with default values for given target GPU
185void fillAMDGPUFeatureMap(StringRef GPU, const Triple &T,
186 StringMap<bool> &Features);
187
188/// Inserts wave size feature for given GPU into features map
189std::pair<FeatureError, StringRef>
191 StringMap<bool> &Features);
192
193} // namespace AMDGPU
194} // namespace llvm
195
196#endif
This file defines the StringMap class.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:573
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:128
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
StringRef getArchNameR600(GPUKind AK)
GPUKind
GPU kinds supported by the AMDGPU target.
Definition: TargetParser.h:35
@ GK_AMDGCN_GENERIC_FIRST
Definition: TargetParser.h:125
@ GK_AMDGCN_GENERIC_LAST
Definition: TargetParser.h:126
StringRef getCanonicalArchName(const Triple &T, StringRef Arch)
void fillValidArchListR600(SmallVectorImpl< StringRef > &Values)
StringRef getArchFamilyNameAMDGCN(GPUKind AK)
IsaVersion getIsaVersion(StringRef GPU)
void fillAMDGPUFeatureMap(StringRef GPU, const Triple &T, StringMap< bool > &Features)
Fills Features map with default values for given target GPU.
std::pair< FeatureError, StringRef > insertWaveSizeFeature(StringRef GPU, const Triple &T, StringMap< bool > &Features)
Inserts wave size feature for given GPU into features map.
void fillValidArchListAMDGCN(SmallVectorImpl< StringRef > &Values)
GPUKind parseArchAMDGCN(StringRef CPU)
@ UNSUPPORTED_TARGET_FEATURE
Definition: TargetParser.h:166
@ INVALID_FEATURE_COMBINATION
Definition: TargetParser.h:165
@ FEATURE_FAST_DENORMAL_F32
Definition: TargetParser.h:148
StringRef getArchNameAMDGCN(GPUKind AK)
unsigned getArchAttrAMDGCN(GPUKind AK)
unsigned getArchAttrR600(GPUKind AK)
GPUKind parseArchR600(StringRef CPU)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Instruction set architecture version.
Definition: TargetParser.h:130