LLVM  14.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_SUPPORT_X86TARGETPARSER_H
14 #define LLVM_SUPPORT_X86TARGETPARSER_H
15 
16 #include "llvm/ADT/ArrayRef.h"
17 #include "llvm/ADT/SmallVector.h"
18 #include "llvm/ADT/StringMap.h"
19 
20 namespace llvm {
21 class StringRef;
22 
23 namespace X86 {
24 
25 // This should be kept in sync with libcc/compiler-rt as its included by clang
26 // as a proxy for what's in libgcc/compiler-rt.
27 enum ProcessorVendors : unsigned {
29 #define X86_VENDOR(ENUM, STRING) \
30  ENUM,
31 #include "llvm/Support/X86TargetParser.def"
33 };
34 
35 // This should be kept in sync with libcc/compiler-rt as its included by clang
36 // as a proxy for what's in libgcc/compiler-rt.
37 enum ProcessorTypes : unsigned {
39 #define X86_CPU_TYPE(ENUM, STRING) \
40  ENUM,
41 #include "llvm/Support/X86TargetParser.def"
43 };
44 
45 // This should be kept in sync with libcc/compiler-rt as its included by clang
46 // as a proxy for what's in libgcc/compiler-rt.
47 enum ProcessorSubtypes : unsigned {
49 #define X86_CPU_SUBTYPE(ENUM, STRING) \
50  ENUM,
51 #include "llvm/Support/X86TargetParser.def"
53 };
54 
55 // This should be kept in sync with libcc/compiler-rt as it should be used
56 // by clang as a proxy for what's in libgcc/compiler-rt.
58 #define X86_FEATURE(ENUM, STRING) FEATURE_##ENUM,
59 #include "llvm/Support/X86TargetParser.def"
61 };
62 
63 enum CPUKind {
132 };
133 
134 /// Parse \p CPU string into a CPUKind. Will only accept 64-bit capable CPUs if
135 /// \p Only64Bit is true.
136 CPUKind parseArchX86(StringRef CPU, bool Only64Bit = false);
137 CPUKind parseTuneCPU(StringRef CPU, bool Only64Bit = false);
138 
139 /// Provide a list of valid CPU names. If \p Only64Bit is true, the list will
140 /// only contain 64-bit capable CPUs.
142  bool Only64Bit = false);
143 /// Provide a list of valid -mtune names.
145  bool Only64Bit = false);
146 
147 /// Get the key feature prioritizing target multiversioning.
149 
150 /// Fill in the features that \p CPU supports into \p Features.
152 
153 /// Set or clear entries in \p Features that are implied to be enabled/disabled
154 /// by the provided \p Feature.
155 void updateImpliedFeatures(StringRef Feature, bool Enabled,
156  StringMap<bool> &Features);
157 
160 
161 } // namespace X86
162 } // namespace llvm
163 
164 #endif
llvm::X86::CK_Prescott
@ CK_Prescott
Definition: X86TargetParser.h:81
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::X86::CPUKind
CPUKind
Definition: X86TargetParser.h:63
llvm::X86::CK_IcelakeClient
@ CK_IcelakeClient
Definition: X86TargetParser.h:101
llvm::X86::CK_Athlon
@ CK_Athlon
Definition: X86TargetParser.h:113
llvm::X86::CK_C3_2
@ CK_C3_2
Definition: X86TargetParser.h:78
llvm::X86::ProcessorVendors
ProcessorVendors
Definition: X86TargetParser.h:27
llvm::X86::CK_BDVER2
@ CK_BDVER2
Definition: X86TargetParser.h:121
llvm::X86::CK_x86_64_v2
@ CK_x86_64_v2
Definition: X86TargetParser.h:128
llvm::X86::CK_SkylakeClient
@ CK_SkylakeClient
Definition: X86TargetParser.h:96
llvm::X86::CK_i686
@ CK_i686
Definition: X86TargetParser.h:74
llvm::X86::CK_PentiumPro
@ CK_PentiumPro
Definition: X86TargetParser.h:73
llvm::X86::ProcessorTypes
ProcessorTypes
Definition: X86TargetParser.h:37
llvm::X86::CK_SkylakeServer
@ CK_SkylakeServer
Definition: X86TargetParser.h:97
llvm::X86::CK_K6
@ CK_K6
Definition: X86TargetParser.h:110
llvm::X86::CK_KNL
@ CK_KNL
Definition: X86TargetParser.h:107
llvm::X86::getCpuSupportsMask
uint64_t getCpuSupportsMask(ArrayRef< StringRef > FeatureStrs)
Definition: X86TargetParser.cpp:670
llvm::X86::getKeyFeature
ProcessorFeatures getKeyFeature(CPUKind Kind)
Get the key feature prioritizing target multiversioning.
Definition: X86TargetParser.cpp:451
llvm::X86::CK_SandyBridge
@ CK_SandyBridge
Definition: X86TargetParser.h:92
llvm::X86::CK_Nocona
@ CK_Nocona
Definition: X86TargetParser.h:82
llvm::X86::CK_Bonnell
@ CK_Bonnell
Definition: X86TargetParser.h:85
llvm::X86::CK_Lakemont
@ CK_Lakemont
Definition: X86TargetParser.h:109
llvm::X86::CK_PentiumMMX
@ CK_PentiumMMX
Definition: X86TargetParser.h:72
llvm::X86::CK_GoldmontPlus
@ CK_GoldmontPlus
Definition: X86TargetParser.h:88
llvm::X86::parseArchX86
CPUKind parseArchX86(StringRef CPU, bool Only64Bit=false)
Parse CPU string into a CPUKind.
Definition: X86TargetParser.cpp:422
llvm::X86::CK_KNM
@ CK_KNM
Definition: X86TargetParser.h:108
llvm::X86::CK_x86_64
@ CK_x86_64
Definition: X86TargetParser.h:127
llvm::X86::CK_None
@ CK_None
Definition: X86TargetParser.h:64
llvm::X86::CPU_FEATURE_MAX
@ CPU_FEATURE_MAX
Definition: X86TargetParser.h:60
llvm::X86::CK_ZNVER1
@ CK_ZNVER1
Definition: X86TargetParser.h:124
llvm::X86::getFeaturePriority
unsigned getFeaturePriority(ProcessorFeatures Feat)
Definition: X86TargetParser.cpp:684
llvm::X86::CK_WinChip2
@ CK_WinChip2
Definition: X86TargetParser.h:68
llvm::X86::CK_C3
@ CK_C3
Definition: X86TargetParser.h:69
llvm::X86::fillValidCPUArchList
void fillValidCPUArchList(SmallVectorImpl< StringRef > &Values, bool Only64Bit=false)
Provide a list of valid CPU names.
Definition: X86TargetParser.cpp:436
llvm::X86::CPU_TYPE_DUMMY
@ CPU_TYPE_DUMMY
Definition: X86TargetParser.h:38
llvm::X86::VENDOR_OTHER
@ VENDOR_OTHER
Definition: X86TargetParser.h:32
llvm::X86::CK_K8SSE3
@ CK_K8SSE3
Definition: X86TargetParser.h:116
StringMap.h
llvm::X86::CK_PentiumM
@ CK_PentiumM
Definition: X86TargetParser.h:77
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::StringMap< bool >
llvm::X86::CK_Nehalem
@ CK_Nehalem
Definition: X86TargetParser.h:90
llvm::X86::CK_Cannonlake
@ CK_Cannonlake
Definition: X86TargetParser.h:100
llvm::X86::CK_Haswell
@ CK_Haswell
Definition: X86TargetParser.h:94
llvm::X86::CK_ZNVER3
@ CK_ZNVER3
Definition: X86TargetParser.h:126
uint64_t
llvm::X86::CK_BDVER3
@ CK_BDVER3
Definition: X86TargetParser.h:122
llvm::X86::CK_Pentium
@ CK_Pentium
Definition: X86TargetParser.h:71
llvm::X86::updateImpliedFeatures
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.
Definition: X86TargetParser.cpp:646
llvm::X86::ProcessorSubtypes
ProcessorSubtypes
Definition: X86TargetParser.h:47
llvm::X86::CK_BDVER4
@ CK_BDVER4
Definition: X86TargetParser.h:123
llvm::X86::CK_AMDFAM10
@ CK_AMDFAM10
Definition: X86TargetParser.h:117
ArrayRef.h
llvm::X86::getFeaturesForCPU
void getFeaturesForCPU(StringRef CPU, SmallVectorImpl< StringRef > &Features)
Fill in the features that CPU supports into Features.
Definition: X86TargetParser.cpp:597
llvm::X86::CPU_SUBTYPE_MAX
@ CPU_SUBTYPE_MAX
Definition: X86TargetParser.h:52
llvm::X86::CK_Westmere
@ CK_Westmere
Definition: X86TargetParser.h:91
llvm::X86::CK_Rocketlake
@ CK_Rocketlake
Definition: X86TargetParser.h:102
llvm::X86::CK_Broadwell
@ CK_Broadwell
Definition: X86TargetParser.h:95
llvm::X86::CK_K8
@ CK_K8
Definition: X86TargetParser.h:115
llvm::X86::CK_WinChipC6
@ CK_WinChipC6
Definition: X86TargetParser.h:67
llvm::X86::CK_BDVER1
@ CK_BDVER1
Definition: X86TargetParser.h:120
llvm::X86::CK_x86_64_v3
@ CK_x86_64_v3
Definition: X86TargetParser.h:129
llvm::X86::CK_SapphireRapids
@ CK_SapphireRapids
Definition: X86TargetParser.h:105
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::X86::CK_K6_3
@ CK_K6_3
Definition: X86TargetParser.h:112
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::X86::CK_Silvermont
@ CK_Silvermont
Definition: X86TargetParser.h:86
llvm::X86::CK_Pentium2
@ CK_Pentium2
Definition: X86TargetParser.h:75
llvm::X86::CK_IcelakeServer
@ CK_IcelakeServer
Definition: X86TargetParser.h:103
llvm::X86::ProcessorFeatures
ProcessorFeatures
Definition: X86TargetParser.h:57
llvm::X86::CK_Tigerlake
@ CK_Tigerlake
Definition: X86TargetParser.h:104
llvm::X86::CK_x86_64_v4
@ CK_x86_64_v4
Definition: X86TargetParser.h:130
llvm::X86::CPU_TYPE_MAX
@ CPU_TYPE_MAX
Definition: X86TargetParser.h:42
llvm::X86::CK_BTVER1
@ CK_BTVER1
Definition: X86TargetParser.h:118
llvm::X86::CK_i486
@ CK_i486
Definition: X86TargetParser.h:66
llvm::X86::CK_K6_2
@ CK_K6_2
Definition: X86TargetParser.h:111
Enabled
static bool Enabled
Definition: Statistic.cpp:46
llvm::X86::CK_Goldmont
@ CK_Goldmont
Definition: X86TargetParser.h:87
llvm::X86::CK_BTVER2
@ CK_BTVER2
Definition: X86TargetParser.h:119
llvm::X86::CK_ZNVER2
@ CK_ZNVER2
Definition: X86TargetParser.h:125
llvm::X86::CK_i586
@ CK_i586
Definition: X86TargetParser.h:70
llvm::X86::CK_Pentium4
@ CK_Pentium4
Definition: X86TargetParser.h:80
llvm::X86::fillValidTuneCPUList
void fillValidTuneCPUList(SmallVectorImpl< StringRef > &Values, bool Only64Bit=false)
Provide a list of valid -mtune names.
Definition: X86TargetParser.cpp:443
llvm::X86::CK_Core2
@ CK_Core2
Definition: X86TargetParser.h:83
llvm::X86::parseTuneCPU
CPUKind parseTuneCPU(StringRef CPU, bool Only64Bit=false)
Definition: X86TargetParser.cpp:430
SmallVector.h
llvm::X86::CK_IvyBridge
@ CK_IvyBridge
Definition: X86TargetParser.h:93
llvm::X86::CPU_SUBTYPE_DUMMY
@ CPU_SUBTYPE_DUMMY
Definition: X86TargetParser.h:48
llvm::X86::CK_Tremont
@ CK_Tremont
Definition: X86TargetParser.h:89
llvm::X86::CK_Alderlake
@ CK_Alderlake
Definition: X86TargetParser.h:106
llvm::SmallVectorImpl< StringRef >
llvm::X86::VENDOR_DUMMY
@ VENDOR_DUMMY
Definition: X86TargetParser.h:28
llvm::X86::CK_Cascadelake
@ CK_Cascadelake
Definition: X86TargetParser.h:98
llvm::X86::CK_Penryn
@ CK_Penryn
Definition: X86TargetParser.h:84
llvm::X86::CK_Cooperlake
@ CK_Cooperlake
Definition: X86TargetParser.h:99
llvm::X86::CK_AthlonXP
@ CK_AthlonXP
Definition: X86TargetParser.h:114
X86
Unrolling by would eliminate the &in both leading to a net reduction in code size The resultant code would then also be suitable for exit value computation We miss a bunch of rotate opportunities on various including etc On X86
Definition: README.txt:568
llvm::X86::CK_i386
@ CK_i386
Definition: X86TargetParser.h:65
llvm::X86::CK_Pentium3
@ CK_Pentium3
Definition: X86TargetParser.h:76
llvm::X86::CK_Yonah
@ CK_Yonah
Definition: X86TargetParser.h:79
llvm::X86::CK_Geode
@ CK_Geode
Definition: X86TargetParser.h:131