24 IO &
IO, BBAddrMapYAML::BBAddrMapEntry &
E) {
33 IO &
IO, BBAddrMapYAML::BBAddrMapEntry::BBRangeEntry &
E) {
40 IO &
IO, BBAddrMapYAML::BBAddrMapEntry::BBEntry &
E) {
51 IO &
IO, BBAddrMapYAML::PGOAnalysisMapEntry &
E) {
58 IO &
IO, BBAddrMapYAML::PGOAnalysisMapEntry::PGOBBEntry &
E) {
66 BBAddrMapYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry>::
68 BBAddrMapYAML::PGOAnalysisMapEntry::PGOBBEntry::SuccessorEntry &
E) {
80 const std::vector<PGOAnalysisMapEntry> *PGOAnalyses,
83 assert((AddressSize == 4 || AddressSize == 8) &&
"invalid address size");
88 <<
static_cast<int>(
E.Version)
89 <<
"; encoding using the most recent version";
101 bool MultiBBRangeFeatureEnabled = FeatureOrErr->MultiBBRange;
103 MultiBBRangeFeatureEnabled ||
104 (
E.NumBBRanges.has_value() &&
E.NumBBRanges.value() != 1) ||
105 (
E.BBRanges &&
E.BBRanges->size() != 1);
106 if (MultiBBRange && !MultiBBRangeFeatureEnabled)
108 <<
") does not support multiple BB ranges.";
113 E.NumBBRanges.value_or(
E.BBRanges ?
E.BBRanges->size() : 0);
119 bool EmitCallsiteEndOffsets =
120 FeatureOrErr->CallsiteEndOffsets ||
E.hasAnyCallsiteEndOffsets();
123 if (AddressSize == 8)
134 if (!BBR.
BBEntries || FeatureOrErr->OmitBBEntries)
141 if (EmitCallsiteEndOffsets) {
142 size_t NumCallsiteEndOffsets =
152 if (FeatureOrErr->BBHash || BBE.
Hash.has_value()) {
154 BBE.
Hash.has_value() ? BBE.
Hash.value() : llvm::yaml::Hex64(0);
169 const auto &PGOBBEntries = PGOEntry.
PGOBBEntries.value();
170 if (TotalNumBlocks != PGOBBEntries.size()) {
172 "BBEntries in the BB address map.\n"
173 <<
"Mismatch on function with address: "
174 <<
E.getFunctionAddress();
178 for (
const auto &PGOBBE : PGOBBEntries) {
181 if (FeatureOrErr->PostLinkCfg || PGOBBE.PostLinkBBFreq.has_value())
183 if (PGOBBE.Successors) {
185 for (
const auto &[ID,
BrProb, PostLinkBrFreq] : *PGOBBE.Successors) {
188 if (FeatureOrErr->PostLinkCfg || PostLinkBrFreq.has_value())
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file declares the YAML representation of BB address maps (SHT_LLVM_BB_ADDR_MAP / ....
This file declares common types and utilities for basic-block address maps.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines ContiguousBlobAccumulator, the size-limited output buffer shared by the yaml2obj em...
Represent a constant reference to an array (0 or more elements consecutively in memory),...
static LLVM_ABI raw_ostream & warning()
Convenience method for printing "warning: " to stderr.
void write(const char *Ptr, size_t Size)
LLVM_ABI unsigned writeULEB128(uint64_t Val)
void mapOptional(StringRef Key, T &Val)
void * getContext() const
void mapRequired(StringRef Key, T &Val)
LLVM_ABI void encodePayload(ArrayRef< BBAddrMapEntry > Entries, const std::vector< PGOAnalysisMapEntry > *PGOAnalyses, yaml::ContiguousBlobAccumulator &CBA, llvm::endianness Endian, unsigned AddressSize)
Encodes the BBAddrMap payload into CBA.
This is an optimization pass for GlobalISel generic memory operations.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)
llvm::yaml::Hex64 Metadata
std::optional< std::vector< llvm::yaml::Hex64 > > CallsiteEndOffsets
std::optional< llvm::yaml::Hex64 > Hash
llvm::yaml::Hex64 AddressOffset
std::optional< std::vector< BBEntry > > BBEntries
std::optional< uint64_t > NumBlocks
llvm::yaml::Hex64 BaseAddress
std::optional< uint64_t > FuncEntryCount
std::optional< std::vector< PGOBBEntry > > PGOBBEntries
static Expected< Features > decode(uint16_t Val)
This class should be specialized by any type that needs to be converted to/from a YAML mapping.