File indexing completed on 2026-05-10 08:44:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_TARGETPARSER_X86TARGETPARSER_H
0014 #define LLVM_TARGETPARSER_X86TARGETPARSER_H
0015
0016 #include "llvm/ADT/ArrayRef.h"
0017 #include "llvm/ADT/StringMap.h"
0018 #include <array>
0019
0020 namespace llvm {
0021 template <typename T> class SmallVectorImpl;
0022 class StringRef;
0023
0024 namespace X86 {
0025
0026
0027
0028 enum ProcessorVendors : unsigned {
0029 VENDOR_DUMMY,
0030 #define X86_VENDOR(ENUM, STRING) \
0031 ENUM,
0032 #include "llvm/TargetParser/X86TargetParser.def"
0033 VENDOR_OTHER
0034 };
0035
0036
0037
0038 enum ProcessorTypes : unsigned {
0039 CPU_TYPE_DUMMY,
0040 #define X86_CPU_TYPE(ENUM, STRING) \
0041 ENUM,
0042 #include "llvm/TargetParser/X86TargetParser.def"
0043 CPU_TYPE_MAX
0044 };
0045
0046
0047
0048 enum ProcessorSubtypes : unsigned {
0049 CPU_SUBTYPE_DUMMY,
0050 #define X86_CPU_SUBTYPE(ENUM, STRING) \
0051 ENUM,
0052 #include "llvm/TargetParser/X86TargetParser.def"
0053 CPU_SUBTYPE_MAX
0054 };
0055
0056
0057
0058 enum ProcessorFeatures {
0059 #define X86_FEATURE(ENUM, STRING) FEATURE_##ENUM,
0060 #include "llvm/TargetParser/X86TargetParser.def"
0061 CPU_FEATURE_MAX,
0062
0063 #define X86_MICROARCH_LEVEL(ENUM, STRING, PRIORITY) FEATURE_##ENUM = PRIORITY,
0064 #include "llvm/TargetParser/X86TargetParser.def"
0065 };
0066
0067 enum CPUKind {
0068 CK_None,
0069 CK_i386,
0070 CK_i486,
0071 CK_WinChipC6,
0072 CK_WinChip2,
0073 CK_C3,
0074 CK_i586,
0075 CK_Pentium,
0076 CK_PentiumMMX,
0077 CK_PentiumPro,
0078 CK_i686,
0079 CK_Pentium2,
0080 CK_Pentium3,
0081 CK_PentiumM,
0082 CK_C3_2,
0083 CK_Yonah,
0084 CK_Pentium4,
0085 CK_Prescott,
0086 CK_Nocona,
0087 CK_Core2,
0088 CK_Penryn,
0089 CK_Bonnell,
0090 CK_Silvermont,
0091 CK_Goldmont,
0092 CK_GoldmontPlus,
0093 CK_Tremont,
0094 CK_Gracemont,
0095 CK_Nehalem,
0096 CK_Westmere,
0097 CK_SandyBridge,
0098 CK_IvyBridge,
0099 CK_Haswell,
0100 CK_Broadwell,
0101 CK_SkylakeClient,
0102 CK_SkylakeServer,
0103 CK_Cascadelake,
0104 CK_Cooperlake,
0105 CK_Cannonlake,
0106 CK_IcelakeClient,
0107 CK_Rocketlake,
0108 CK_IcelakeServer,
0109 CK_Tigerlake,
0110 CK_SapphireRapids,
0111 CK_Alderlake,
0112 CK_Raptorlake,
0113 CK_Meteorlake,
0114 CK_Arrowlake,
0115 CK_ArrowlakeS,
0116 CK_Lunarlake,
0117 CK_Pantherlake,
0118 CK_Sierraforest,
0119 CK_Grandridge,
0120 CK_Graniterapids,
0121 CK_GraniterapidsD,
0122 CK_Emeraldrapids,
0123 CK_Clearwaterforest,
0124 CK_Diamondrapids,
0125 CK_KNL,
0126 CK_KNM,
0127 CK_Lakemont,
0128 CK_K6,
0129 CK_K6_2,
0130 CK_K6_3,
0131 CK_Athlon,
0132 CK_AthlonXP,
0133 CK_K8,
0134 CK_K8SSE3,
0135 CK_AMDFAM10,
0136 CK_BTVER1,
0137 CK_BTVER2,
0138 CK_BDVER1,
0139 CK_BDVER2,
0140 CK_BDVER3,
0141 CK_BDVER4,
0142 CK_ZNVER1,
0143 CK_ZNVER2,
0144 CK_ZNVER3,
0145 CK_ZNVER4,
0146 CK_ZNVER5,
0147 CK_x86_64,
0148 CK_x86_64_v2,
0149 CK_x86_64_v3,
0150 CK_x86_64_v4,
0151 CK_Geode,
0152 };
0153
0154
0155
0156 CPUKind parseArchX86(StringRef CPU, bool Only64Bit = false);
0157 CPUKind parseTuneCPU(StringRef CPU, bool Only64Bit = false);
0158
0159
0160
0161 void fillValidCPUArchList(SmallVectorImpl<StringRef> &Values,
0162 bool Only64Bit = false);
0163
0164 void fillValidTuneCPUList(SmallVectorImpl<StringRef> &Values,
0165 bool Only64Bit = false);
0166
0167
0168 ProcessorFeatures getKeyFeature(CPUKind Kind);
0169
0170
0171
0172 void getFeaturesForCPU(StringRef CPU, SmallVectorImpl<StringRef> &Features,
0173 bool NeedPlus = false);
0174
0175
0176
0177 void updateImpliedFeatures(StringRef Feature, bool Enabled,
0178 StringMap<bool> &Features);
0179
0180 char getCPUDispatchMangling(StringRef Name);
0181 bool validateCPUSpecificCPUDispatch(StringRef Name);
0182 std::array<uint32_t, 4> getCpuSupportsMask(ArrayRef<StringRef> FeatureStrs);
0183 unsigned getFeaturePriority(ProcessorFeatures Feat);
0184
0185 }
0186 }
0187
0188 #endif