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

HTR layer composed of blocks of the trace. More...

#include <TraceHTR.h>

Inheritance diagram for lldb_private::HTRBlockLayer:
Inheritance graph
[legend]

Public Member Functions

 HTRBlockLayer (size_t id)
 Construct new block layer.
 
size_t GetNumUnits () const override
 Get the total number of units (instruction or block) in this layer.
 
HTRBlockMetadata GetMetadataByIndex (size_t index) const override
 Get the metadata of a unit (instruction or block) in the layer.
 
HTRBlock const * GetBlockById (size_t block_id) const
 Get an HTRBlock from its block id.
 
llvm::ArrayRef< size_t > GetBlockIdTrace () const
 Get the block ID trace for this layer.
 
void AppendNewBlock (size_t block_id, HTRBlock &&block)
 Appends a new block to the layer.
 
void AppendRepeatedBlock (size_t block_id)
 Appends a repeated block to the layer.
 
- Public Member Functions inherited from lldb_private::IHTRLayer
 IHTRLayer (size_t id)
 Construct new HTR layer.
 
size_t GetLayerId () const
 Get the ID of the layer.
 
virtual HTRBlockMetadata GetMetadataByIndex (size_t index) const =0
 Get the metadata of a unit (instruction or block) in the layer.
 
virtual size_t GetNumUnits () const =0
 Get the total number of units (instruction or block) in this layer.
 
HTRBlock MergeUnits (size_t start_unit_index, size_t num_units)
 Creates a new block from the result of merging a contiguous sequence of "units" (instructions or blocks depending on layer type) in this layer This allows the implementation class to decide how to store/generate this metadata.
 
virtual ~IHTRLayer ()=default
 

Private Attributes

std::unordered_map< size_t, HTRBlockm_block_defs
 Maps a unique Block ID to the corresponding HTRBlock.
 
std::vector< size_t > m_block_id_trace
 Reduce memory footprint by just storing a trace of block IDs and use m_block_defs to map a block_id to its corresponding HTRBlock.
 

Additional Inherited Members

- Protected Attributes inherited from lldb_private::IHTRLayer
size_t m_layer_id
 ID of the layer.
 

Detailed Description

HTR layer composed of blocks of the trace.

See lldb/docs/htr.rst for comprehensive HTR documentation

Definition at line 244 of file TraceHTR.h.

Constructor & Destructor Documentation

◆ HTRBlockLayer()

lldb_private::HTRBlockLayer::HTRBlockLayer ( size_t  id)
inline

Construct new block layer.

Parameters
[in]idThe layer's id.

Definition at line 250 of file TraceHTR.h.

Member Function Documentation

◆ AppendNewBlock()

void HTRBlockLayer::AppendNewBlock ( size_t  block_id,
HTRBlock &&  block 
)

Appends a new block to the layer.

Parameters
[in]block_idThe block id of the new block.
[in]blockThe new HTRBlock to be appended to the layer. This block is moved into the layer.

Definition at line 70 of file TraceHTR.cpp.

References m_block_defs, and m_block_id_trace.

◆ AppendRepeatedBlock()

void HTRBlockLayer::AppendRepeatedBlock ( size_t  block_id)

Appends a repeated block to the layer.

Parameters
[in]block_idThe block id of the repeated block.

Definition at line 75 of file TraceHTR.cpp.

References m_block_id_trace.

◆ GetBlockById()

HTRBlock const * HTRBlockLayer::GetBlockById ( size_t  block_id) const

Get an HTRBlock from its block id.

Parameters
[in]block_idThe id of the block to retrieve.
Returns
The HTRBlock with the specified id, nullptr if no there is no block in the layer with the specified block id.

Definition at line 92 of file TraceHTR.cpp.

References m_block_defs.

◆ GetBlockIdTrace()

llvm::ArrayRef< size_t > HTRBlockLayer::GetBlockIdTrace ( ) const

Get the block ID trace for this layer.

This block ID trace stores the block ID of each block that occured in the trace and the block defs map maps block ID to the corresponding HTRBlock.

Returns
The block ID trace for this layer.

Definition at line 100 of file TraceHTR.cpp.

References m_block_id_trace.

◆ GetMetadataByIndex()

HTRBlockMetadata HTRBlockLayer::GetMetadataByIndex ( size_t  index) const
overridevirtual

Get the metadata of a unit (instruction or block) in the layer.

Parameters
[in]indexThe position of the unit in the layer.
Returns
The metadata of the unit in the layer.

Implements lldb_private::IHTRLayer.

Definition at line 123 of file TraceHTR.cpp.

References lldb_private::HTRBlock::GetMetadata(), m_block_defs, and m_block_id_trace.

◆ GetNumUnits()

size_t HTRBlockLayer::GetNumUnits ( ) const
overridevirtual

Get the total number of units (instruction or block) in this layer.

Returns
The total number of units in the layer.

Implements lldb_private::IHTRLayer.

Definition at line 104 of file TraceHTR.cpp.

References m_block_id_trace.

Member Data Documentation

◆ m_block_defs

std::unordered_map<size_t, HTRBlock> lldb_private::HTRBlockLayer::m_block_defs
private

Maps a unique Block ID to the corresponding HTRBlock.

Definition at line 293 of file TraceHTR.h.

Referenced by AppendNewBlock(), GetBlockById(), and GetMetadataByIndex().

◆ m_block_id_trace

std::vector<size_t> lldb_private::HTRBlockLayer::m_block_id_trace
private

Reduce memory footprint by just storing a trace of block IDs and use m_block_defs to map a block_id to its corresponding HTRBlock.

Definition at line 296 of file TraceHTR.h.

Referenced by AppendNewBlock(), AppendRepeatedBlock(), GetBlockIdTrace(), GetMetadataByIndex(), and GetNumUnits().


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