54#ifndef LLVM_MC_MCPSEUDOPROBE_H
55#define LLVM_MC_MCPSEUDOPROBE_H
69#include <unordered_map>
70#include <unordered_set>
76class MCObjectStreamer;
97class MCDecodedPseudoProbe;
104 std::unordered_map<uint64_t, MCPseudoProbeFuncDesc>;
167 assert(
Type <= 0xFF &&
"Probe type too big to encode, exceeding 2^8");
169 "Probe attributes too big to encode, exceeding 2^16");
211 bool ShowName)
const;
214template <
typename ProbeType,
typename DerivedProbeInlineTreeType>
216 struct InlineSiteHash {
218 return std::get<0>(Site) ^ std::get<1>(Site);
225 InlineSite, std::unique_ptr<DerivedProbeInlineTreeType>, InlineSiteHash>;
231 DerivedProbeInlineTreeType>
::value,
232 "DerivedProbeInlineTreeType must be subclass of "
233 "MCPseudoProbeInlineTreeBase");
251 Site, std::make_unique<DerivedProbeInlineTreeType>(Site));
252 Ret.first->second->Parent =
this;
253 return Ret.first->second.get();
264 MCPseudoProbeInlineTree> {
269 this->
Guid = std::get<0>(Site);
281 MCDecodedPseudoProbeInlineTree> {
298 MCProbeDivisions[FuncSym].addPseudoProbe(Probe, InlineStack);
314 bool empty()
const {
return MCProbeDivisions.empty(); }
352 const uint8_t *Data =
nullptr;
355 const uint8_t *End =
nullptr;
358 bool EncodingIsAddrBased =
false;
361 template <
typename T>
ErrorOr<T> readUnencodedNumber();
362 template <
typename T>
ErrorOr<T> readUnsignedNumber();
363 template <
typename T>
ErrorOr<T> readSignedNumber();
407 bool IncludeLeaf)
const;
410 return Address2ProbesMap;
416 return GUID2FuncDescMap;
423 return DummyInlineRoot;
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Given that RA is a live value
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
Provides ErrorOr<T> smart pointer.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
Represents either an error or a value T.
MCDecodedPseudoProbeInlineTree()=default
MCDecodedPseudoProbeInlineTree(const InlineSite &Site)
bool hasInlineSite() const
void print(raw_ostream &OS, const GUIDProbeFunctionMap &GUID2FuncMAP, bool ShowName) const
void setAddress(uint64_t Addr)
MCDecodedPseudoProbe(uint64_t Ad, uint64_t G, uint32_t I, PseudoProbeType K, uint8_t At, uint32_t D, MCDecodedPseudoProbeInlineTree *Tree)
std::string getInlineContextStr(const GUIDProbeFunctionMap &GUID2FuncMAP) const
MCDecodedPseudoProbeInlineTree * getInlineTreeNode() const
void getInlineContext(SmallVectorImpl< MCPseudoProbeFrameLocation > &ContextStack, const GUIDProbeFunctionMap &GUID2FuncMAP) const
uint64_t getAddress() const
Streaming object file generation interface.
uint8_t getAttributes() const
uint32_t getDiscriminator() const
bool isDirectCall() const
MCPseudoProbeBase(uint64_t G, uint64_t I, uint64_t At, uint8_t T, uint32_t D)
bool isIndirectCall() const
uint64_t getIndex() const
void setAttributes(uint8_t Attr)
static const uint32_t PseudoProbeFirstId
bool buildAddress2ProbeMap(const uint8_t *Start, std::size_t Size, const Uint64Set &GuildFilter, const Uint64Map &FuncStartAddrs)
const AddressProbesMap & getAddress2ProbesMap() const
void printProbesForAllAddresses(raw_ostream &OS)
const GUIDProbeFunctionMap & getGUID2FuncDescMap() const
bool buildGUID2FuncDescMap(const uint8_t *Start, std::size_t Size)
const MCDecodedPseudoProbeInlineTree & getDummyInlineRoot() const
void printGUID2FuncDescMap(raw_ostream &OS)
void printProbeForAddress(raw_ostream &OS, uint64_t Address)
void getInlineContextForProbe(const MCDecodedPseudoProbe *Probe, SmallVectorImpl< MCPseudoProbeFrameLocation > &InlineContextStack, bool IncludeLeaf) const
AddressProbesMap & getAddress2ProbesMap()
const MCPseudoProbeFuncDesc * getInlinerDescForProbe(const MCDecodedPseudoProbe *Probe) const
const MCDecodedPseudoProbe * getCallProbeForAddr(uint64_t Address) const
const MCPseudoProbeFuncDesc * getFuncDescForGUID(uint64_t GUID) const
InlinedProbeTreeMap & getChildren()
const std::vector< ProbeType > & getProbes() const
std::unordered_map< InlineSite, std::unique_ptr< DerivedProbeInlineTreeType >, InlineSiteHash > InlinedProbeTreeMap
const InlinedProbeTreeMap & getChildren() const
MCPseudoProbeInlineTreeBase< ProbeType, DerivedProbeInlineTreeType > * Parent
void addProbes(ProbeType Probe)
DerivedProbeInlineTreeType * getOrAddNode(const InlineSite &Site)
MCPseudoProbeInlineTreeBase()
std::vector< ProbeType > & getProbes()
std::vector< ProbeType > Probes
InlinedProbeTreeMap Children
MCPseudoProbeInlineTree()=default
MCPseudoProbeInlineTree(uint64_t Guid)
void addPseudoProbe(const MCPseudoProbe &Probe, const MCPseudoProbeInlineStack &InlineStack)
MCPseudoProbeInlineTree(const InlineSite &Site)
Instances of this class represent the pseudo probes inserted into a compile unit.
void addPseudoProbe(MCSymbol *FuncSym, const MCPseudoProbe &Probe, const MCPseudoProbeInlineStack &InlineStack)
const MCProbeDivisionMap & getMCProbes() const
std::unordered_map< MCSymbol *, MCPseudoProbeInlineTree > MCProbeDivisionMap
MCPseudoProbeSections & getProbeSections()
static int DdgPrintIndent
Instances of this class represent a pseudo probe instance for a pseudo probe table entry,...
MCSymbol * getLabel() const
MCPseudoProbe(MCSymbol *Label, uint64_t Guid, uint64_t Index, uint64_t Type, uint64_t Attributes, uint32_t Discriminator)
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
The instances of the Type class are immutable: once they are created, they are never changed.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
std::map< uint64_t, std::list< MCDecodedPseudoProbe > > AddressProbesMap
std::tuple< uint64_t, uint32_t > InlineSite
std::pair< StringRef, uint32_t > MCPseudoProbeFrameLocation
std::unordered_map< uint64_t, MCPseudoProbeFuncDesc > GUIDProbeFunctionMap
MCPseudoProbeFuncDesc(uint64_t GUID, uint64_t Hash, StringRef Name)
void print(raw_ostream &OS)