gem5  v22.1.0.0
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
gem5::AddrRangeMap< V, max_cache_size > Class Template Reference

The AddrRangeMap uses an STL map to implement an interval tree for address decoding. More...

#include <addr_range_map.hh>

Public Types

typedef RangeMap::iterator iterator
 
typedef RangeMap::const_iterator const_iterator
 

Public Member Functions

iterator insert (const AddrRange &r, const V &d)
 
void erase (iterator p)
 
void erase (iterator p, iterator q)
 
void clear ()
 
const_iterator begin () const
 
iterator begin ()
 
const_iterator end () const
 
iterator end ()
 
std::size_t size () const
 
bool empty () const
 
const_iterator contains (const AddrRange &r) const
 Find entry that contains the given address range. More...
 
iterator contains (const AddrRange &r)
 
const_iterator contains (Addr r) const
 Find entry that contains the given address. More...
 
iterator contains (Addr r)
 
const_iterator intersects (const AddrRange &r) const
 Find entry that intersects with the given address range. More...
 
iterator intersects (const AddrRange &r)
 

Private Types

typedef std::map< AddrRange, V > RangeMap
 

Private Member Functions

void addNewEntryToCache (iterator it) const
 Add an address range map entry to the cache. More...
 
iterator find (const AddrRange &r, std::function< bool(const AddrRange)> cond)
 Find entry that satisfies a condition on an address range. More...
 
const_iterator find (const AddrRange &r, std::function< bool(const AddrRange)> cond) const
 

Private Attributes

RangeMap tree
 
std::list< iteratorcache
 A list of iterator that correspond to the max_cache_size most recently used entries in the address range map. More...
 

Detailed Description

template<typename V, int max_cache_size = 0>
class gem5::AddrRangeMap< V, max_cache_size >

The AddrRangeMap uses an STL map to implement an interval tree for address decoding.

The value stored is a template type and can be e.g. a port identifier, or a pointer.

Definition at line 62 of file addr_range_map.hh.

Member Typedef Documentation

◆ RangeMap

template<typename V , int max_cache_size = 0>
typedef std::map<AddrRange, V> gem5::AddrRangeMap< V, max_cache_size >::RangeMap
private

Definition at line 65 of file addr_range_map.hh.

Member Function Documentation

◆ addNewEntryToCache()

template<typename V , int max_cache_size = 0>
void gem5::AddrRangeMap< V, max_cache_size >::addNewEntryToCache ( iterator  it) const
inlineprivate

Add an address range map entry to the cache.

Parameters
itIterator to the entry in the address range map

Definition at line 256 of file addr_range_map.hh.

References gem5::AddrRangeMap< V, max_cache_size >::cache.

Referenced by gem5::AddrRangeMap< V, max_cache_size >::find().

◆ find() [1/2]

template<typename V , int max_cache_size = 0>
iterator gem5::AddrRangeMap< V, max_cache_size >::find ( const AddrRange r,
std::function< bool(const AddrRange)>  cond 
)
inlineprivate

Find entry that satisfies a condition on an address range.

Searches through the ranges in the address map and returns an iterator to the entry that satisfies the input conidition on the input address range. Returns end() if none found.

Parameters
rAn input address range
fA condition on an address range
Returns
An iterator that contains the input address range

Definition at line 287 of file addr_range_map.hh.

References gem5::AddrRangeMap< V, max_cache_size >::addNewEntryToCache(), gem5::AddrRangeMap< V, max_cache_size >::begin(), gem5::VegaISA::c, gem5::AddrRangeMap< V, max_cache_size >::cache, gem5::ArmISA::cond, gem5::AddrRangeMap< V, max_cache_size >::end(), gem5::ArmISA::i, gem5::VegaISA::r, and gem5::AddrRangeMap< V, max_cache_size >::tree.

Referenced by gem5::AddrRangeMap< V, max_cache_size >::contains(), gem5::AddrRangeMap< V, max_cache_size >::find(), and gem5::AddrRangeMap< V, max_cache_size >::intersects().

◆ find() [2/2]

template<typename V , int max_cache_size = 0>
const_iterator gem5::AddrRangeMap< V, max_cache_size >::find ( const AddrRange r,
std::function< bool(const AddrRange)>  cond 
) const
inlineprivate

Member Data Documentation

◆ cache

template<typename V , int max_cache_size = 0>
std::list<iterator> gem5::AddrRangeMap< V, max_cache_size >::cache
mutableprivate

A list of iterator that correspond to the max_cache_size most recently used entries in the address range map.

This mainly used to optimize lookups. The elements in the list should always be valid iterators of the tree.

Definition at line 337 of file addr_range_map.hh.

Referenced by gem5::AddrRangeMap< V, max_cache_size >::addNewEntryToCache(), gem5::AddrRangeMap< V, max_cache_size >::clear(), gem5::AddrRangeMap< V, max_cache_size >::erase(), and gem5::AddrRangeMap< V, max_cache_size >::find().

◆ tree

template<typename V , int max_cache_size = 0>
RangeMap gem5::AddrRangeMap< V, max_cache_size >::tree
private

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

Generated on Wed Dec 21 2022 10:23:11 for gem5 by doxygen 1.9.1