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>

Collaboration diagram for lldb_private::HTRBlockMetadata:
Collaboration graph
[legend]

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. More...
 
size_t GetNumInstructions () const
 Get the number of instructions in the block. More...
 
llvm::Optional< llvm::StringRef > GetMostFrequentlyCalledFunction () const
 Get the name of the most frequently called function from the block. More...
 
lldb::addr_t GetFirstInstructionLoadAddress () const
 Get the load address of the first instruction in the block. More...
 
const llvm::DenseMap< ConstString, size_t > & GetFunctionCalls () const
 Get the function calls map for the block. More...
 

Static Public Member Functions

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

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 45 of file TraceHTR.cpp.

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

◆ GetFunctionCalls()

const llvm::DenseMap< ConstString, size_t > & 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 41 of file TraceHTR.cpp.

Referenced by lldb_private::toJSON().

◆ GetMostFrequentlyCalledFunction()

llvm::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 None if no function is called from this block.

Definition at line 26 of file TraceHTR.cpp.

References lldb_private::ConstString::GetStringRef().

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 21 of file TraceHTR.cpp.

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]

Definition at line 183 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.

◆ 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 MergeMetadata().

◆ m_num_instructions

size_t lldb_private::HTRBlockMetadata::m_num_instructions
private

Definition at line 84 of file TraceHTR.h.

Referenced by MergeMetadata().


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