gem5  v20.1.0.0
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
SimpleRenameMap Class Reference

Register rename map for a single class of registers (e.g., integer or floating point). More...

#include <rename_map.hh>

Public Types

using iterator = Arch2PhysMap::iterator
 
using const_iterator = Arch2PhysMap::const_iterator
 
typedef std::pair< PhysRegIdPtr, PhysRegIdPtrRenameInfo
 Pair of a physical register and a physical register. More...
 

Public Member Functions

 SimpleRenameMap ()
 
 ~SimpleRenameMap ()
 
void init (unsigned size, SimpleFreeList *_freeList, RegIndex _zeroReg)
 Because we have an array of rename maps (one per thread) in the CPU, it's awkward to initialize this object via the constructor. More...
 
RenameInfo rename (const RegId &arch_reg)
 Tell rename map to get a new free physical register to remap the specified architectural register. More...
 
PhysRegIdPtr lookup (const RegId &arch_reg) const
 Look up the physical register mapped to an architectural register. More...
 
void setEntry (const RegId &arch_reg, PhysRegIdPtr phys_reg)
 Update rename map with a specific mapping. More...
 
unsigned numFreeEntries () const
 Return the number of free entries on the associated free list. More...
 
iterator begin ()
 Forward begin/cbegin to the map. More...
 
const_iterator begin () const
 
const_iterator cbegin () const
 
iterator end ()
 Forward end/cend to the map. More...
 
const_iterator end () const
 
const_iterator cend () const
 

Private Types

using Arch2PhysMap = std::vector< PhysRegIdPtr >
 

Private Attributes

Arch2PhysMap map
 The acutal arch-to-phys register map. More...
 
SimpleFreeListfreeList
 Pointer to the free list from which new physical registers should be allocated in rename() More...
 
RegId zeroReg
 The architectural index of the zero register. More...
 

Detailed Description

Register rename map for a single class of registers (e.g., integer or floating point).

Because the register class is implicitly determined by the rename map instance being accessed, all architectural register index parameters and values in this class are relative (e.g., fp2 is just index 2).

Definition at line 63 of file rename_map.hh.

Member Typedef Documentation

◆ Arch2PhysMap

Definition at line 66 of file rename_map.hh.

◆ const_iterator

using SimpleRenameMap::const_iterator = Arch2PhysMap::const_iterator

Definition at line 71 of file rename_map.hh.

◆ iterator

using SimpleRenameMap::iterator = Arch2PhysMap::iterator

Definition at line 70 of file rename_map.hh.

◆ RenameInfo

Pair of a physical register and a physical register.

Used to return the physical register that a logical register has been renamed to, and the previous physical register that the same logical register was previously mapped to.

Definition at line 108 of file rename_map.hh.

Constructor & Destructor Documentation

◆ SimpleRenameMap()

SimpleRenameMap::SimpleRenameMap ( )

Definition at line 53 of file rename_map.cc.

◆ ~SimpleRenameMap()

SimpleRenameMap::~SimpleRenameMap ( )
inline

Definition at line 93 of file rename_map.hh.

Member Function Documentation

◆ begin() [1/2]

iterator SimpleRenameMap::begin ( )
inline

Forward begin/cbegin to the map.

Definition at line 149 of file rename_map.hh.

References map.

◆ begin() [2/2]

const_iterator SimpleRenameMap::begin ( ) const
inline

Definition at line 150 of file rename_map.hh.

References map.

◆ cbegin()

const_iterator SimpleRenameMap::cbegin ( ) const
inline

Definition at line 151 of file rename_map.hh.

References map.

◆ cend()

const_iterator SimpleRenameMap::cend ( ) const
inline

Definition at line 158 of file rename_map.hh.

References map.

◆ end() [1/2]

iterator SimpleRenameMap::end ( )
inline

Forward end/cend to the map.

Definition at line 156 of file rename_map.hh.

References map.

◆ end() [2/2]

const_iterator SimpleRenameMap::end ( ) const
inline

Definition at line 157 of file rename_map.hh.

References map.

◆ init()

void SimpleRenameMap::init ( unsigned  size,
SimpleFreeList _freeList,
RegIndex  _zeroReg 
)

Because we have an array of rename maps (one per thread) in the CPU, it's awkward to initialize this object via the constructor.

Instead, this method is used for initialization.

Definition at line 60 of file rename_map.cc.

References freeList, IntRegClass, map, and zeroReg.

Referenced by UnifiedRenameMap::init().

◆ lookup()

PhysRegIdPtr SimpleRenameMap::lookup ( const RegId arch_reg) const
inline

Look up the physical register mapped to an architectural register.

Parameters
arch_regThe architectural register to look up.
Returns
The physical register it is currently mapped to.

Definition at line 125 of file rename_map.hh.

References RegId::flatIndex(), and map.

Referenced by UnifiedRenameMap::lookup(), and UnifiedRenameMap::switchMode().

◆ numFreeEntries()

unsigned SimpleRenameMap::numFreeEntries ( ) const
inline

◆ rename()

SimpleRenameMap::RenameInfo SimpleRenameMap::rename ( const RegId arch_reg)

Tell rename map to get a new free physical register to remap the specified architectural register.

Parameters
arch_regThe architectural register to remap.
Returns
A RenameInfo pair indicating both the new and previous physical registers.

Definition at line 72 of file rename_map.cc.

References PhysRegId::decrNumPinnedWrites(), DPRINTF, RegId::flatIndex(), PhysRegId::flatIndex(), freeList, RegId::getNumPinnedWrites(), PhysRegId::getNumPinnedWrites(), SimpleFreeList::getReg(), PhysRegId::isZeroReg(), map, PhysRegId::setNumPinnedWrites(), PhysRegId::setNumPinnedWritesToComplete(), and zeroReg.

Referenced by UnifiedRenameMap::rename().

◆ setEntry()

void SimpleRenameMap::setEntry ( const RegId arch_reg,
PhysRegIdPtr  phys_reg 
)
inline

Update rename map with a specific mapping.

Generally used to roll back to old mappings on a squash.

Parameters
arch_regThe architectural register to remap.
phys_regThe physical register to remap it to.

Definition at line 138 of file rename_map.hh.

References RegId::flatIndex(), and map.

Referenced by UnifiedRenameMap::setEntry().

Member Data Documentation

◆ freeList

SimpleFreeList* SimpleRenameMap::freeList
private

Pointer to the free list from which new physical registers should be allocated in rename()

Definition at line 78 of file rename_map.hh.

Referenced by init(), numFreeEntries(), and rename().

◆ map

Arch2PhysMap SimpleRenameMap::map
private

The acutal arch-to-phys register map.

Definition at line 68 of file rename_map.hh.

Referenced by begin(), cbegin(), cend(), end(), init(), lookup(), rename(), and setEntry().

◆ zeroReg

RegId SimpleRenameMap::zeroReg
private

The architectural index of the zero register.

This register is mapped but read-only, so we ignore attempts to rename it via the rename() method. If there is no such register for this map table, it should be set to an invalid index so that it never matches.

Definition at line 87 of file rename_map.hh.

Referenced by init(), and rename().


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

Generated on Wed Sep 30 2020 14:02:31 for gem5 by doxygen 1.8.17