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
108
111
114
119
122};
123
124/// Instruction set architecture version.
126 unsigned Major;
127 unsigned Minor;
128 unsigned Stepping;
129};
130
131// This isn't comprehensive for now, just things that are needed from the
132// frontend driver.
135
136 // These features only exist for r600, and are implied true for amdgcn.
137 FEATURE_FMA = 1 << 1,
139 FEATURE_FP64 = 1 << 3,
140
141 // Common features.
144
145 // Wavefront 32 is available.
147
148 // Xnack is available.
150
151 // Sram-ecc is available.
153
154 // WGP mode is supported.
155 FEATURE_WGP = 1 << 9,
156};
157
159
165unsigned getArchAttrAMDGCN(GPUKind AK);
166unsigned getArchAttrR600(GPUKind AK);
167
170
171IsaVersion getIsaVersion(StringRef GPU);
172
173/// Fills Features map with default values for given target GPU
174void fillAMDGPUFeatureMap(StringRef GPU, const Triple &T,
175 StringMap<bool> &Features);
176
177/// Inserts wave size feature for given GPU into features map
178bool insertWaveSizeFeature(StringRef GPU, const Triple &T,
179 StringMap<bool> &Features, std::string &ErrorMsg);
180
181} // namespace AMDGPU
182} // namespace llvm
183
184#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:120
@ GK_AMDGCN_GENERIC_LAST
Definition: TargetParser.h:121
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:143
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:125