Go to the documentation of this file.
44 #ifndef LLVM_MC_MCPSEUDOPROBE_H
45 #define LLVM_MC_MCPSEUDOPROBE_H
56 #include <type_traits>
57 #include <unordered_map>
58 #include <unordered_set>
65 class MCObjectStreamer;
86 class MCDecodedPseudoProbe;
93 std::unordered_map<uint64_t, MCPseudoProbeFuncDesc>;
96 std::unordered_map<uint64_t, std::list<MCDecodedPseudoProbe>>;
153 assert(
Type <= 0xFF &&
"Probe type too big to encode, exceeding 2^8");
155 "Probe attributes too big to encode, exceeding 2^16");
196 bool ShowName)
const;
199 template <
typename ProbeType,
typename DerivedProbeInlineTreeType>
201 struct InlineSiteHash {
203 return std::get<0>(Site) ^ std::get<1>(Site);
210 InlineSite, std::unique_ptr<DerivedProbeInlineTreeType>, InlineSiteHash>;
216 DerivedProbeInlineTreeType>::value,
217 "DerivedProbeInlineTreeType must be subclass of "
218 "MCPseudoProbeInlineTreeBase");
234 Site, std::make_unique<DerivedProbeInlineTreeType>(Site));
235 Ret.first->second->Parent =
this;
236 return Ret.first->second.get();
247 MCPseudoProbeInlineTree> {
252 this->
Guid = std::get<0>(Site);
264 MCDecodedPseudoProbeInlineTree> {
283 MCProbeDivisions[Sec].addPseudoProbe(Probe, InlineStack);
301 bool empty()
const {
return MCProbeDivisions.empty(); }
339 const uint8_t *Data =
nullptr;
342 const uint8_t *End =
nullptr;
345 template <
typename T>
ErrorOr<T> readUnencodedNumber();
346 template <
typename T>
ErrorOr<T> readUnsignedNumber();
347 template <
typename T>
ErrorOr<T> readSignedNumber();
360 std::unordered_set<uint64_t> &GuildFilter);
364 std::unordered_set<uint64_t> &GuildFilter);
390 bool IncludeLeaf)
const;
393 return Address2ProbesMap;
399 return GUID2FuncDescMap;
406 return DummyInlineRoot;
412 #endif // LLVM_MC_MCPSEUDOPROBE_H
MCDecodedPseudoProbe(uint64_t Ad, uint64_t G, uint32_t I, PseudoProbeType K, uint8_t At, MCDecodedPseudoProbeInlineTree *Tree)
std::unordered_map< uint64_t, MCPseudoProbeFuncDesc > GUIDProbeFunctionMap
void printProbeForAddress(raw_ostream &OS, uint64_t Address)
Instances of this class represent the pseudo probes inserted into a compile unit.
std::unordered_map< uint64_t, std::list< MCDecodedPseudoProbe > > AddressProbesMap
This is an optimization pass for GlobalISel generic memory operations.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
std::tuple< uint64_t, uint32_t > InlineSite
void print(raw_ostream &OS, const GUIDProbeFunctionMap &GUID2FuncMAP, bool ShowName) const
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
MCPseudoProbeInlineTree(const InlineSite &Site)
void emit(MCObjectStreamer *MCOS)
const GUIDProbeFunctionMap & getGUID2FuncDescMap() const
Instances of this class represent a pseudo probe instance for a pseudo probe table entry,...
void addPseudoProbe(const MCPseudoProbe &Probe, const MCPseudoProbeInlineStack &InlineStack)
The instances of the Type class are immutable: once they are created, they are never changed.
std::vector< ProbeType > & getProbes()
MCPseudoProbeInlineTree()=default
uint8_t getAttributes() const
const AddressProbesMap & getAddress2ProbesMap() const
std::vector< ProbeType > Probes
MCPseudoProbeInlineTreeBase()
MCDecodedPseudoProbeInlineTree(const InlineSite &Site)
MCPseudoProbeSection & getProbeSections()
void print(raw_ostream &OS)
MCDecodedPseudoProbeInlineTree * getInlineTreeNode() const
std::unordered_map< InlineSite, std::unique_ptr< DerivedProbeInlineTreeType >, InlineSiteHash > InlinedProbeTreeMap
Streaming object file generation interface.
std::map< MCSection *, MCPseudoProbeInlineTree > MCProbeDivisionMap
void emit(MCObjectStreamer *MCOS, const MCPseudoProbe *&LastProbe)
void getInlineContextForProbe(const MCDecodedPseudoProbe *Probe, SmallVectorImpl< MCPseduoProbeFrameLocation > &InlineContextStack, bool IncludeLeaf) const
This class implements an extremely fast bulk output stream that can only output to a stream.
bool buildGUID2FuncDescMap(const uint8_t *Start, std::size_t Size)
DerivedProbeInlineTreeType * getOrAddNode(const InlineSite &Site)
uint32_t ChildrenToProcess
InlinedProbeTreeMap & getChildren()
void emit(MCObjectStreamer *MCOS, const MCPseudoProbe *LastProbe) const
bool buildAddress2ProbeMap(const uint8_t *Start, std::size_t Size)
uint64_t getAddress() const
const MCProbeDivisionMap & getMCProbes() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MCSymbol * getLabel() const
MCPseudoProbeFuncDesc(uint64_t GUID, uint64_t Hash, StringRef Name)
MCPseudoProbeInlineTreeBase< ProbeType, DerivedProbeInlineTreeType > * Parent
InlinedProbeTreeMap Children
std::string getInlineContextStr(const GUIDProbeFunctionMap &GUID2FuncMAP) const
const InlinedProbeTreeMap & getChildren() const
void addPseudoProbe(MCSection *Sec, const MCPseudoProbe &Probe, const MCPseudoProbeInlineStack &InlineStack)
StringRef - Represent a constant reference to a string, i.e.
void printGUID2FuncDescMap(raw_ostream &OS)
const static uint32_t PseudoProbeFirstId
MCPseudoProbeBase(uint64_t G, uint64_t I, uint64_t At, uint8_t T)
Instances of this class represent a uniqued identifier for a section in the current translation unit.
bool isIndirectCall() const
void addProbes(ProbeType Probe)
static int DdgPrintIndent
MCDecodedPseudoProbeInlineTree()=default
uint64_t getIndex() const
const MCDecodedPseudoProbeInlineTree & getDummyInlineRoot() const
bool hasInlineSite() const
const MCDecodedPseudoProbe * getCallProbeForAddr(uint64_t Address) const
bool isDirectCall() const
MCPseudoProbe(MCSymbol *Label, uint64_t Guid, uint64_t Index, uint64_t Type, uint64_t Attributes)
void printProbesForAllAddresses(raw_ostream &OS)
const MCPseudoProbeFuncDesc * getFuncDescForGUID(uint64_t GUID) const
Represents either an error or a value T.
void setAddress(uint64_t Addr)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void getInlineContext(SmallVectorImpl< MCPseduoProbeFrameLocation > &ContextStack, const GUIDProbeFunctionMap &GUID2FuncMAP) const
std::pair< StringRef, uint32_t > MCPseduoProbeFrameLocation
const MCPseudoProbeFuncDesc * getInlinerDescForProbe(const MCDecodedPseudoProbe *Probe) const
MCPseudoProbeInlineTree(uint64_t Guid)
AddressProbesMap & getAddress2ProbesMap()
void setAttributes(uint8_t Attr)
static void emit(MCObjectStreamer *MCOS)