[llvm] [CMAKE][llvm-libraries] Add Precompiled Headers option to improve build times (PR #91755)
Ameer J via llvm-commits
llvm-commits at lists.llvm.org
Fri May 10 08:12:43 PDT 2024
https://github.com/ameerj created https://github.com/llvm/llvm-project/pull/91755
Opening this PR to start a discussion on supporting PCH for LLVM Libraries.
This can significantly improve build time performance, especially on MSVC.
The changes are currently a "proof of concept" that are meant to be a starting point for discussion.
The aim is to be as non-intrusive as possible with the addition.
The candidates for headers to be included in the PCH are chosen based on the analysis of Visual Studio's `Build Insights`.
This produces the time taken to parse files during compilation, and the inclusion dependencies for header files.
Ideally, each target would specify which headers to include for its PCH, since some headers are widely used within one target, but not all libraries.
Some notes:
- The global inclusion of these headers exposes namespace clashes/ODR violations.
- The CMake PCH infrastructure has some limitations. In order to reuse the same PCH, each target needs to be compiled with the same compiler flags.
>From 62d6c3561de99659aad89e501e8f339b8ef0cc17 Mon Sep 17 00:00:00 2001
From: ameerj <ameerj99 at outlook.com>
Date: Fri, 10 May 2024 10:24:04 -0400
Subject: [PATCH] wip pch
---
llvm/CMakeLists.txt | 3 +
llvm/cmake/modules/HandleLLVMOptions.cmake | 8 +-
.../modules/LLVMPrecompiledHeaders.cmake | 35 ++
llvm/include/llvm/Demangle/ItaniumDemangle.h | 4 +-
llvm/include/llvm/PrecompiledHeaders.h | 11 +
llvm/lib/BinaryFormat/Dwarf.cpp | 24 +-
llvm/lib/BinaryFormat/MsgPackDocumentYAML.cpp | 14 +-
.../DWARF/DWARFAbbreviationDeclaration.cpp | 6 +-
llvm/lib/Object/Minidump.cpp | 2 +-
llvm/lib/ObjectYAML/MinidumpYAML.cpp | 18 +-
llvm/lib/Remarks/Remark.cpp | 17 +-
llvm/lib/Remarks/YAMLRemarkParser.cpp | 14 +-
llvm/lib/Remarks/YAMLRemarkSerializer.cpp | 28 +-
llvm/lib/TargetParser/X86TargetParser.cpp | 386 +++++++++---------
llvm/lib/TextAPI/TextStubV5.cpp | 10 +-
15 files changed, 324 insertions(+), 256 deletions(-)
create mode 100644 llvm/cmake/modules/LLVMPrecompiledHeaders.cmake
create mode 100644 llvm/include/llvm/PrecompiledHeaders.h
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index c06e661573ed4..e36abfaf475f0 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -1410,3 +1410,6 @@ endif()
if (LLVM_INCLUDE_UTILS AND LLVM_INCLUDE_TOOLS)
add_subdirectory(utils/llvm-locstats)
endif()
+
+include(LLVMPrecompiledHeaders)
+llvm_lib_precompiled_headers()
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 185266c0861e8..7d7a451adc93c 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -538,6 +538,8 @@ endif()
option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
+option(LLVM_ENABLE_PRECOMPILED_HEADERS "Enable precompiled headers to improve build times." ON)
+
if( MSVC )
# Add definitions that make MSVC much less annoying.
@@ -593,7 +595,11 @@ if( MSVC )
# PDBs without changing codegen.
option(LLVM_ENABLE_PDB OFF)
if (LLVM_ENABLE_PDB AND uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
- append("/Zi" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ if (LLVM_ENABLE_PRECOMPILED_HEADERS)
+ append("/Z7" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ else()
+ append("/Zi" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ endif()
# /DEBUG disables linker GC and ICF, but we want those in Release mode.
append("/DEBUG /OPT:REF /OPT:ICF"
CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS
diff --git a/llvm/cmake/modules/LLVMPrecompiledHeaders.cmake b/llvm/cmake/modules/LLVMPrecompiledHeaders.cmake
new file mode 100644
index 0000000000000..ac6efe9e4599a
--- /dev/null
+++ b/llvm/cmake/modules/LLVMPrecompiledHeaders.cmake
@@ -0,0 +1,35 @@
+macro(get_all_targets_recursive targets dir)
+ get_property(subdirectories DIRECTORY ${dir} PROPERTY SUBDIRECTORIES)
+ foreach(subdir ${subdirectories})
+ get_all_targets_recursive(${targets} ${subdir})
+ endforeach()
+
+ get_property(current_targets DIRECTORY ${dir} PROPERTY BUILDSYSTEM_TARGETS)
+ list(APPEND ${targets} ${current_targets})
+endmacro()
+
+function(get_all_targets dir outvar)
+ set(targets)
+ get_all_targets_recursive(targets ${dir})
+ set(${outvar} ${targets} PARENT_SCOPE)
+endfunction()
+
+function(add_llvm_lib_precompiled_headers target)
+ if (LLVM_ENABLE_PRECOMPILED_HEADERS)
+ get_target_property(target_type ${target} TYPE)
+ if (target_type STREQUAL "STATIC_LIBRARY")
+ target_precompile_headers(
+ ${target}
+ PRIVATE
+ "$<$<COMPILE_LANGUAGE:CXX>:${LLVM_MAIN_INCLUDE_DIR}/llvm/PrecompiledHeaders.h>"
+ )
+ endif()
+ endif()
+endfunction()
+
+function(llvm_lib_precompiled_headers)
+ get_all_targets("${LLVM_MAIN_SRC_DIR}/lib" lib_targets)
+ foreach(target ${lib_targets})
+ add_llvm_lib_precompiled_headers(${target})
+ endforeach()
+endfunction()
diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index d33af157543fe..0f61fc1d61133 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -586,11 +586,11 @@ class EnableIfAttr : public Node {
class ObjCProtoName : public Node {
const Node *Ty;
- std::string_view Protocol;
-
friend class PointerType;
public:
+ std::string_view Protocol;
+
ObjCProtoName(const Node *Ty_, std::string_view Protocol_)
: Node(KObjCProtoName), Ty(Ty_), Protocol(Protocol_) {}
diff --git a/llvm/include/llvm/PrecompiledHeaders.h b/llvm/include/llvm/PrecompiledHeaders.h
new file mode 100644
index 0000000000000..58edf5576a57e
--- /dev/null
+++ b/llvm/include/llvm/PrecompiledHeaders.h
@@ -0,0 +1,11 @@
+#pragma once
+
+#include "ADT/ArrayRef.h"
+
+#include "CodeGen/SelectionDAG.h"
+#include "CodeGen/TargetInstrInfo.h"
+
+#include "IR/IntrinsicInst.h"
+#include "IR/PassManager.h"
+
+#include "MC/MCContext.h"
diff --git a/llvm/lib/BinaryFormat/Dwarf.cpp b/llvm/lib/BinaryFormat/Dwarf.cpp
index 7324266172684..9a170db4f3755 100644
--- a/llvm/lib/BinaryFormat/Dwarf.cpp
+++ b/llvm/lib/BinaryFormat/Dwarf.cpp
@@ -579,15 +579,17 @@ StringRef llvm::dwarf::LocListEncodingString(unsigned Encoding) {
}
StringRef llvm::dwarf::CallFrameString(unsigned Encoding,
- Triple::ArchType Arch) {
+ Triple::ArchType Arch) {
assert(Arch != llvm::Triple::ArchType::UnknownArch);
-#define SELECT_AARCH64 (Arch == llvm::Triple::aarch64_be || Arch == llvm::Triple::aarch64)
+#define SELECT_AARCH64 \
+ (Arch == llvm::Triple::aarch64_be || Arch == llvm::Triple::aarch64)
#define SELECT_MIPS64 Arch == llvm::Triple::mips64
-#define SELECT_SPARC (Arch == llvm::Triple::sparc || Arch == llvm::Triple::sparcv9)
+#define SELECT_SPARC \
+ (Arch == llvm::Triple::sparc || Arch == llvm::Triple::sparcv9)
#define SELECT_X86 (Arch == llvm::Triple::x86 || Arch == llvm::Triple::x86_64)
#define HANDLE_DW_CFA(ID, NAME)
-#define HANDLE_DW_CFA_PRED(ID, NAME, PRED) \
- if (ID == Encoding && PRED) \
+#define HANDLE_DW_CFA_PRED(ID, NAME, PRED) \
+ if (ID == Encoding && PRED) \
return "DW_CFA_" #NAME;
#include "llvm/BinaryFormat/Dwarf.def"
@@ -858,9 +860,9 @@ StringRef llvm::dwarf::RLEString(unsigned RLE) {
}
}
-constexpr char llvm::dwarf::EnumTraits<Attribute>::Type[];
-constexpr char llvm::dwarf::EnumTraits<Form>::Type[];
-constexpr char llvm::dwarf::EnumTraits<Index>::Type[];
-constexpr char llvm::dwarf::EnumTraits<Tag>::Type[];
-constexpr char llvm::dwarf::EnumTraits<LineNumberOps>::Type[];
-constexpr char llvm::dwarf::EnumTraits<LocationAtom>::Type[];
+constexpr char llvm::dwarf::EnumTraits<llvm::dwarf::Attribute>::Type[];
+constexpr char llvm::dwarf::EnumTraits<llvm::dwarf::Form>::Type[];
+constexpr char llvm::dwarf::EnumTraits<llvm::dwarf::Index>::Type[];
+constexpr char llvm::dwarf::EnumTraits<llvm::dwarf::Tag>::Type[];
+constexpr char llvm::dwarf::EnumTraits<llvm::dwarf::LineNumberOps>::Type[];
+constexpr char llvm::dwarf::EnumTraits<llvm::dwarf::LocationAtom>::Type[];
diff --git a/llvm/lib/BinaryFormat/MsgPackDocumentYAML.cpp b/llvm/lib/BinaryFormat/MsgPackDocumentYAML.cpp
index 3de3dccce0c6c..3917cd066360c 100644
--- a/llvm/lib/BinaryFormat/MsgPackDocumentYAML.cpp
+++ b/llvm/lib/BinaryFormat/MsgPackDocumentYAML.cpp
@@ -184,18 +184,18 @@ template <> struct TaggedScalarTraits<ScalarDocNode> {
static QuotingType mustQuote(const ScalarDocNode &S, StringRef ScalarStr) {
switch (S.getKind()) {
- case Type::Int:
+ case msgpack::Type::Int:
return ScalarTraits<int64_t>::mustQuote(ScalarStr);
- case Type::UInt:
+ case msgpack::Type::UInt:
return ScalarTraits<uint64_t>::mustQuote(ScalarStr);
- case Type::Nil:
+ case msgpack::Type::Nil:
return ScalarTraits<StringRef>::mustQuote(ScalarStr);
- case Type::Boolean:
+ case msgpack::Type::Boolean:
return ScalarTraits<bool>::mustQuote(ScalarStr);
- case Type::Float:
+ case msgpack::Type::Float:
return ScalarTraits<double>::mustQuote(ScalarStr);
- case Type::Binary:
- case Type::String:
+ case msgpack::Type::Binary:
+ case msgpack::Type::String:
return ScalarTraits<std::string>::mustQuote(ScalarStr);
default:
llvm_unreachable("unrecognized ScalarKind");
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
index ecdbd004efadb..a2b65519e1770 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
@@ -30,9 +30,7 @@ void DWARFAbbreviationDeclaration::clear() {
FixedAttributeSize.reset();
}
-DWARFAbbreviationDeclaration::DWARFAbbreviationDeclaration() {
- clear();
-}
+DWARFAbbreviationDeclaration::DWARFAbbreviationDeclaration() { clear(); }
llvm::Expected<DWARFAbbreviationDeclaration::ExtractState>
DWARFAbbreviationDeclaration::extract(DataExtractor Data, uint64_t *OffsetPtr) {
@@ -68,7 +66,7 @@ DWARFAbbreviationDeclaration::extract(DataExtractor Data, uint64_t *OffsetPtr) {
// Read all of the abbreviation attributes and forms.
while (Data.isValidOffset(*OffsetPtr)) {
- auto A = static_cast<Attribute>(Data.getULEB128(OffsetPtr, &Err));
+ auto A = static_cast<dwarf::Attribute>(Data.getULEB128(OffsetPtr, &Err));
if (Err)
return std::move(Err);
diff --git a/llvm/lib/Object/Minidump.cpp b/llvm/lib/Object/Minidump.cpp
index 6febff89ac519..11c52182d20fd 100644
--- a/llvm/lib/Object/Minidump.cpp
+++ b/llvm/lib/Object/Minidump.cpp
@@ -92,7 +92,7 @@ Expected<ArrayRef<T>> MinidumpFile::getListStream(StreamType Type) const {
return getDataSliceAs<T>(*Stream, ListOffset, ListSize);
}
-template Expected<ArrayRef<Module>>
+template Expected<ArrayRef<minidump::Module>>
MinidumpFile::getListStream(StreamType) const;
template Expected<ArrayRef<Thread>>
MinidumpFile::getListStream(StreamType) const;
diff --git a/llvm/lib/ObjectYAML/MinidumpYAML.cpp b/llvm/lib/ObjectYAML/MinidumpYAML.cpp
index fdbd2d8e6dcbc..a6ff0f57e0d93 100644
--- a/llvm/lib/ObjectYAML/MinidumpYAML.cpp
+++ b/llvm/lib/ObjectYAML/MinidumpYAML.cpp
@@ -44,9 +44,15 @@ static inline void mapOptionalAs(yaml::IO &IO, const char *Key, EndianType &Val,
namespace {
/// Return the appropriate yaml Hex type for a given endian-aware type.
template <typename EndianType> struct HexType;
-template <> struct HexType<support::ulittle16_t> { using type = yaml::Hex16; };
-template <> struct HexType<support::ulittle32_t> { using type = yaml::Hex32; };
-template <> struct HexType<support::ulittle64_t> { using type = yaml::Hex64; };
+template <> struct HexType<support::ulittle16_t> {
+ using type = yaml::Hex16;
+};
+template <> struct HexType<support::ulittle32_t> {
+ using type = yaml::Hex32;
+};
+template <> struct HexType<support::ulittle64_t> {
+ using type = yaml::Hex64;
+};
} // namespace
/// Yaml-map an endian-aware type as an appropriately-sized hex value.
@@ -499,7 +505,7 @@ Stream::create(const Directory &StreamDesc, const object::MinidumpFile &File) {
if (!ExpectedList)
return ExpectedList.takeError();
std::vector<ModuleListStream::entry_type> Modules;
- for (const Module &M : *ExpectedList) {
+ for (const minidump::Module &M : *ExpectedList) {
auto ExpectedName = File.getString(M.ModuleNameRVA);
if (!ExpectedName)
return ExpectedName.takeError();
@@ -516,7 +522,7 @@ Stream::create(const Directory &StreamDesc, const object::MinidumpFile &File) {
}
case StreamKind::RawContent:
return std::make_unique<RawContentStream>(StreamDesc.Type,
- File.getRawStream(StreamDesc));
+ File.getRawStream(StreamDesc));
case StreamKind::SystemInfo: {
auto ExpectedInfo = File.getSystemInfo();
if (!ExpectedInfo)
@@ -525,7 +531,7 @@ Stream::create(const Directory &StreamDesc, const object::MinidumpFile &File) {
if (!ExpectedCSDVersion)
return ExpectedInfo.takeError();
return std::make_unique<SystemInfoStream>(*ExpectedInfo,
- std::move(*ExpectedCSDVersion));
+ std::move(*ExpectedCSDVersion));
}
case StreamKind::TextContent:
return std::make_unique<TextContentStream>(
diff --git a/llvm/lib/Remarks/Remark.cpp b/llvm/lib/Remarks/Remark.cpp
index ef42271a3c8da..3418160f91f40 100644
--- a/llvm/lib/Remarks/Remark.cpp
+++ b/llvm/lib/Remarks/Remark.cpp
@@ -27,14 +27,16 @@ std::string Remark::getArgsAsMsg() const {
}
/// Returns the value of a specified key parsed from StringRef.
-std::optional<int> Argument::getValAsInt() const {
+std::optional<int> llvm::remarks::Argument::getValAsInt() const {
APInt KeyVal;
if (Val.getAsInteger(10, KeyVal))
return std::nullopt;
return KeyVal.getSExtValue();
}
-bool Argument::isValInt() const { return getValAsInt().has_value(); }
+bool llvm::remarks::Argument::isValInt() const {
+ return getValAsInt().has_value();
+}
void RemarkLocation::print(raw_ostream &OS) const {
OS << "{ "
@@ -42,7 +44,7 @@ void RemarkLocation::print(raw_ostream &OS) const {
<< " Column:" << SourceColumn << " }\n";
}
-void Argument::print(raw_ostream &OS) const {
+void llvm::remarks::Argument::print(raw_ostream &OS) const {
OS << Key << ": " << Val << "\n";
}
@@ -146,12 +148,12 @@ extern "C" uint32_t LLVMRemarkEntryGetNumArgs(LLVMRemarkEntryRef Remark) {
extern "C" LLVMRemarkArgRef
LLVMRemarkEntryGetFirstArg(LLVMRemarkEntryRef Remark) {
- ArrayRef<Argument> Args = unwrap(Remark)->Args;
+ ArrayRef<remarks::Argument> Args = unwrap(Remark)->Args;
// No arguments to iterate on.
if (Args.empty())
return nullptr;
return reinterpret_cast<LLVMRemarkArgRef>(
- const_cast<Argument *>(Args.begin()));
+ const_cast<remarks::Argument *>(Args.begin()));
}
extern "C" LLVMRemarkArgRef
@@ -160,10 +162,11 @@ LLVMRemarkEntryGetNextArg(LLVMRemarkArgRef ArgIt, LLVMRemarkEntryRef Remark) {
if (ArgIt == nullptr)
return nullptr;
- auto It = (ArrayRef<Argument>::const_iterator)ArgIt;
+ auto It = (ArrayRef<remarks::Argument>::const_iterator)ArgIt;
auto Next = std::next(It);
if (Next == unwrap(Remark)->Args.end())
return nullptr;
- return reinterpret_cast<LLVMRemarkArgRef>(const_cast<Argument *>(Next));
+ return reinterpret_cast<LLVMRemarkArgRef>(
+ const_cast<remarks::Argument *>(Next));
}
diff --git a/llvm/lib/Remarks/YAMLRemarkParser.cpp b/llvm/lib/Remarks/YAMLRemarkParser.cpp
index a287ef5742556..ff556791573b7 100644
--- a/llvm/lib/Remarks/YAMLRemarkParser.cpp
+++ b/llvm/lib/Remarks/YAMLRemarkParser.cpp
@@ -157,9 +157,8 @@ Expected<std::unique_ptr<YAMLRemarkParser>> remarks::createYAMLParserFromMeta(
}
std::unique_ptr<YAMLRemarkParser> Result =
- StrTab
- ? std::make_unique<YAMLStrTabRemarkParser>(Buf, std::move(*StrTab))
- : std::make_unique<YAMLRemarkParser>(Buf);
+ StrTab ? std::make_unique<YAMLStrTabRemarkParser>(Buf, std::move(*StrTab))
+ : std::make_unique<YAMLRemarkParser>(Buf);
if (SeparateBuf)
Result->SeparateBuf = std::move(SeparateBuf);
return std::move(Result);
@@ -260,15 +259,16 @@ YAMLRemarkParser::parseRemark(yaml::Document &RemarkEntry) {
}
// Check if any of the mandatory fields are missing.
- if (TheRemark.RemarkType == Type::Unknown || TheRemark.PassName.empty() ||
- TheRemark.RemarkName.empty() || TheRemark.FunctionName.empty())
+ if (TheRemark.RemarkType == remarks::Type::Unknown ||
+ TheRemark.PassName.empty() || TheRemark.RemarkName.empty() ||
+ TheRemark.FunctionName.empty())
return error("Type, Pass, Name or Function missing.",
*RemarkEntry.getRoot());
return std::move(Result);
}
-Expected<Type> YAMLRemarkParser::parseType(yaml::MappingNode &Node) {
+Expected<remarks::Type> YAMLRemarkParser::parseType(yaml::MappingNode &Node) {
auto Type = StringSwitch<remarks::Type>(Node.getRawTag())
.Case("!Passed", remarks::Type::Passed)
.Case("!Missed", remarks::Type::Missed)
@@ -362,7 +362,7 @@ YAMLRemarkParser::parseDebugLoc(yaml::KeyValueNode &Node) {
return RemarkLocation{*File, *Line, *Column};
}
-Expected<Argument> YAMLRemarkParser::parseArg(yaml::Node &Node) {
+Expected<remarks::Argument> YAMLRemarkParser::parseArg(yaml::Node &Node) {
auto *ArgMap = dyn_cast<yaml::MappingNode>(&Node);
if (!ArgMap)
return error("expected a value of mapping type.", Node);
diff --git a/llvm/lib/Remarks/YAMLRemarkSerializer.cpp b/llvm/lib/Remarks/YAMLRemarkSerializer.cpp
index 68285c3dde1bf..b87151040d50d 100644
--- a/llvm/lib/Remarks/YAMLRemarkSerializer.cpp
+++ b/llvm/lib/Remarks/YAMLRemarkSerializer.cpp
@@ -25,7 +25,7 @@ template <typename T>
static void mapRemarkHeader(yaml::IO &io, T PassName, T RemarkName,
std::optional<RemarkLocation> RL, T FunctionName,
std::optional<uint64_t> Hotness,
- ArrayRef<Argument> Args) {
+ ArrayRef<remarks::Argument> Args) {
io.mapRequired("Pass", PassName);
io.mapRequired("Name", RemarkName);
io.mapOptional("DebugLoc", RL);
@@ -41,19 +41,23 @@ template <> struct MappingTraits<remarks::Remark *> {
static void mapping(IO &io, remarks::Remark *&Remark) {
assert(io.outputting() && "input not yet implemented");
- if (io.mapTag("!Passed", (Remark->RemarkType == Type::Passed)))
+ if (io.mapTag("!Passed", (Remark->RemarkType == remarks::Type::Passed)))
;
- else if (io.mapTag("!Missed", (Remark->RemarkType == Type::Missed)))
+ else if (io.mapTag("!Missed",
+ (Remark->RemarkType == remarks::Type::Missed)))
;
- else if (io.mapTag("!Analysis", (Remark->RemarkType == Type::Analysis)))
+ else if (io.mapTag("!Analysis",
+ (Remark->RemarkType == remarks::Type::Analysis)))
;
- else if (io.mapTag("!AnalysisFPCommute",
- (Remark->RemarkType == Type::AnalysisFPCommute)))
+ else if (io.mapTag(
+ "!AnalysisFPCommute",
+ (Remark->RemarkType == remarks::Type::AnalysisFPCommute)))
;
else if (io.mapTag("!AnalysisAliasing",
- (Remark->RemarkType == Type::AnalysisAliasing)))
+ (Remark->RemarkType == remarks::Type::AnalysisAliasing)))
;
- else if (io.mapTag("!Failure", (Remark->RemarkType == Type::Failure)))
+ else if (io.mapTag("!Failure",
+ (Remark->RemarkType == remarks::Type::Failure)))
;
else
llvm_unreachable("Unknown remark type");
@@ -124,7 +128,7 @@ template <> struct BlockScalarTraits<StringBlockVal> {
/// Keep this in this file so that it doesn't get misused from YAMLTraits.h.
template <typename T> struct SequenceTraits<ArrayRef<T>> {
static size_t size(IO &io, ArrayRef<T> &seq) { return seq.size(); }
- static Argument &element(IO &io, ArrayRef<T> &seq, size_t index) {
+ static remarks::Argument &element(IO &io, ArrayRef<T> &seq, size_t index) {
assert(io.outputting() && "input not yet implemented");
// The assert above should make this "safer" to satisfy the YAMLTraits.
return const_cast<T &>(seq[index]);
@@ -132,8 +136,8 @@ template <typename T> struct SequenceTraits<ArrayRef<T>> {
};
/// Implement this as a mapping for now to get proper quotation for the value.
-template <> struct MappingTraits<Argument> {
- static void mapping(IO &io, Argument &A) {
+template <> struct MappingTraits<remarks::Argument> {
+ static void mapping(IO &io, remarks::Argument &A) {
assert(io.outputting() && "input not yet implemented");
if (auto *Serializer = dyn_cast<YAMLStrTabRemarkSerializer>(
@@ -155,7 +159,7 @@ template <> struct MappingTraits<Argument> {
} // end namespace yaml
} // end namespace llvm
-LLVM_YAML_IS_SEQUENCE_VECTOR(Argument)
+LLVM_YAML_IS_SEQUENCE_VECTOR(remarks::Argument)
YAMLRemarkSerializer::YAMLRemarkSerializer(raw_ostream &OS, SerializerMode Mode,
std::optional<StringTable> StrTabIn)
diff --git a/llvm/lib/TargetParser/X86TargetParser.cpp b/llvm/lib/TargetParser/X86TargetParser.cpp
index 21f46f576490a..c79f443c039dc 100644
--- a/llvm/lib/TargetParser/X86TargetParser.cpp
+++ b/llvm/lib/TargetParser/X86TargetParser.cpp
@@ -20,20 +20,20 @@ using namespace llvm::X86;
namespace {
-using FeatureBitset = Bitset<X86::CPU_FEATURE_MAX>;
+using X86FeatureBitset = Bitset<X86::CPU_FEATURE_MAX>;
struct ProcInfo {
StringLiteral Name;
X86::CPUKind Kind;
unsigned KeyFeature;
- FeatureBitset Features;
+ X86FeatureBitset Features;
char Mangling;
bool OnlyForCPUDispatchSpecific;
};
struct FeatureInfo {
StringLiteral NameWithPlus;
- FeatureBitset ImpliedFeatures;
+ X86FeatureBitset ImpliedFeatures;
StringRef getName(bool WithPlus = false) const {
assert(NameWithPlus[0] == '+' && "Expected string to start with '+'");
@@ -46,176 +46,176 @@ struct FeatureInfo {
} // end anonymous namespace
#define X86_FEATURE(ENUM, STRING) \
- constexpr FeatureBitset Feature##ENUM = {X86::FEATURE_##ENUM};
+ constexpr X86FeatureBitset Feature##ENUM = {X86::FEATURE_##ENUM};
#include "llvm/TargetParser/X86TargetParser.def"
// Pentium with MMX.
-constexpr FeatureBitset FeaturesPentiumMMX =
+constexpr X86FeatureBitset FeaturesPentiumMMX =
FeatureX87 | FeatureCMPXCHG8B | FeatureMMX;
// Pentium 2 and 3.
-constexpr FeatureBitset FeaturesPentium2 =
+constexpr X86FeatureBitset FeaturesPentium2 =
FeatureX87 | FeatureCMPXCHG8B | FeatureMMX | FeatureFXSR | FeatureCMOV;
-constexpr FeatureBitset FeaturesPentium3 = FeaturesPentium2 | FeatureSSE;
+constexpr X86FeatureBitset FeaturesPentium3 = FeaturesPentium2 | FeatureSSE;
// Pentium 4 CPUs
-constexpr FeatureBitset FeaturesPentium4 = FeaturesPentium3 | FeatureSSE2;
-constexpr FeatureBitset FeaturesPrescott = FeaturesPentium4 | FeatureSSE3;
-constexpr FeatureBitset FeaturesNocona =
+constexpr X86FeatureBitset FeaturesPentium4 = FeaturesPentium3 | FeatureSSE2;
+constexpr X86FeatureBitset FeaturesPrescott = FeaturesPentium4 | FeatureSSE3;
+constexpr X86FeatureBitset FeaturesNocona =
FeaturesPrescott | Feature64BIT | FeatureCMPXCHG16B;
// Basic 64-bit capable CPU.
-constexpr FeatureBitset FeaturesX86_64 = FeaturesPentium4 | Feature64BIT;
-constexpr FeatureBitset FeaturesX86_64_V2 = FeaturesX86_64 | FeatureSAHF |
+constexpr X86FeatureBitset FeaturesX86_64 = FeaturesPentium4 | Feature64BIT;
+constexpr X86FeatureBitset FeaturesX86_64_V2 = FeaturesX86_64 | FeatureSAHF |
FeaturePOPCNT | FeatureCRC32 |
FeatureSSE4_2 | FeatureCMPXCHG16B;
-constexpr FeatureBitset FeaturesX86_64_V3 =
+constexpr X86FeatureBitset FeaturesX86_64_V3 =
FeaturesX86_64_V2 | FeatureAVX2 | FeatureBMI | FeatureBMI2 | FeatureF16C |
FeatureFMA | FeatureLZCNT | FeatureMOVBE | FeatureXSAVE;
-constexpr FeatureBitset FeaturesX86_64_V4 = FeaturesX86_64_V3 | FeatureEVEX512 |
+constexpr X86FeatureBitset FeaturesX86_64_V4 = FeaturesX86_64_V3 | FeatureEVEX512 |
FeatureAVX512BW | FeatureAVX512CD |
FeatureAVX512DQ | FeatureAVX512VL;
// Intel Core CPUs
-constexpr FeatureBitset FeaturesCore2 =
+constexpr X86FeatureBitset FeaturesCore2 =
FeaturesNocona | FeatureSAHF | FeatureSSSE3;
-constexpr FeatureBitset FeaturesPenryn = FeaturesCore2 | FeatureSSE4_1;
-constexpr FeatureBitset FeaturesNehalem =
+constexpr X86FeatureBitset FeaturesPenryn = FeaturesCore2 | FeatureSSE4_1;
+constexpr X86FeatureBitset FeaturesNehalem =
FeaturesPenryn | FeaturePOPCNT | FeatureCRC32 | FeatureSSE4_2;
-constexpr FeatureBitset FeaturesWestmere = FeaturesNehalem | FeaturePCLMUL;
-constexpr FeatureBitset FeaturesSandyBridge =
+constexpr X86FeatureBitset FeaturesWestmere = FeaturesNehalem | FeaturePCLMUL;
+constexpr X86FeatureBitset FeaturesSandyBridge =
FeaturesWestmere | FeatureAVX | FeatureXSAVE | FeatureXSAVEOPT;
-constexpr FeatureBitset FeaturesIvyBridge =
+constexpr X86FeatureBitset FeaturesIvyBridge =
FeaturesSandyBridge | FeatureF16C | FeatureFSGSBASE | FeatureRDRND;
-constexpr FeatureBitset FeaturesHaswell =
+constexpr X86FeatureBitset FeaturesHaswell =
FeaturesIvyBridge | FeatureAVX2 | FeatureBMI | FeatureBMI2 | FeatureFMA |
FeatureINVPCID | FeatureLZCNT | FeatureMOVBE;
-constexpr FeatureBitset FeaturesBroadwell =
+constexpr X86FeatureBitset FeaturesBroadwell =
FeaturesHaswell | FeatureADX | FeaturePRFCHW | FeatureRDSEED;
// Intel Knights Landing and Knights Mill
// Knights Landing has feature parity with Broadwell.
-constexpr FeatureBitset FeaturesKNL =
+constexpr X86FeatureBitset FeaturesKNL =
FeaturesBroadwell | FeatureAES | FeatureAVX512F | FeatureEVEX512 |
FeatureAVX512CD | FeatureAVX512ER | FeatureAVX512PF | FeaturePREFETCHWT1;
-constexpr FeatureBitset FeaturesKNM = FeaturesKNL | FeatureAVX512VPOPCNTDQ;
+constexpr X86FeatureBitset FeaturesKNM = FeaturesKNL | FeatureAVX512VPOPCNTDQ;
// Intel Skylake processors.
-constexpr FeatureBitset FeaturesSkylakeClient =
+constexpr X86FeatureBitset FeaturesSkylakeClient =
FeaturesBroadwell | FeatureAES | FeatureCLFLUSHOPT | FeatureXSAVEC |
FeatureXSAVES | FeatureSGX;
// SkylakeServer inherits all SkylakeClient features except SGX.
// FIXME: That doesn't match gcc.
-constexpr FeatureBitset FeaturesSkylakeServer =
+constexpr X86FeatureBitset FeaturesSkylakeServer =
(FeaturesSkylakeClient & ~FeatureSGX) | FeatureAVX512F | FeatureEVEX512 |
FeatureAVX512CD | FeatureAVX512DQ | FeatureAVX512BW | FeatureAVX512VL |
FeatureCLWB | FeaturePKU;
-constexpr FeatureBitset FeaturesCascadeLake =
+constexpr X86FeatureBitset FeaturesCascadeLake =
FeaturesSkylakeServer | FeatureAVX512VNNI;
-constexpr FeatureBitset FeaturesCooperLake =
+constexpr X86FeatureBitset FeaturesCooperLake =
FeaturesCascadeLake | FeatureAVX512BF16;
// Intel 10nm processors.
-constexpr FeatureBitset FeaturesCannonlake =
+constexpr X86FeatureBitset FeaturesCannonlake =
FeaturesSkylakeClient | FeatureAVX512F | FeatureEVEX512 | FeatureAVX512CD |
FeatureAVX512DQ | FeatureAVX512BW | FeatureAVX512VL | FeatureAVX512IFMA |
FeatureAVX512VBMI | FeaturePKU | FeatureSHA;
-constexpr FeatureBitset FeaturesICLClient =
+constexpr X86FeatureBitset FeaturesICLClient =
FeaturesCannonlake | FeatureAVX512BITALG | FeatureAVX512VBMI2 |
FeatureAVX512VNNI | FeatureAVX512VPOPCNTDQ | FeatureGFNI | FeatureRDPID |
FeatureVAES | FeatureVPCLMULQDQ;
-constexpr FeatureBitset FeaturesRocketlake = FeaturesICLClient & ~FeatureSGX;
-constexpr FeatureBitset FeaturesICLServer =
+constexpr X86FeatureBitset FeaturesRocketlake = FeaturesICLClient & ~FeatureSGX;
+constexpr X86FeatureBitset FeaturesICLServer =
FeaturesICLClient | FeatureCLWB | FeaturePCONFIG | FeatureWBNOINVD;
-constexpr FeatureBitset FeaturesTigerlake =
+constexpr X86FeatureBitset FeaturesTigerlake =
FeaturesICLClient | FeatureAVX512VP2INTERSECT | FeatureMOVDIR64B |
FeatureCLWB | FeatureMOVDIRI | FeatureSHSTK | FeatureKL | FeatureWIDEKL;
-constexpr FeatureBitset FeaturesSapphireRapids =
+constexpr X86FeatureBitset FeaturesSapphireRapids =
FeaturesICLServer | FeatureAMX_BF16 | FeatureAMX_INT8 | FeatureAMX_TILE |
FeatureAVX512BF16 | FeatureAVX512FP16 | FeatureAVXVNNI | FeatureCLDEMOTE |
FeatureENQCMD | FeatureMOVDIR64B | FeatureMOVDIRI | FeaturePTWRITE |
FeatureSERIALIZE | FeatureSHSTK | FeatureTSXLDTRK | FeatureUINTR |
FeatureWAITPKG;
-constexpr FeatureBitset FeaturesGraniteRapids =
+constexpr X86FeatureBitset FeaturesGraniteRapids =
FeaturesSapphireRapids | FeatureAMX_FP16 | FeaturePREFETCHI;
// Intel Atom processors.
// Bonnell has feature parity with Core2 and adds MOVBE.
-constexpr FeatureBitset FeaturesBonnell = FeaturesCore2 | FeatureMOVBE;
+constexpr X86FeatureBitset FeaturesBonnell = FeaturesCore2 | FeatureMOVBE;
// Silvermont has parity with Westmere and Bonnell plus PRFCHW and RDRND.
-constexpr FeatureBitset FeaturesSilvermont =
+constexpr X86FeatureBitset FeaturesSilvermont =
FeaturesBonnell | FeaturesWestmere | FeaturePRFCHW | FeatureRDRND;
-constexpr FeatureBitset FeaturesGoldmont =
+constexpr X86FeatureBitset FeaturesGoldmont =
FeaturesSilvermont | FeatureAES | FeatureCLFLUSHOPT | FeatureFSGSBASE |
FeatureRDSEED | FeatureSHA | FeatureXSAVE | FeatureXSAVEC |
FeatureXSAVEOPT | FeatureXSAVES;
-constexpr FeatureBitset FeaturesGoldmontPlus =
+constexpr X86FeatureBitset FeaturesGoldmontPlus =
FeaturesGoldmont | FeaturePTWRITE | FeatureRDPID | FeatureSGX;
-constexpr FeatureBitset FeaturesTremont =
+constexpr X86FeatureBitset FeaturesTremont =
FeaturesGoldmontPlus | FeatureCLWB | FeatureGFNI;
-constexpr FeatureBitset FeaturesAlderlake =
+constexpr X86FeatureBitset FeaturesAlderlake =
FeaturesTremont | FeatureADX | FeatureBMI | FeatureBMI2 | FeatureF16C |
FeatureFMA | FeatureINVPCID | FeatureLZCNT | FeaturePCONFIG | FeaturePKU |
FeatureSERIALIZE | FeatureSHSTK | FeatureVAES | FeatureVPCLMULQDQ |
FeatureCLDEMOTE | FeatureMOVDIR64B | FeatureMOVDIRI | FeatureWAITPKG |
FeatureAVXVNNI | FeatureHRESET | FeatureWIDEKL;
-constexpr FeatureBitset FeaturesSierraforest =
+constexpr X86FeatureBitset FeaturesSierraforest =
FeaturesAlderlake | FeatureCMPCCXADD | FeatureAVXIFMA | FeatureUINTR |
FeatureENQCMD | FeatureAVXNECONVERT | FeatureAVXVNNIINT8;
-constexpr FeatureBitset FeaturesArrowlakeS = FeaturesSierraforest |
+constexpr X86FeatureBitset FeaturesArrowlakeS = FeaturesSierraforest |
FeatureAVXVNNIINT16 | FeatureSHA512 | FeatureSM3 | FeatureSM4;
-constexpr FeatureBitset FeaturesPantherlake =
+constexpr X86FeatureBitset FeaturesPantherlake =
FeaturesArrowlakeS | FeaturePREFETCHI;
-constexpr FeatureBitset FeaturesClearwaterforest =
+constexpr X86FeatureBitset FeaturesClearwaterforest =
FeaturesArrowlakeS | FeatureUSERMSR | FeaturePREFETCHI;
// Geode Processor.
-constexpr FeatureBitset FeaturesGeode =
+constexpr X86FeatureBitset FeaturesGeode =
FeatureX87 | FeatureCMPXCHG8B | FeatureMMX | Feature3DNOW | Feature3DNOWA;
// K6 processor.
-constexpr FeatureBitset FeaturesK6 = FeatureX87 | FeatureCMPXCHG8B | FeatureMMX;
+constexpr X86FeatureBitset FeaturesK6 = FeatureX87 | FeatureCMPXCHG8B | FeatureMMX;
// K7 and K8 architecture processors.
-constexpr FeatureBitset FeaturesAthlon =
+constexpr X86FeatureBitset FeaturesAthlon =
FeatureX87 | FeatureCMPXCHG8B | FeatureMMX | Feature3DNOW | Feature3DNOWA;
-constexpr FeatureBitset FeaturesAthlonXP =
+constexpr X86FeatureBitset FeaturesAthlonXP =
FeaturesAthlon | FeatureFXSR | FeatureSSE;
-constexpr FeatureBitset FeaturesK8 =
+constexpr X86FeatureBitset FeaturesK8 =
FeaturesAthlonXP | FeatureSSE2 | Feature64BIT;
-constexpr FeatureBitset FeaturesK8SSE3 = FeaturesK8 | FeatureSSE3;
-constexpr FeatureBitset FeaturesAMDFAM10 =
+constexpr X86FeatureBitset FeaturesK8SSE3 = FeaturesK8 | FeatureSSE3;
+constexpr X86FeatureBitset FeaturesAMDFAM10 =
FeaturesK8SSE3 | FeatureCMPXCHG16B | FeatureLZCNT | FeaturePOPCNT |
FeaturePRFCHW | FeatureSAHF | FeatureSSE4_A;
// Bobcat architecture processors.
-constexpr FeatureBitset FeaturesBTVER1 =
+constexpr X86FeatureBitset FeaturesBTVER1 =
FeatureX87 | FeatureCMPXCHG8B | FeatureCMPXCHG16B | Feature64BIT |
FeatureFXSR | FeatureLZCNT | FeatureMMX | FeaturePOPCNT | FeaturePRFCHW |
FeatureSSE | FeatureSSE2 | FeatureSSE3 | FeatureSSSE3 | FeatureSSE4_A |
FeatureSAHF;
-constexpr FeatureBitset FeaturesBTVER2 =
+constexpr X86FeatureBitset FeaturesBTVER2 =
FeaturesBTVER1 | FeatureAES | FeatureAVX | FeatureBMI | FeatureCRC32 |
FeatureF16C | FeatureMOVBE | FeaturePCLMUL | FeatureXSAVE | FeatureXSAVEOPT;
// AMD Bulldozer architecture processors.
-constexpr FeatureBitset FeaturesBDVER1 =
+constexpr X86FeatureBitset FeaturesBDVER1 =
FeatureX87 | FeatureAES | FeatureAVX | FeatureCMPXCHG8B |
FeatureCMPXCHG16B | FeatureCRC32 | Feature64BIT | FeatureFMA4 |
FeatureFXSR | FeatureLWP | FeatureLZCNT | FeatureMMX | FeaturePCLMUL |
FeaturePOPCNT | FeaturePRFCHW | FeatureSAHF | FeatureSSE | FeatureSSE2 |
FeatureSSE3 | FeatureSSSE3 | FeatureSSE4_1 | FeatureSSE4_2 | FeatureSSE4_A |
FeatureXOP | FeatureXSAVE;
-constexpr FeatureBitset FeaturesBDVER2 =
+constexpr X86FeatureBitset FeaturesBDVER2 =
FeaturesBDVER1 | FeatureBMI | FeatureFMA | FeatureF16C | FeatureTBM;
-constexpr FeatureBitset FeaturesBDVER3 =
+constexpr X86FeatureBitset FeaturesBDVER3 =
FeaturesBDVER2 | FeatureFSGSBASE | FeatureXSAVEOPT;
-constexpr FeatureBitset FeaturesBDVER4 = FeaturesBDVER3 | FeatureAVX2 |
+constexpr X86FeatureBitset FeaturesBDVER4 = FeaturesBDVER3 | FeatureAVX2 |
FeatureBMI2 | FeatureMOVBE |
FeatureMWAITX | FeatureRDRND;
// AMD Zen architecture processors.
-constexpr FeatureBitset FeaturesZNVER1 =
+constexpr X86FeatureBitset FeaturesZNVER1 =
FeatureX87 | FeatureADX | FeatureAES | FeatureAVX | FeatureAVX2 |
FeatureBMI | FeatureBMI2 | FeatureCLFLUSHOPT | FeatureCLZERO |
FeatureCMPXCHG8B | FeatureCMPXCHG16B | FeatureCRC32 | Feature64BIT |
@@ -225,13 +225,13 @@ constexpr FeatureBitset FeaturesZNVER1 =
FeatureSSE | FeatureSSE2 | FeatureSSE3 | FeatureSSSE3 | FeatureSSE4_1 |
FeatureSSE4_2 | FeatureSSE4_A | FeatureXSAVE | FeatureXSAVEC |
FeatureXSAVEOPT | FeatureXSAVES;
-constexpr FeatureBitset FeaturesZNVER2 = FeaturesZNVER1 | FeatureCLWB |
+constexpr X86FeatureBitset FeaturesZNVER2 = FeaturesZNVER1 | FeatureCLWB |
FeatureRDPID | FeatureRDPRU |
FeatureWBNOINVD;
-static constexpr FeatureBitset FeaturesZNVER3 = FeaturesZNVER2 |
+static constexpr X86FeatureBitset FeaturesZNVER3 = FeaturesZNVER2 |
FeatureINVPCID | FeaturePKU |
FeatureVAES | FeatureVPCLMULQDQ;
-static constexpr FeatureBitset FeaturesZNVER4 =
+static constexpr X86FeatureBitset FeaturesZNVER4 =
FeaturesZNVER3 | FeatureAVX512F | FeatureEVEX512 | FeatureAVX512CD |
FeatureAVX512DQ | FeatureAVX512BW | FeatureAVX512VL | FeatureAVX512IFMA |
FeatureAVX512VBMI | FeatureAVX512VBMI2 | FeatureAVX512VNNI |
@@ -475,164 +475,164 @@ ProcessorFeatures llvm::X86::getKeyFeature(X86::CPUKind Kind) {
}
// Features with no dependencies.
-constexpr FeatureBitset ImpliedFeatures64BIT = {};
-constexpr FeatureBitset ImpliedFeaturesADX = {};
-constexpr FeatureBitset ImpliedFeaturesBMI = {};
-constexpr FeatureBitset ImpliedFeaturesBMI2 = {};
-constexpr FeatureBitset ImpliedFeaturesCLDEMOTE = {};
-constexpr FeatureBitset ImpliedFeaturesCLFLUSHOPT = {};
-constexpr FeatureBitset ImpliedFeaturesCLWB = {};
-constexpr FeatureBitset ImpliedFeaturesCLZERO = {};
-constexpr FeatureBitset ImpliedFeaturesCMOV = {};
-constexpr FeatureBitset ImpliedFeaturesCMPXCHG16B = {};
-constexpr FeatureBitset ImpliedFeaturesCMPXCHG8B = {};
-constexpr FeatureBitset ImpliedFeaturesCRC32 = {};
-constexpr FeatureBitset ImpliedFeaturesENQCMD = {};
-constexpr FeatureBitset ImpliedFeaturesFSGSBASE = {};
-constexpr FeatureBitset ImpliedFeaturesFXSR = {};
-constexpr FeatureBitset ImpliedFeaturesINVPCID = {};
-constexpr FeatureBitset ImpliedFeaturesLWP = {};
-constexpr FeatureBitset ImpliedFeaturesLZCNT = {};
-constexpr FeatureBitset ImpliedFeaturesMWAITX = {};
-constexpr FeatureBitset ImpliedFeaturesMOVBE = {};
-constexpr FeatureBitset ImpliedFeaturesMOVDIR64B = {};
-constexpr FeatureBitset ImpliedFeaturesMOVDIRI = {};
-constexpr FeatureBitset ImpliedFeaturesPCONFIG = {};
-constexpr FeatureBitset ImpliedFeaturesPOPCNT = {};
-constexpr FeatureBitset ImpliedFeaturesPKU = {};
-constexpr FeatureBitset ImpliedFeaturesPREFETCHWT1 = {};
-constexpr FeatureBitset ImpliedFeaturesPRFCHW = {};
-constexpr FeatureBitset ImpliedFeaturesPTWRITE = {};
-constexpr FeatureBitset ImpliedFeaturesRDPID = {};
-constexpr FeatureBitset ImpliedFeaturesRDPRU = {};
-constexpr FeatureBitset ImpliedFeaturesRDRND = {};
-constexpr FeatureBitset ImpliedFeaturesRDSEED = {};
-constexpr FeatureBitset ImpliedFeaturesRTM = {};
-constexpr FeatureBitset ImpliedFeaturesSAHF = {};
-constexpr FeatureBitset ImpliedFeaturesSERIALIZE = {};
-constexpr FeatureBitset ImpliedFeaturesSGX = {};
-constexpr FeatureBitset ImpliedFeaturesSHSTK = {};
-constexpr FeatureBitset ImpliedFeaturesTBM = {};
-constexpr FeatureBitset ImpliedFeaturesTSXLDTRK = {};
-constexpr FeatureBitset ImpliedFeaturesUINTR = {};
-constexpr FeatureBitset ImpliedFeaturesUSERMSR = {};
-constexpr FeatureBitset ImpliedFeaturesWAITPKG = {};
-constexpr FeatureBitset ImpliedFeaturesWBNOINVD = {};
-constexpr FeatureBitset ImpliedFeaturesVZEROUPPER = {};
-constexpr FeatureBitset ImpliedFeaturesX87 = {};
-constexpr FeatureBitset ImpliedFeaturesXSAVE = {};
+constexpr X86FeatureBitset ImpliedFeatures64BIT = {};
+constexpr X86FeatureBitset ImpliedFeaturesADX = {};
+constexpr X86FeatureBitset ImpliedFeaturesBMI = {};
+constexpr X86FeatureBitset ImpliedFeaturesBMI2 = {};
+constexpr X86FeatureBitset ImpliedFeaturesCLDEMOTE = {};
+constexpr X86FeatureBitset ImpliedFeaturesCLFLUSHOPT = {};
+constexpr X86FeatureBitset ImpliedFeaturesCLWB = {};
+constexpr X86FeatureBitset ImpliedFeaturesCLZERO = {};
+constexpr X86FeatureBitset ImpliedFeaturesCMOV = {};
+constexpr X86FeatureBitset ImpliedFeaturesCMPXCHG16B = {};
+constexpr X86FeatureBitset ImpliedFeaturesCMPXCHG8B = {};
+constexpr X86FeatureBitset ImpliedFeaturesCRC32 = {};
+constexpr X86FeatureBitset ImpliedFeaturesENQCMD = {};
+constexpr X86FeatureBitset ImpliedFeaturesFSGSBASE = {};
+constexpr X86FeatureBitset ImpliedFeaturesFXSR = {};
+constexpr X86FeatureBitset ImpliedFeaturesINVPCID = {};
+constexpr X86FeatureBitset ImpliedFeaturesLWP = {};
+constexpr X86FeatureBitset ImpliedFeaturesLZCNT = {};
+constexpr X86FeatureBitset ImpliedFeaturesMWAITX = {};
+constexpr X86FeatureBitset ImpliedFeaturesMOVBE = {};
+constexpr X86FeatureBitset ImpliedFeaturesMOVDIR64B = {};
+constexpr X86FeatureBitset ImpliedFeaturesMOVDIRI = {};
+constexpr X86FeatureBitset ImpliedFeaturesPCONFIG = {};
+constexpr X86FeatureBitset ImpliedFeaturesPOPCNT = {};
+constexpr X86FeatureBitset ImpliedFeaturesPKU = {};
+constexpr X86FeatureBitset ImpliedFeaturesPREFETCHWT1 = {};
+constexpr X86FeatureBitset ImpliedFeaturesPRFCHW = {};
+constexpr X86FeatureBitset ImpliedFeaturesPTWRITE = {};
+constexpr X86FeatureBitset ImpliedFeaturesRDPID = {};
+constexpr X86FeatureBitset ImpliedFeaturesRDPRU = {};
+constexpr X86FeatureBitset ImpliedFeaturesRDRND = {};
+constexpr X86FeatureBitset ImpliedFeaturesRDSEED = {};
+constexpr X86FeatureBitset ImpliedFeaturesRTM = {};
+constexpr X86FeatureBitset ImpliedFeaturesSAHF = {};
+constexpr X86FeatureBitset ImpliedFeaturesSERIALIZE = {};
+constexpr X86FeatureBitset ImpliedFeaturesSGX = {};
+constexpr X86FeatureBitset ImpliedFeaturesSHSTK = {};
+constexpr X86FeatureBitset ImpliedFeaturesTBM = {};
+constexpr X86FeatureBitset ImpliedFeaturesTSXLDTRK = {};
+constexpr X86FeatureBitset ImpliedFeaturesUINTR = {};
+constexpr X86FeatureBitset ImpliedFeaturesUSERMSR = {};
+constexpr X86FeatureBitset ImpliedFeaturesWAITPKG = {};
+constexpr X86FeatureBitset ImpliedFeaturesWBNOINVD = {};
+constexpr X86FeatureBitset ImpliedFeaturesVZEROUPPER = {};
+constexpr X86FeatureBitset ImpliedFeaturesX87 = {};
+constexpr X86FeatureBitset ImpliedFeaturesXSAVE = {};
// Not really CPU features, but need to be in the table because clang uses
// target features to communicate them to the backend.
-constexpr FeatureBitset ImpliedFeaturesRETPOLINE_EXTERNAL_THUNK = {};
-constexpr FeatureBitset ImpliedFeaturesRETPOLINE_INDIRECT_BRANCHES = {};
-constexpr FeatureBitset ImpliedFeaturesRETPOLINE_INDIRECT_CALLS = {};
-constexpr FeatureBitset ImpliedFeaturesLVI_CFI = {};
-constexpr FeatureBitset ImpliedFeaturesLVI_LOAD_HARDENING = {};
+constexpr X86FeatureBitset ImpliedFeaturesRETPOLINE_EXTERNAL_THUNK = {};
+constexpr X86FeatureBitset ImpliedFeaturesRETPOLINE_INDIRECT_BRANCHES = {};
+constexpr X86FeatureBitset ImpliedFeaturesRETPOLINE_INDIRECT_CALLS = {};
+constexpr X86FeatureBitset ImpliedFeaturesLVI_CFI = {};
+constexpr X86FeatureBitset ImpliedFeaturesLVI_LOAD_HARDENING = {};
// XSAVE features are dependent on basic XSAVE.
-constexpr FeatureBitset ImpliedFeaturesXSAVEC = FeatureXSAVE;
-constexpr FeatureBitset ImpliedFeaturesXSAVEOPT = FeatureXSAVE;
-constexpr FeatureBitset ImpliedFeaturesXSAVES = FeatureXSAVE;
+constexpr X86FeatureBitset ImpliedFeaturesXSAVEC = FeatureXSAVE;
+constexpr X86FeatureBitset ImpliedFeaturesXSAVEOPT = FeatureXSAVE;
+constexpr X86FeatureBitset ImpliedFeaturesXSAVES = FeatureXSAVE;
// MMX->3DNOW->3DNOWA chain.
-constexpr FeatureBitset ImpliedFeaturesMMX = {};
-constexpr FeatureBitset ImpliedFeatures3DNOW = FeatureMMX;
-constexpr FeatureBitset ImpliedFeatures3DNOWA = Feature3DNOW;
+constexpr X86FeatureBitset ImpliedFeaturesMMX = {};
+constexpr X86FeatureBitset ImpliedFeatures3DNOW = FeatureMMX;
+constexpr X86FeatureBitset ImpliedFeatures3DNOWA = Feature3DNOW;
// SSE/AVX/AVX512F chain.
-constexpr FeatureBitset ImpliedFeaturesSSE = {};
-constexpr FeatureBitset ImpliedFeaturesSSE2 = FeatureSSE;
-constexpr FeatureBitset ImpliedFeaturesSSE3 = FeatureSSE2;
-constexpr FeatureBitset ImpliedFeaturesSSSE3 = FeatureSSE3;
-constexpr FeatureBitset ImpliedFeaturesSSE4_1 = FeatureSSSE3;
-constexpr FeatureBitset ImpliedFeaturesSSE4_2 = FeatureSSE4_1;
-constexpr FeatureBitset ImpliedFeaturesAVX = FeatureSSE4_2;
-constexpr FeatureBitset ImpliedFeaturesAVX2 = FeatureAVX;
-constexpr FeatureBitset ImpliedFeaturesEVEX512 = {};
-constexpr FeatureBitset ImpliedFeaturesAVX512F =
+constexpr X86FeatureBitset ImpliedFeaturesSSE = {};
+constexpr X86FeatureBitset ImpliedFeaturesSSE2 = FeatureSSE;
+constexpr X86FeatureBitset ImpliedFeaturesSSE3 = FeatureSSE2;
+constexpr X86FeatureBitset ImpliedFeaturesSSSE3 = FeatureSSE3;
+constexpr X86FeatureBitset ImpliedFeaturesSSE4_1 = FeatureSSSE3;
+constexpr X86FeatureBitset ImpliedFeaturesSSE4_2 = FeatureSSE4_1;
+constexpr X86FeatureBitset ImpliedFeaturesAVX = FeatureSSE4_2;
+constexpr X86FeatureBitset ImpliedFeaturesAVX2 = FeatureAVX;
+constexpr X86FeatureBitset ImpliedFeaturesEVEX512 = {};
+constexpr X86FeatureBitset ImpliedFeaturesAVX512F =
FeatureAVX2 | FeatureF16C | FeatureFMA;
// Vector extensions that build on SSE or AVX.
-constexpr FeatureBitset ImpliedFeaturesAES = FeatureSSE2;
-constexpr FeatureBitset ImpliedFeaturesF16C = FeatureAVX;
-constexpr FeatureBitset ImpliedFeaturesFMA = FeatureAVX;
-constexpr FeatureBitset ImpliedFeaturesGFNI = FeatureSSE2;
-constexpr FeatureBitset ImpliedFeaturesPCLMUL = FeatureSSE2;
-constexpr FeatureBitset ImpliedFeaturesSHA = FeatureSSE2;
-constexpr FeatureBitset ImpliedFeaturesVAES = FeatureAES | FeatureAVX2;
-constexpr FeatureBitset ImpliedFeaturesVPCLMULQDQ = FeatureAVX | FeaturePCLMUL;
-constexpr FeatureBitset ImpliedFeaturesSM3 = FeatureAVX;
-constexpr FeatureBitset ImpliedFeaturesSM4 = FeatureAVX2;
+constexpr X86FeatureBitset ImpliedFeaturesAES = FeatureSSE2;
+constexpr X86FeatureBitset ImpliedFeaturesF16C = FeatureAVX;
+constexpr X86FeatureBitset ImpliedFeaturesFMA = FeatureAVX;
+constexpr X86FeatureBitset ImpliedFeaturesGFNI = FeatureSSE2;
+constexpr X86FeatureBitset ImpliedFeaturesPCLMUL = FeatureSSE2;
+constexpr X86FeatureBitset ImpliedFeaturesSHA = FeatureSSE2;
+constexpr X86FeatureBitset ImpliedFeaturesVAES = FeatureAES | FeatureAVX2;
+constexpr X86FeatureBitset ImpliedFeaturesVPCLMULQDQ = FeatureAVX | FeaturePCLMUL;
+constexpr X86FeatureBitset ImpliedFeaturesSM3 = FeatureAVX;
+constexpr X86FeatureBitset ImpliedFeaturesSM4 = FeatureAVX2;
// AVX512 features.
-constexpr FeatureBitset ImpliedFeaturesAVX512CD = FeatureAVX512F;
-constexpr FeatureBitset ImpliedFeaturesAVX512BW = FeatureAVX512F;
-constexpr FeatureBitset ImpliedFeaturesAVX512DQ = FeatureAVX512F;
-constexpr FeatureBitset ImpliedFeaturesAVX512ER = FeatureAVX512F;
-constexpr FeatureBitset ImpliedFeaturesAVX512PF = FeatureAVX512F;
-constexpr FeatureBitset ImpliedFeaturesAVX512VL = FeatureAVX512F;
-
-constexpr FeatureBitset ImpliedFeaturesAVX512BF16 = FeatureAVX512BW;
-constexpr FeatureBitset ImpliedFeaturesAVX512BITALG = FeatureAVX512BW;
-constexpr FeatureBitset ImpliedFeaturesAVX512IFMA = FeatureAVX512F;
-constexpr FeatureBitset ImpliedFeaturesAVX512VNNI = FeatureAVX512F;
-constexpr FeatureBitset ImpliedFeaturesAVX512VPOPCNTDQ = FeatureAVX512F;
-constexpr FeatureBitset ImpliedFeaturesAVX512VBMI = FeatureAVX512BW;
-constexpr FeatureBitset ImpliedFeaturesAVX512VBMI2 = FeatureAVX512BW;
-constexpr FeatureBitset ImpliedFeaturesAVX512VP2INTERSECT = FeatureAVX512F;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512CD = FeatureAVX512F;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512BW = FeatureAVX512F;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512DQ = FeatureAVX512F;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512ER = FeatureAVX512F;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512PF = FeatureAVX512F;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512VL = FeatureAVX512F;
+
+constexpr X86FeatureBitset ImpliedFeaturesAVX512BF16 = FeatureAVX512BW;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512BITALG = FeatureAVX512BW;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512IFMA = FeatureAVX512F;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512VNNI = FeatureAVX512F;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512VPOPCNTDQ = FeatureAVX512F;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512VBMI = FeatureAVX512BW;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512VBMI2 = FeatureAVX512BW;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512VP2INTERSECT = FeatureAVX512F;
// FIXME: These two aren't really implemented and just exist in the feature
// list for __builtin_cpu_supports. So omit their dependencies.
-constexpr FeatureBitset ImpliedFeaturesAVX5124FMAPS = {};
-constexpr FeatureBitset ImpliedFeaturesAVX5124VNNIW = {};
+constexpr X86FeatureBitset ImpliedFeaturesAVX5124FMAPS = {};
+constexpr X86FeatureBitset ImpliedFeaturesAVX5124VNNIW = {};
// SSE4_A->FMA4->XOP chain.
-constexpr FeatureBitset ImpliedFeaturesSSE4_A = FeatureSSE3;
-constexpr FeatureBitset ImpliedFeaturesFMA4 = FeatureAVX | FeatureSSE4_A;
-constexpr FeatureBitset ImpliedFeaturesXOP = FeatureFMA4;
+constexpr X86FeatureBitset ImpliedFeaturesSSE4_A = FeatureSSE3;
+constexpr X86FeatureBitset ImpliedFeaturesFMA4 = FeatureAVX | FeatureSSE4_A;
+constexpr X86FeatureBitset ImpliedFeaturesXOP = FeatureFMA4;
// AMX Features
-constexpr FeatureBitset ImpliedFeaturesAMX_TILE = {};
-constexpr FeatureBitset ImpliedFeaturesAMX_BF16 = FeatureAMX_TILE;
-constexpr FeatureBitset ImpliedFeaturesAMX_FP16 = FeatureAMX_TILE;
-constexpr FeatureBitset ImpliedFeaturesAMX_INT8 = FeatureAMX_TILE;
-constexpr FeatureBitset ImpliedFeaturesAMX_COMPLEX = FeatureAMX_TILE;
-constexpr FeatureBitset ImpliedFeaturesHRESET = {};
-
-constexpr FeatureBitset ImpliedFeaturesPREFETCHI = {};
-constexpr FeatureBitset ImpliedFeaturesCMPCCXADD = {};
-constexpr FeatureBitset ImpliedFeaturesRAOINT = {};
-constexpr FeatureBitset ImpliedFeaturesAVXVNNIINT16 = FeatureAVX2;
-constexpr FeatureBitset ImpliedFeaturesAVXVNNIINT8 = FeatureAVX2;
-constexpr FeatureBitset ImpliedFeaturesAVXIFMA = FeatureAVX2;
-constexpr FeatureBitset ImpliedFeaturesAVXNECONVERT = FeatureAVX2;
-constexpr FeatureBitset ImpliedFeaturesSHA512 = FeatureAVX2;
-constexpr FeatureBitset ImpliedFeaturesAVX512FP16 =
+constexpr X86FeatureBitset ImpliedFeaturesAMX_TILE = {};
+constexpr X86FeatureBitset ImpliedFeaturesAMX_BF16 = FeatureAMX_TILE;
+constexpr X86FeatureBitset ImpliedFeaturesAMX_FP16 = FeatureAMX_TILE;
+constexpr X86FeatureBitset ImpliedFeaturesAMX_INT8 = FeatureAMX_TILE;
+constexpr X86FeatureBitset ImpliedFeaturesAMX_COMPLEX = FeatureAMX_TILE;
+constexpr X86FeatureBitset ImpliedFeaturesHRESET = {};
+
+constexpr X86FeatureBitset ImpliedFeaturesPREFETCHI = {};
+constexpr X86FeatureBitset ImpliedFeaturesCMPCCXADD = {};
+constexpr X86FeatureBitset ImpliedFeaturesRAOINT = {};
+constexpr X86FeatureBitset ImpliedFeaturesAVXVNNIINT16 = FeatureAVX2;
+constexpr X86FeatureBitset ImpliedFeaturesAVXVNNIINT8 = FeatureAVX2;
+constexpr X86FeatureBitset ImpliedFeaturesAVXIFMA = FeatureAVX2;
+constexpr X86FeatureBitset ImpliedFeaturesAVXNECONVERT = FeatureAVX2;
+constexpr X86FeatureBitset ImpliedFeaturesSHA512 = FeatureAVX2;
+constexpr X86FeatureBitset ImpliedFeaturesAVX512FP16 =
FeatureAVX512BW | FeatureAVX512DQ | FeatureAVX512VL;
// Key Locker Features
-constexpr FeatureBitset ImpliedFeaturesKL = FeatureSSE2;
-constexpr FeatureBitset ImpliedFeaturesWIDEKL = FeatureKL;
+constexpr X86FeatureBitset ImpliedFeaturesKL = FeatureSSE2;
+constexpr X86FeatureBitset ImpliedFeaturesWIDEKL = FeatureKL;
// AVXVNNI Features
-constexpr FeatureBitset ImpliedFeaturesAVXVNNI = FeatureAVX2;
+constexpr X86FeatureBitset ImpliedFeaturesAVXVNNI = FeatureAVX2;
// AVX10 Features
-constexpr FeatureBitset ImpliedFeaturesAVX10_1 =
+constexpr X86FeatureBitset ImpliedFeaturesAVX10_1 =
FeatureAVX512CD | FeatureAVX512VBMI | FeatureAVX512IFMA |
FeatureAVX512VNNI | FeatureAVX512BF16 | FeatureAVX512VPOPCNTDQ |
FeatureAVX512VBMI2 | FeatureAVX512BITALG | FeatureVAES | FeatureVPCLMULQDQ |
FeatureAVX512FP16;
-constexpr FeatureBitset ImpliedFeaturesAVX10_1_512 =
+constexpr X86FeatureBitset ImpliedFeaturesAVX10_1_512 =
FeatureAVX10_1 | FeatureEVEX512;
// APX Features
-constexpr FeatureBitset ImpliedFeaturesEGPR = {};
-constexpr FeatureBitset ImpliedFeaturesPush2Pop2 = {};
-constexpr FeatureBitset ImpliedFeaturesPPX = {};
-constexpr FeatureBitset ImpliedFeaturesNDD = {};
-constexpr FeatureBitset ImpliedFeaturesCCMP = {};
-constexpr FeatureBitset ImpliedFeaturesCF = {};
+constexpr X86FeatureBitset ImpliedFeaturesEGPR = {};
+constexpr X86FeatureBitset ImpliedFeaturesPush2Pop2 = {};
+constexpr X86FeatureBitset ImpliedFeaturesPPX = {};
+constexpr X86FeatureBitset ImpliedFeaturesNDD = {};
+constexpr X86FeatureBitset ImpliedFeaturesCCMP = {};
+constexpr X86FeatureBitset ImpliedFeaturesCF = {};
constexpr FeatureInfo FeatureInfos[X86::CPU_FEATURE_MAX] = {
#define X86_FEATURE(ENUM, STR) {{"+" STR}, ImpliedFeatures##ENUM},
@@ -646,7 +646,7 @@ void llvm::X86::getFeaturesForCPU(StringRef CPU,
[&](const ProcInfo &P) { return P.Name == CPU; });
assert(I != std::end(Processors) && "Processor not found!");
- FeatureBitset Bits = I->Features;
+ X86FeatureBitset Bits = I->Features;
// Remove the 64-bit feature which we only use to validate if a CPU can
// be used with 64-bit mode.
@@ -659,12 +659,12 @@ void llvm::X86::getFeaturesForCPU(StringRef CPU,
}
// For each feature that is (transitively) implied by this feature, set it.
-static void getImpliedEnabledFeatures(FeatureBitset &Bits,
- const FeatureBitset &Implies) {
+static void getImpliedEnabledFeatures(X86FeatureBitset &Bits,
+ const X86FeatureBitset &Implies) {
// Fast path: Implies is often empty.
if (!Implies.any())
return;
- FeatureBitset Prev;
+ X86FeatureBitset Prev;
Bits |= Implies;
do {
Prev = Bits;
@@ -676,10 +676,10 @@ static void getImpliedEnabledFeatures(FeatureBitset &Bits,
/// Create bit vector of features that are implied disabled if the feature
/// passed in Value is disabled.
-static void getImpliedDisabledFeatures(FeatureBitset &Bits, unsigned Value) {
+static void getImpliedDisabledFeatures(X86FeatureBitset &Bits, unsigned Value) {
// Check all features looking for any dependent on this feature. If we find
// one, mark it and recursively find any feature that depend on it.
- FeatureBitset Prev;
+ X86FeatureBitset Prev;
Bits.set(Value);
do {
Prev = Bits;
@@ -701,7 +701,7 @@ void llvm::X86::updateImpliedFeatures(
return;
}
- FeatureBitset ImpliedBits;
+ X86FeatureBitset ImpliedBits;
if (Enabled)
getImpliedEnabledFeatures(ImpliedBits, I->ImpliedFeatures);
else
diff --git a/llvm/lib/TextAPI/TextStubV5.cpp b/llvm/lib/TextAPI/TextStubV5.cpp
index b072c0b5d69d0..a44de94b7b05b 100644
--- a/llvm/lib/TextAPI/TextStubV5.cpp
+++ b/llvm/lib/TextAPI/TextStubV5.cpp
@@ -225,7 +225,7 @@ Error collectFromArray(TBDKey Key, const Object *Obj,
return Error::success();
}
- for (const Value &Val : *Values) {
+ for (const json::Value &Val : *Values) {
auto ValStr = Val.getAsString();
if (!ValStr.has_value())
return make_error<JSONStubError>(getParseErrorMsg(Key));
@@ -258,7 +258,7 @@ Expected<TargetList> getTargets(const Object *Section) {
return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Targets));
TargetList IFTargets;
- for (const Value &JSONTarget : *Targets) {
+ for (const json::Value &JSONTarget : *Targets) {
auto TargetStr = JSONTarget.getAsString();
if (!TargetStr.has_value())
return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Target));
@@ -276,7 +276,7 @@ Expected<TargetList> getTargetsSection(const Object *Section) {
return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Targets));
TargetList IFTargets;
- for (const Value &JSONTarget : *Targets) {
+ for (const json::Value &JSONTarget : *Targets) {
const auto *Obj = JSONTarget.getAsObject();
if (!Obj)
return make_error<JSONStubError>(getParseErrorMsg(TBDKey::Target));
@@ -1024,8 +1024,8 @@ Error MachO::serializeInterfaceFileToJSON(raw_ostream &OS,
if (!TextFile)
return TextFile.takeError();
if (Compact)
- OS << formatv("{0}", Value(std::move(*TextFile))) << "\n";
+ OS << formatv("{0}", json::Value(std::move(*TextFile))) << "\n";
else
- OS << formatv("{0:2}", Value(std::move(*TextFile))) << "\n";
+ OS << formatv("{0:2}", json::Value(std::move(*TextFile))) << "\n";
return Error::success();
}
More information about the llvm-commits
mailing list