gem5  v22.1.0.0
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
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. More...
 
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. More...
 
 TranslationGenConstIterator ()
 Construct a blank iterator, used by end(). More...
 
 TranslationGenConstIterator (const TranslationGen *parent, Addr start)
 Construct a valid new iterator and set it's starting conditions. More...
 

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 140 of file translation_gen.hh.

Member Typedef Documentation

◆ iterator_category

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

Definition at line 180 of file translation_gen.hh.

◆ pointer

Definition at line 179 of file translation_gen.hh.

◆ reference

Definition at line 178 of file translation_gen.hh.

◆ value_type

Definition at line 177 of file translation_gen.hh.

Constructor & Destructor Documentation

◆ TranslationGenConstIterator() [1/3]

gem5::TranslationGenConstIterator::TranslationGenConstIterator ( )
inlineprivate

Construct a blank iterator, used by end().

Definition at line 168 of file translation_gen.hh.

◆ 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 170 of file translation_gen.hh.

References update().

◆ TranslationGenConstIterator() [3/3]

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

Definition at line 182 of file translation_gen.hh.

Member Function Documentation

◆ operator!=()

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

Definition at line 246 of file translation_gen.hh.

◆ operator*()

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

Definition at line 194 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 212 of file translation_gen.hh.

References current, end, gem5::TranslationGen::Range::fault, gen, gem5::NoFault, panic_if, gem5::TranslationGen::Range::size, update(), and gem5::TranslationGen::Range::vaddr.

◆ operator++() [2/2]

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

Definition at line 232 of file translation_gen.hh.

◆ operator->()

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

Definition at line 195 of file translation_gen.hh.

References current.

◆ operator=()

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

Definition at line 187 of file translation_gen.hh.

References current, and gen.

◆ operator==()

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

Definition at line 240 of file translation_gen.hh.

References current, gen, and gem5::TranslationGen::Range::vaddr.

◆ update()

void gem5::TranslationGenConstIterator::update ( )
inlineprivate

Friends And Related Function Documentation

◆ TranslationGen

friend class TranslationGen
friend

Definition at line 147 of file translation_gen.hh.

Member Data Documentation

◆ current

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

Definition at line 143 of file translation_gen.hh.

Referenced by operator*(), operator++(), operator->(), operator=(), operator==(), and update().

◆ end

bool gem5::TranslationGenConstIterator::end = true
private

Definition at line 145 of file translation_gen.hh.

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

◆ gen

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

Definition at line 144 of file translation_gen.hh.

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


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

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