14#ifndef LLVM_OBJECT_BBADDRMAP_H
15#define LLVM_OBJECT_BBADDRMAP_H
34#define HANDLE_BB_ADDR_MAP_FEATURE(Name) Name##Bit,
35#include "llvm/Object/BBAddrMap.def"
39 "BBAddrMap::Features is encoded as a uint16_t");
41#define HANDLE_BB_ADDR_MAP_FEATURE(Name) bool Name : 1;
42#include "llvm/Object/BBAddrMap.def"
54#define HANDLE_BB_ADDR_MAP_FEATURE(Name) \
55 V |= static_cast<uint16_t>(Name) << Name##Bit;
56#include "llvm/Object/BBAddrMap.def"
64#define HANDLE_BB_ADDR_MAP_FEATURE(Name) \
65 static_cast<bool>(Val & (uint16_t{1} << Name##Bit)),
66#include "llvm/Object/BBAddrMap.def"
70 "invalid encoding for BBAddrMap::Features: 0x%x", Val);
83#define HANDLE_BB_ADDR_MAP_BB_METADATA(Name) Name##Bit,
84#include "llvm/Object/BBAddrMap.def"
88 "BBAddrMap::BBEntry::Metadata is encoded as a uint32_t");
90#define HANDLE_BB_ADDR_MAP_BB_METADATA(Name) bool Name : 1;
91#include "llvm/Object/BBAddrMap.def"
100#define HANDLE_BB_ADDR_MAP_BB_METADATA(Name) \
101 V |= static_cast<uint32_t>(Name) << Name##Bit;
102#include "llvm/Object/BBAddrMap.def"
109#define HANDLE_BB_ADDR_MAP_BB_METADATA(Name) \
110 static_cast<bool>(V & (uint32_t{1} << Name##Bit)),
111#include "llvm/Object/BBAddrMap.def"
113 if (
MD.encode() != V)
115 "invalid encoding for BBEntry::Metadata: 0x%x", V);
169 return BBRanges.front().BaseAddress;
174 size_t NumBBEntries = 0;
176 NumBBEntries += BBR.BBEntries.size();
182 std::optional<size_t>
185 if (
BBRanges[
I].BaseAddress == BaseAddress)
235 std::tie(
Other.BlockFreq,
Other.PostLinkBlockFreq,
258 unsigned AddressSize;
262 : Data(Data), AddressSize(AddressSize) {}
284 std::vector<PGOAnalysisMap> *PGOAnalyses =
nullptr);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file defines the SmallVector class.
Tagged union holding either a T or a Error.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Expected< std::vector< BBAddrMap > > decodeBBAddrMapPayload(AddressExtractor &Extractor, std::vector< PGOAnalysisMap > *PGOAnalyses=nullptr)
Decodes one BB address map section payload.
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
static Expected< Metadata > decode(uint32_t V)
bool operator==(const Metadata &Other) const
BBEntry(uint32_t ID, uint32_t Offset, uint32_t Size, Metadata MD, SmallVector< uint32_t, 1 > CallsiteEndOffsets, uint64_t Hash)
SmallVector< uint32_t, 1 > CallsiteEndOffsets
bool canFallThrough() const
bool hasIndirectBranch() const
bool operator==(const BBEntry &Other) const
bool operator==(const BBRangeEntry &Other) const
std::vector< BBEntry > BBEntries
bool operator==(const Features &Other) const
static constexpr uint16_t KnownMask
bool hasPGOAnalysisBBData() const
static Expected< Features > decode(uint16_t Val)
bool hasPGOAnalysis() const
const std::vector< BBRangeEntry > & getBBRanges() const
std::vector< BBRangeEntry > BBRanges
size_t getNumBBEntries() const
bool operator==(const BBAddrMap &Other) const
const std::vector< BBEntry > & getBBEntries() const
uint64_t getFunctionAddress() const
std::optional< size_t > getBBRangeIndexForBaseAddress(uint64_t BaseAddress) const
Single successor of a given basic block that contains the tag and branch probability associated with ...
uint32_t ID
Unique ID of this successor basic block.
BranchProbability Prob
Branch Probability of the edge to this successor taken from MBPI.
bool operator==(const SuccessorEntry &Other) const
uint64_t PostLinkFreq
Raw edge count from the post link profile (e.g., from bolt or propeller).
Extra basic block data with fields for block frequency and branch probability.
bool operator==(const PGOBBEntry &Other) const
uint64_t PostLinkBlockFreq
Raw block count taken from the post link profile (e.g., from bolt or propeller).
llvm::SmallVector< SuccessorEntry, 2 > Successors
List of successors of the current block.
BlockFrequency BlockFreq
Block frequency taken from MBFI.
A feature extension of BBAddrMap that holds information relevant to PGO.
bool operator==(const PGOAnalysisMap &Other) const
std::vector< PGOBBEntry > BBEntries
BBAddrMap::Features FeatEnable