gem5 [DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
gem5::TranslationGenConstIterator Class Reference

An iterator for pulling "Range" instances out of a TranslationGen. More...

#include <translation_gen.hh>

Public Types

using value_type = TranslationGen::Range
 
using reference = const value_type &
 
using pointer = const value_type *
 
using iterator_category = std::forward_iterator_tag
 

Public Member Functions

 TranslationGenConstIterator (const TranslationGenConstIterator &other)
 
TranslationGenConstIteratoroperator= (const TranslationGenConstIterator &other)
 
reference operator* ()
 
pointer operator-> ()
 
TranslationGenConstIteratoroperator++ ()
 The increment operator, which is the main work horse of this class.
 
TranslationGenConstIterator operator++ (int)
 
bool operator== (const TranslationGenConstIterator &other) const
 
bool operator!= (const TranslationGenConstIterator &other) const
 

Private Member Functions

void update ()
 Use the vaddr of the "current" Range to update its other fields.
 
 TranslationGenConstIterator ()
 Construct a blank iterator, used by end().
 
 TranslationGenConstIterator (const TranslationGen *parent, Addr start)
 Construct a valid new iterator and set it's starting conditions.
 

Private Attributes

TranslationGen::Range current = {0}
 
const TranslationGengen = nullptr
 
bool end = true
 

Friends

class TranslationGen
 

Detailed Description

An iterator for pulling "Range" instances out of a TranslationGen.

Because only one "Range" instance is valid at a time (and is even reused), only the current value of the iterator is valid. When it's incremented, all prior versions of the iterator become invalid.

The iterator only supports being incremented and getting the next Range from the generator, and so is marked as a "forward" iterator.

Definition at line 143 of file translation_gen.hh.

Member Typedef Documentation

◆ iterator_category

using gem5::TranslationGenConstIterator::iterator_category = std::forward_iterator_tag

Definition at line 183 of file translation_gen.hh.

◆ pointer

Definition at line 182 of file translation_gen.hh.

◆ reference

◆ value_type

Constructor & Destructor Documentation

◆ TranslationGenConstIterator() [1/3]

gem5::TranslationGenConstIterator::TranslationGenConstIterator ( )
inlineprivate

Construct a blank iterator, used by end().

Definition at line 171 of file translation_gen.hh.

Referenced by operator!=(), operator=(), operator==(), and TranslationGenConstIterator().

◆ TranslationGenConstIterator() [2/3]

gem5::TranslationGenConstIterator::TranslationGenConstIterator ( const TranslationGen * parent,
Addr start )
inlineprivate

Construct a valid new iterator and set it's starting conditions.

Definition at line 173 of file translation_gen.hh.

References current, end, gen, TranslationGen, and update().

◆ TranslationGenConstIterator() [3/3]

gem5::TranslationGenConstIterator::TranslationGenConstIterator ( const TranslationGenConstIterator & other)
inline

Definition at line 185 of file translation_gen.hh.

References current, gen, and TranslationGenConstIterator().

Member Function Documentation

◆ operator!=()

bool gem5::TranslationGenConstIterator::operator!= ( const TranslationGenConstIterator & other) const
inline

Definition at line 249 of file translation_gen.hh.

References TranslationGenConstIterator().

◆ operator*()

reference gem5::TranslationGenConstIterator::operator* ( )
inline

Definition at line 197 of file translation_gen.hh.

References current.

◆ operator++() [1/2]

TranslationGenConstIterator & gem5::TranslationGenConstIterator::operator++ ( )
inline

The increment operator, which is the main work horse of this class.

If there was no fault, then the vaddr of the previous translation is incremented by that translation's size.

If there was a fault, then the fault is cleared and vaddr is left alone so the translation can be reattempted.

The size is then set to however much is left to translate. If that is zero, then this iterator will transform into an end iterator. If not, then the "translate" method of the generator is called to translate (or retranslate) the current Range.

Definition at line 215 of file translation_gen.hh.

References current, end, gen, gem5::NoFault, panic_if, and update().

◆ operator++() [2/2]

TranslationGenConstIterator gem5::TranslationGenConstIterator::operator++ ( int )
inline

Definition at line 235 of file translation_gen.hh.

◆ operator->()

pointer gem5::TranslationGenConstIterator::operator-> ( )
inline

Definition at line 198 of file translation_gen.hh.

References current.

◆ operator=()

TranslationGenConstIterator & gem5::TranslationGenConstIterator::operator= ( const TranslationGenConstIterator & other)
inline

Definition at line 190 of file translation_gen.hh.

References current, gen, and TranslationGenConstIterator().

◆ operator==()

bool gem5::TranslationGenConstIterator::operator== ( const TranslationGenConstIterator & other) const
inline

◆ update()

void gem5::TranslationGenConstIterator::update ( )
inlineprivate

Use the vaddr of the "current" Range to update its other fields.

Definition at line 154 of file translation_gen.hh.

References current, end, and gen.

Referenced by operator++(), and TranslationGenConstIterator().

Friends And Related Symbol Documentation

◆ TranslationGen

friend class TranslationGen
friend

Definition at line 150 of file translation_gen.hh.

References TranslationGen.

Referenced by TranslationGen, and TranslationGenConstIterator().

Member Data Documentation

◆ current

TranslationGen::Range gem5::TranslationGenConstIterator::current = {0}
private

◆ end

bool gem5::TranslationGenConstIterator::end = true
private

Definition at line 148 of file translation_gen.hh.

Referenced by operator++(), TranslationGenConstIterator(), and update().

◆ gen

const TranslationGen* gem5::TranslationGenConstIterator::gen = nullptr
private

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

Generated on Mon May 26 2025 09:19:26 for gem5 by doxygen 1.13.2