LLDB mainline
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
lldb_private::HTRBlockMetadata Class Reference

Metadata associated with an HTR block See lldb/docs/htr.rst for comprehensive HTR documentation. More...

#include <TraceHTR.h>

Public Member Functions

 HTRBlockMetadata (lldb::addr_t first_instruction_load_address, size_t num_instructions, llvm::DenseMap< ConstString, size_t > &&func_calls)
 Constructor for a block's metadata.
 
size_t GetNumInstructions () const
 Get the number of instructions in the block.
 
std::optional< llvm::StringRef > GetMostFrequentlyCalledFunction () const
 Get the name of the most frequently called function from the block.
 
lldb::addr_t GetFirstInstructionLoadAddress () const
 Get the load address of the first instruction in the block.
 
llvm::DenseMap< ConstString, size_t > const & GetFunctionCalls () const
 Get the function calls map for the block.
 

Static Public Member Functions

static void MergeMetadata (HTRBlockMetadata &merged_metadata, HTRBlockMetadata const &metadata_to_merge)
 Merge two HTRBlockMetadata in place.
 

Private Attributes

lldb::addr_t m_first_instruction_load_address
 
size_t m_num_instructions
 
llvm::DenseMap< ConstString, size_t > m_func_calls
 

Detailed Description

Metadata associated with an HTR block See lldb/docs/htr.rst for comprehensive HTR documentation.

Definition at line 23 of file TraceHTR.h.

Constructor & Destructor Documentation

◆ HTRBlockMetadata()

lldb_private::HTRBlockMetadata::HTRBlockMetadata ( lldb::addr_t  first_instruction_load_address,
size_t  num_instructions,
llvm::DenseMap< ConstString, size_t > &&  func_calls 
)
inline

Constructor for a block's metadata.

Parameters
[in]first_instruction_load_addressThe load address of the block's first instruction.
[in]num_instructionsThe total number of instructions in the block.
[in]func_callsThe map of a function name to the number of times it is called from the block.

Definition at line 36 of file TraceHTR.h.

Member Function Documentation

◆ GetFirstInstructionLoadAddress()

lldb::addr_t HTRBlockMetadata::GetFirstInstructionLoadAddress ( ) const

Get the load address of the first instruction in the block.

Returns
The load address of the first instruction in the block.

Definition at line 46 of file TraceHTR.cpp.

References m_first_instruction_load_address.

Referenced by lldb_private::BasicSuperBlockMerge(), and lldb_private::toJSON().

◆ GetFunctionCalls()

llvm::DenseMap< ConstString, size_t > const & HTRBlockMetadata::GetFunctionCalls ( ) const

Get the function calls map for the block.

Function calls are identified in the instruction layer by finding 'call' instructions and determining the function they are calling. As these instructions are merged into blocks, we merge these different function calls into a single map containing the function names to the number of times it is called from this block.

Returns
The mapping of function name to the number of times it is called from this block.

Definition at line 42 of file TraceHTR.cpp.

References m_func_calls.

Referenced by lldb_private::toJSON().

◆ GetMostFrequentlyCalledFunction()

std::optional< llvm::StringRef > HTRBlockMetadata::GetMostFrequentlyCalledFunction ( ) const

Get the name of the most frequently called function from the block.

Returns
The name of the function that is called the most from this block or std::nullopt if no function is called from this block.

Definition at line 27 of file TraceHTR.cpp.

References lldb_private::ConstString::GetStringRef(), and m_func_calls.

Referenced by lldb_private::toJSON().

◆ GetNumInstructions()

size_t HTRBlockMetadata::GetNumInstructions ( ) const

Get the number of instructions in the block.

Returns
The number of instructions in the block.

Definition at line 22 of file TraceHTR.cpp.

References m_num_instructions.

Referenced by lldb_private::toJSON().

◆ MergeMetadata()

void HTRBlockMetadata::MergeMetadata ( HTRBlockMetadata merged_metadata,
HTRBlockMetadata const &  metadata_to_merge 
)
static

Merge two HTRBlockMetadata in place.

Parameters
[in]

out] merged_metadata Metadata that metadata_to_merge will be merged into.

Parameters
[in]metadata_to_mergeMetadata to merge into merged_metadata.

Definition at line 189 of file TraceHTR.cpp.

References m_func_calls, and m_num_instructions.

Referenced by lldb_private::IHTRLayer::MergeUnits().

Member Data Documentation

◆ m_first_instruction_load_address

lldb::addr_t lldb_private::HTRBlockMetadata::m_first_instruction_load_address
private

Definition at line 83 of file TraceHTR.h.

Referenced by GetFirstInstructionLoadAddress().

◆ m_func_calls

llvm::DenseMap<ConstString, size_t> lldb_private::HTRBlockMetadata::m_func_calls
private

Definition at line 85 of file TraceHTR.h.

Referenced by GetFunctionCalls(), GetMostFrequentlyCalledFunction(), and MergeMetadata().

◆ m_num_instructions

size_t lldb_private::HTRBlockMetadata::m_num_instructions
private

Definition at line 84 of file TraceHTR.h.

Referenced by GetNumInstructions(), and MergeMetadata().


The documentation for this class was generated from the following files: