LLVM 19.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
89
101
109
112
115
121
124};
125
126/// Instruction set architecture version.
128 unsigned Major;
129 unsigned Minor;
130 unsigned Stepping;
131};
132
133// This isn't comprehensive for now, just things that are needed from the
134// frontend driver.
137
138 // These features only exist for r600, and are implied true for amdgcn.
139 FEATURE_FMA = 1 << 1,
141 FEATURE_FP64 = 1 << 3,
142
143 // Common features.
146
147 // Wavefront 32 is available.
149
150 // Xnack is available.
152
153 // Sram-ecc is available.
155
156 // WGP mode is supported.
157 FEATURE_WGP = 1 << 9,
158};
159
161
167unsigned getArchAttrAMDGCN(GPUKind AK);
168unsigned getArchAttrR600(GPUKind AK);
169
172
173IsaVersion getIsaVersion(StringRef GPU);
174
175/// Fills Features map with default values for given target GPU
176void fillAMDGPUFeatureMap(StringRef GPU, const Triple &T,
177 StringMap<bool> &Features);
178
179/// Inserts wave size feature for given GPU into features map
180bool insertWaveSizeFeature(StringRef GPU, const Triple &T,
181 StringMap<bool> &Features, std::string &ErrorMsg);
182
183} // namespace AMDGPU
184} // namespace llvm
185
186#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:586
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:50
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:122
@ GK_AMDGCN_GENERIC_LAST
Definition: TargetParser.h:123
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.
void fillValidArchListAMDGCN(SmallVectorImpl< StringRef > &Values)
GPUKind parseArchAMDGCN(StringRef CPU)
bool insertWaveSizeFeature(StringRef GPU, const Triple &T, StringMap< bool > &Features, std::string &ErrorMsg)
Inserts wave size feature for given GPU into features map.
@ FEATURE_FAST_DENORMAL_F32
Definition: TargetParser.h:145
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:127