LLVM 22.0.0git
X86TargetParser.h
Go to the documentation of this file.
1//===-- X86TargetParser - Parser for X86 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 X86 hardware features.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_TARGETPARSER_X86TARGETPARSER_H
14#define LLVM_TARGETPARSER_X86TARGETPARSER_H
15
16#include "llvm/ADT/ArrayRef.h"
17#include "llvm/ADT/StringMap.h"
19#include <array>
20
21namespace llvm {
22template <typename T> class SmallVectorImpl;
23class StringRef;
24
25namespace X86 {
26
27// This should be kept in sync with libcc/compiler-rt as its included by clang
28// as a proxy for what's in libgcc/compiler-rt.
29enum ProcessorVendors : unsigned {
31#define X86_VENDOR(ENUM, STRING) \
32 ENUM,
33#include "llvm/TargetParser/X86TargetParser.def"
35};
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.
39enum ProcessorTypes : unsigned {
41#define X86_CPU_TYPE(ENUM, STRING) \
42 ENUM,
43#include "llvm/TargetParser/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.
49enum ProcessorSubtypes : unsigned {
51#define X86_CPU_SUBTYPE(ENUM, STRING) \
52 ENUM,
53#include "llvm/TargetParser/X86TargetParser.def"
55};
56
57// This should be kept in sync with libcc/compiler-rt as it should be used
58// by clang as a proxy for what's in libgcc/compiler-rt.
60#define X86_FEATURE(ENUM, STRING) FEATURE_##ENUM,
61#include "llvm/TargetParser/X86TargetParser.def"
63
64#define X86_MICROARCH_LEVEL(ENUM, STRING, PRIORITY) FEATURE_##ENUM = PRIORITY,
65#include "llvm/TargetParser/X86TargetParser.def"
66};
67
68enum CPUKind {
153};
154
155/// Parse \p CPU string into a CPUKind. Will only accept 64-bit capable CPUs if
156/// \p Only64Bit is true.
157LLVM_ABI CPUKind parseArchX86(StringRef CPU, bool Only64Bit = false);
158LLVM_ABI CPUKind parseTuneCPU(StringRef CPU, bool Only64Bit = false);
159
160/// Provide a list of valid CPU names. If \p Only64Bit is true, the list will
161/// only contain 64-bit capable CPUs.
163 bool Only64Bit = false);
164/// Provide a list of valid -mtune names.
166 bool Only64Bit = false);
167
168/// Get the key feature prioritizing target multiversioning.
170
171/// Fill in the features that \p CPU supports into \p Features.
172/// "+" will be append in front of each feature if NeedPlus is true.
175 bool NeedPlus = false);
176
177/// Set or clear entries in \p Features that are implied to be enabled/disabled
178/// by the provided \p Feature.
180 StringMap<bool> &Features);
181
184LLVM_ABI std::array<uint32_t, 4>
187
188} // namespace X86
189} // namespace llvm
190
191#endif
This file defines the StringMap class.
#define LLVM_ABI
Definition: Compiler.h:213
std::string Name
static bool Enabled
Definition: Statistic.cpp:46
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: SmallVector.h:574
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:133
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
LLVM_ABI std::array< uint32_t, 4 > getCpuSupportsMask(ArrayRef< StringRef > FeatureStrs)
LLVM_ABI char getCPUDispatchMangling(StringRef Name)
LLVM_ABI CPUKind parseTuneCPU(StringRef CPU, bool Only64Bit=false)
LLVM_ABI void updateImpliedFeatures(StringRef Feature, bool Enabled, StringMap< bool > &Features)
Set or clear entries in Features that are implied to be enabled/disabled by the provided Feature.
LLVM_ABI CPUKind parseArchX86(StringRef CPU, bool Only64Bit=false)
Parse CPU string into a CPUKind.
LLVM_ABI void fillValidTuneCPUList(SmallVectorImpl< StringRef > &Values, bool Only64Bit=false)
Provide a list of valid -mtune names.
LLVM_ABI void getFeaturesForCPU(StringRef CPU, SmallVectorImpl< StringRef > &Features, bool NeedPlus=false)
Fill in the features that CPU supports into Features.
LLVM_ABI unsigned getFeaturePriority(ProcessorFeatures Feat)
LLVM_ABI void fillValidCPUArchList(SmallVectorImpl< StringRef > &Values, bool Only64Bit=false)
Provide a list of valid CPU names.
LLVM_ABI bool validateCPUSpecificCPUDispatch(StringRef Name)
LLVM_ABI ProcessorFeatures getKeyFeature(CPUKind Kind)
Get the key feature prioritizing target multiversioning.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18