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/SmallVector.h"
17 #include "llvm/ADT/StringMap.h"
18 
19 namespace llvm {
20 class StringRef;
21 
22 namespace X86 {
23 
24 // This should be kept in sync with libcc/compiler-rt as its included by clang
25 // as a proxy for what's in libgcc/compiler-rt.
26 enum ProcessorVendors : unsigned {
28 #define X86_VENDOR(ENUM, STRING) \
29  ENUM,
30 #include "llvm/Support/X86TargetParser.def"
32 };
33 
34 // This should be kept in sync with libcc/compiler-rt as its included by clang
35 // as a proxy for what's in libgcc/compiler-rt.
36 enum ProcessorTypes : unsigned {
38 #define X86_CPU_TYPE(ENUM, STRING) \
39  ENUM,
40 #include "llvm/Support/X86TargetParser.def"
42 };
43 
44 // This should be kept in sync with libcc/compiler-rt as its included by clang
45 // as a proxy for what's in libgcc/compiler-rt.
46 enum ProcessorSubtypes : unsigned {
48 #define X86_CPU_SUBTYPE(ENUM, STRING) \
49  ENUM,
50 #include "llvm/Support/X86TargetParser.def"
52 };
53 
54 // This should be kept in sync with libcc/compiler-rt as it should be used
55 // by clang as a proxy for what's in libgcc/compiler-rt.
57 #define X86_FEATURE(ENUM, STRING) FEATURE_##ENUM,
58 #include "llvm/Support/X86TargetParser.def"
60 };
61 
62 enum CPUKind {
131 };
132 
133 /// Parse \p CPU string into a CPUKind. Will only accept 64-bit capable CPUs if
134 /// \p Only64Bit is true.
135 CPUKind parseArchX86(StringRef CPU, bool Only64Bit = false);
136 CPUKind parseTuneCPU(StringRef CPU, bool Only64Bit = false);
137 
138 /// Provide a list of valid CPU names. If \p Only64Bit is true, the list will
139 /// only contain 64-bit capable CPUs.
141  bool Only64Bit = false);
142 /// Provide a list of valid -mtune names.
144  bool Only64Bit = false);
145 
146 /// Get the key feature prioritizing target multiversioning.
148 
149 /// Fill in the features that \p CPU supports into \p Features.
151 
152 /// Set or clear entries in \p Features that are implied to be enabled/disabled
153 /// by the provided \p Feature.
154 void updateImpliedFeatures(StringRef Feature, bool Enabled,
155  StringMap<bool> &Features);
156 
157 } // namespace X86
158 } // namespace llvm
159 
160 #endif
llvm::X86::CK_Prescott
@ CK_Prescott
Definition: X86TargetParser.h:80
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::X86::CPUKind
CPUKind
Definition: X86TargetParser.h:62
llvm::X86::CK_IcelakeClient
@ CK_IcelakeClient
Definition: X86TargetParser.h:100
llvm::X86::CK_Athlon
@ CK_Athlon
Definition: X86TargetParser.h:112
llvm::X86::CK_C3_2
@ CK_C3_2
Definition: X86TargetParser.h:77
llvm::X86::ProcessorVendors
ProcessorVendors
Definition: X86TargetParser.h:26
llvm::X86::CK_BDVER2
@ CK_BDVER2
Definition: X86TargetParser.h:120
llvm::X86::CK_x86_64_v2
@ CK_x86_64_v2
Definition: X86TargetParser.h:127
llvm::X86::CK_SkylakeClient
@ CK_SkylakeClient
Definition: X86TargetParser.h:95
llvm::X86::CK_i686
@ CK_i686
Definition: X86TargetParser.h:73
llvm::X86::CK_PentiumPro
@ CK_PentiumPro
Definition: X86TargetParser.h:72
llvm::X86::ProcessorTypes
ProcessorTypes
Definition: X86TargetParser.h:36
llvm::X86::CK_SkylakeServer
@ CK_SkylakeServer
Definition: X86TargetParser.h:96
llvm::X86::CK_K6
@ CK_K6
Definition: X86TargetParser.h:109
llvm::X86::CK_KNL
@ CK_KNL
Definition: X86TargetParser.h:106
llvm::X86::getKeyFeature
ProcessorFeatures getKeyFeature(CPUKind Kind)
Get the key feature prioritizing target multiversioning.
Definition: X86TargetParser.cpp:448
llvm::X86::CK_SandyBridge
@ CK_SandyBridge
Definition: X86TargetParser.h:91
llvm::X86::CK_Nocona
@ CK_Nocona
Definition: X86TargetParser.h:81
llvm::X86::CK_Bonnell
@ CK_Bonnell
Definition: X86TargetParser.h:84
llvm::X86::CK_Lakemont
@ CK_Lakemont
Definition: X86TargetParser.h:108
llvm::X86::CK_PentiumMMX
@ CK_PentiumMMX
Definition: X86TargetParser.h:71
llvm::X86::CK_GoldmontPlus
@ CK_GoldmontPlus
Definition: X86TargetParser.h:87
llvm::X86::parseArchX86
CPUKind parseArchX86(StringRef CPU, bool Only64Bit=false)
Parse CPU string into a CPUKind.
Definition: X86TargetParser.cpp:419
llvm::X86::CK_KNM
@ CK_KNM
Definition: X86TargetParser.h:107
llvm::X86::CK_x86_64
@ CK_x86_64
Definition: X86TargetParser.h:126
llvm::X86::CK_None
@ CK_None
Definition: X86TargetParser.h:63
llvm::X86::CPU_FEATURE_MAX
@ CPU_FEATURE_MAX
Definition: X86TargetParser.h:59
llvm::X86::CK_ZNVER1
@ CK_ZNVER1
Definition: X86TargetParser.h:123
llvm::X86::CK_WinChip2
@ CK_WinChip2
Definition: X86TargetParser.h:67
llvm::X86::CK_C3
@ CK_C3
Definition: X86TargetParser.h:68
llvm::X86::fillValidCPUArchList
void fillValidCPUArchList(SmallVectorImpl< StringRef > &Values, bool Only64Bit=false)
Provide a list of valid CPU names.
Definition: X86TargetParser.cpp:433
llvm::X86::CPU_TYPE_DUMMY
@ CPU_TYPE_DUMMY
Definition: X86TargetParser.h:37
llvm::X86::VENDOR_OTHER
@ VENDOR_OTHER
Definition: X86TargetParser.h:31
llvm::X86::CK_K8SSE3
@ CK_K8SSE3
Definition: X86TargetParser.h:115
StringMap.h
llvm::X86::CK_PentiumM
@ CK_PentiumM
Definition: X86TargetParser.h:76
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::StringMap< bool >
llvm::X86::CK_Nehalem
@ CK_Nehalem
Definition: X86TargetParser.h:89
llvm::X86::CK_Cannonlake
@ CK_Cannonlake
Definition: X86TargetParser.h:99
llvm::X86::CK_Haswell
@ CK_Haswell
Definition: X86TargetParser.h:93
llvm::X86::CK_ZNVER3
@ CK_ZNVER3
Definition: X86TargetParser.h:125
llvm::X86::CK_BDVER3
@ CK_BDVER3
Definition: X86TargetParser.h:121
llvm::X86::CK_Pentium
@ CK_Pentium
Definition: X86TargetParser.h:70
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:640
llvm::X86::ProcessorSubtypes
ProcessorSubtypes
Definition: X86TargetParser.h:46
llvm::X86::CK_BDVER4
@ CK_BDVER4
Definition: X86TargetParser.h:122
llvm::X86::CK_AMDFAM10
@ CK_AMDFAM10
Definition: X86TargetParser.h:116
llvm::X86::getFeaturesForCPU
void getFeaturesForCPU(StringRef CPU, SmallVectorImpl< StringRef > &Features)
Fill in the features that CPU supports into Features.
Definition: X86TargetParser.cpp:591
llvm::X86::CPU_SUBTYPE_MAX
@ CPU_SUBTYPE_MAX
Definition: X86TargetParser.h:51
llvm::X86::CK_Westmere
@ CK_Westmere
Definition: X86TargetParser.h:90
llvm::X86::CK_Rocketlake
@ CK_Rocketlake
Definition: X86TargetParser.h:101
llvm::X86::CK_Broadwell
@ CK_Broadwell
Definition: X86TargetParser.h:94
llvm::X86::CK_K8
@ CK_K8
Definition: X86TargetParser.h:114
llvm::X86::CK_WinChipC6
@ CK_WinChipC6
Definition: X86TargetParser.h:66
llvm::X86::CK_BDVER1
@ CK_BDVER1
Definition: X86TargetParser.h:119
llvm::X86::CK_x86_64_v3
@ CK_x86_64_v3
Definition: X86TargetParser.h:128
llvm::X86::CK_SapphireRapids
@ CK_SapphireRapids
Definition: X86TargetParser.h:104
llvm::X86::CK_K6_3
@ CK_K6_3
Definition: X86TargetParser.h:111
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:85
llvm::X86::CK_Pentium2
@ CK_Pentium2
Definition: X86TargetParser.h:74
llvm::X86::CK_IcelakeServer
@ CK_IcelakeServer
Definition: X86TargetParser.h:102
llvm::X86::ProcessorFeatures
ProcessorFeatures
Definition: X86TargetParser.h:56
llvm::X86::CK_Tigerlake
@ CK_Tigerlake
Definition: X86TargetParser.h:103
llvm::X86::CK_x86_64_v4
@ CK_x86_64_v4
Definition: X86TargetParser.h:129
llvm::X86::CPU_TYPE_MAX
@ CPU_TYPE_MAX
Definition: X86TargetParser.h:41
llvm::X86::CK_BTVER1
@ CK_BTVER1
Definition: X86TargetParser.h:117
llvm::X86::CK_i486
@ CK_i486
Definition: X86TargetParser.h:65
llvm::X86::CK_K6_2
@ CK_K6_2
Definition: X86TargetParser.h:110
Enabled
static bool Enabled
Definition: Statistic.cpp:46
llvm::X86::CK_Goldmont
@ CK_Goldmont
Definition: X86TargetParser.h:86
llvm::X86::CK_BTVER2
@ CK_BTVER2
Definition: X86TargetParser.h:118
llvm::X86::CK_ZNVER2
@ CK_ZNVER2
Definition: X86TargetParser.h:124
llvm::X86::CK_i586
@ CK_i586
Definition: X86TargetParser.h:69
llvm::X86::CK_Pentium4
@ CK_Pentium4
Definition: X86TargetParser.h:79
llvm::X86::fillValidTuneCPUList
void fillValidTuneCPUList(SmallVectorImpl< StringRef > &Values, bool Only64Bit=false)
Provide a list of valid -mtune names.
Definition: X86TargetParser.cpp:440
llvm::X86::CK_Core2
@ CK_Core2
Definition: X86TargetParser.h:82
llvm::X86::parseTuneCPU
CPUKind parseTuneCPU(StringRef CPU, bool Only64Bit=false)
Definition: X86TargetParser.cpp:427
SmallVector.h
llvm::X86::CK_IvyBridge
@ CK_IvyBridge
Definition: X86TargetParser.h:92
llvm::X86::CPU_SUBTYPE_DUMMY
@ CPU_SUBTYPE_DUMMY
Definition: X86TargetParser.h:47
llvm::X86::CK_Tremont
@ CK_Tremont
Definition: X86TargetParser.h:88
llvm::X86::CK_Alderlake
@ CK_Alderlake
Definition: X86TargetParser.h:105
llvm::SmallVectorImpl< StringRef >
llvm::X86::VENDOR_DUMMY
@ VENDOR_DUMMY
Definition: X86TargetParser.h:27
llvm::X86::CK_Cascadelake
@ CK_Cascadelake
Definition: X86TargetParser.h:97
llvm::X86::CK_Penryn
@ CK_Penryn
Definition: X86TargetParser.h:83
llvm::X86::CK_Cooperlake
@ CK_Cooperlake
Definition: X86TargetParser.h:98
llvm::X86::CK_AthlonXP
@ CK_AthlonXP
Definition: X86TargetParser.h:113
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:64
llvm::X86::CK_Pentium3
@ CK_Pentium3
Definition: X86TargetParser.h:75
llvm::X86::CK_Yonah
@ CK_Yonah
Definition: X86TargetParser.h:78
llvm::X86::CK_Geode
@ CK_Geode
Definition: X86TargetParser.h:130