gem5  v22.1.0.0
Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
gem5::o3::DependencyGraph< DynInstPtr > Class Template Reference

Array of linked list that maintains the dependencies between producing instructions and consuming instructions. More...

#include <dep_graph.hh>

Public Types

typedef DependencyEntry< DynInstPtrDepEntry
 

Public Member Functions

 DependencyGraph ()
 Default construction. More...
 
 ~DependencyGraph ()
 
void resize (int num_entries)
 Resize the dependency graph to have num_entries registers. More...
 
void reset ()
 Clears all of the linked lists. More...
 
void insert (RegIndex idx, const DynInstPtr &new_inst)
 Inserts an instruction to be dependent on the given index. More...
 
void setInst (RegIndex idx, const DynInstPtr &new_inst)
 Sets the producing instruction of a given register. More...
 
void clearInst (RegIndex idx)
 Clears the producing instruction. More...
 
void remove (RegIndex idx, const DynInstPtr &inst_to_remove)
 Removes an instruction from a single linked list. More...
 
DynInstPtr pop (RegIndex idx)
 Removes and returns the newest dependent of a specific register. More...
 
bool empty () const
 Checks if the entire dependency graph is empty. More...
 
bool empty (RegIndex idx) const
 Checks if there are any dependents on a specific register. More...
 
void dump ()
 Debugging function to dump out the dependency graph. More...
 

Public Attributes

uint64_t nodesTraversed
 
uint64_t nodesRemoved
 

Private Attributes

std::vector< DepEntrydependGraph
 Array of linked lists. More...
 
int numEntries
 Number of linked lists; identical to the number of registers. More...
 
unsigned memAllocCounter
 

Detailed Description

template<class DynInstPtr>
class gem5::o3::DependencyGraph< DynInstPtr >

Array of linked list that maintains the dependencies between producing instructions and consuming instructions.

Each linked list represents a single physical register, having the future producer of the register's value, and all consumers waiting on that value on the list. The head node of each linked list represents the producing instruction of that register. Instructions are put on the list upon reaching the IQ, and are removed from the list either when the producer completes, or the instruction is squashed.

Definition at line 77 of file dep_graph.hh.

Member Typedef Documentation

◆ DepEntry

template<class DynInstPtr >
typedef DependencyEntry<DynInstPtr> gem5::o3::DependencyGraph< DynInstPtr >::DepEntry

Definition at line 80 of file dep_graph.hh.

Constructor & Destructor Documentation

◆ DependencyGraph()

template<class DynInstPtr >
gem5::o3::DependencyGraph< DynInstPtr >::DependencyGraph ( )
inline

Default construction.

Must call resize() prior to use.

Definition at line 83 of file dep_graph.hh.

◆ ~DependencyGraph()

template<class DynInstPtr >
gem5::o3::DependencyGraph< DynInstPtr >::~DependencyGraph

Definition at line 145 of file dep_graph.hh.

Member Function Documentation

◆ clearInst()

template<class DynInstPtr >
void gem5::o3::DependencyGraph< DynInstPtr >::clearInst ( RegIndex  idx)
inline

Clears the producing instruction.

Definition at line 103 of file dep_graph.hh.

References gem5::o3::DependencyGraph< DynInstPtr >::dependGraph.

◆ dump()

template<class DynInstPtr >
void gem5::o3::DependencyGraph< DynInstPtr >::dump

◆ empty() [1/2]

template<class DynInstPtr >
bool gem5::o3::DependencyGraph< DynInstPtr >::empty

Checks if the entire dependency graph is empty.

Definition at line 263 of file dep_graph.hh.

References gem5::ArmISA::i.

◆ empty() [2/2]

template<class DynInstPtr >
bool gem5::o3::DependencyGraph< DynInstPtr >::empty ( RegIndex  idx) const
inline

Checks if there are any dependents on a specific register.

Definition at line 116 of file dep_graph.hh.

References gem5::o3::DependencyGraph< DynInstPtr >::dependGraph.

◆ insert()

template<class DynInstPtr >
void gem5::o3::DependencyGraph< DynInstPtr >::insert ( RegIndex  idx,
const DynInstPtr new_inst 
)

Inserts an instruction to be dependent on the given index.

Definition at line 188 of file dep_graph.hh.

References gem5::o3::DependencyEntry< DynInstPtr >::inst, and gem5::o3::DependencyEntry< DynInstPtr >::next.

◆ pop()

template<class DynInstPtr >
DynInstPtr gem5::o3::DependencyGraph< DynInstPtr >::pop ( RegIndex  idx)

Removes and returns the newest dependent of a specific register.

Definition at line 246 of file dep_graph.hh.

References gem5::o3::DependencyEntry< DynInstPtr >::inst, and gem5::o3::DependencyEntry< DynInstPtr >::next.

◆ remove()

template<class DynInstPtr >
void gem5::o3::DependencyGraph< DynInstPtr >::remove ( RegIndex  idx,
const DynInstPtr inst_to_remove 
)

Removes an instruction from a single linked list.

Definition at line 208 of file dep_graph.hh.

References gem5::o3::DependencyEntry< DynInstPtr >::inst, and gem5::o3::DependencyEntry< DynInstPtr >::next.

◆ reset()

template<class DynInstPtr >
void gem5::o3::DependencyGraph< DynInstPtr >::reset

Clears all of the linked lists.

Definition at line 159 of file dep_graph.hh.

References gem5::ArmISA::i, gem5::o3::DependencyEntry< DynInstPtr >::inst, and gem5::o3::DependencyEntry< DynInstPtr >::next.

◆ resize()

template<class DynInstPtr >
void gem5::o3::DependencyGraph< DynInstPtr >::resize ( int  num_entries)

Resize the dependency graph to have num_entries registers.

Definition at line 151 of file dep_graph.hh.

◆ setInst()

template<class DynInstPtr >
void gem5::o3::DependencyGraph< DynInstPtr >::setInst ( RegIndex  idx,
const DynInstPtr new_inst 
)
inline

Sets the producing instruction of a given register.

Definition at line 99 of file dep_graph.hh.

References gem5::o3::DependencyGraph< DynInstPtr >::dependGraph.

Member Data Documentation

◆ dependGraph

template<class DynInstPtr >
std::vector<DepEntry> gem5::o3::DependencyGraph< DynInstPtr >::dependGraph
private

Array of linked lists.

Each linked list is a list of all the instructions that depend upon a given register. The actual register's index is used to index into the graph; ie all instructions in flight that are dependent upon r34 will be in the linked list of dependGraph[34].

Definition at line 129 of file dep_graph.hh.

Referenced by gem5::o3::DependencyGraph< DynInstPtr >::clearInst(), gem5::o3::DependencyGraph< DynInstPtr >::empty(), and gem5::o3::DependencyGraph< DynInstPtr >::setInst().

◆ memAllocCounter

template<class DynInstPtr >
unsigned gem5::o3::DependencyGraph< DynInstPtr >::memAllocCounter
private

Definition at line 135 of file dep_graph.hh.

◆ nodesRemoved

template<class DynInstPtr >
uint64_t gem5::o3::DependencyGraph< DynInstPtr >::nodesRemoved

Definition at line 141 of file dep_graph.hh.

◆ nodesTraversed

template<class DynInstPtr >
uint64_t gem5::o3::DependencyGraph< DynInstPtr >::nodesTraversed

Definition at line 139 of file dep_graph.hh.

◆ numEntries

template<class DynInstPtr >
int gem5::o3::DependencyGraph< DynInstPtr >::numEntries
private

Number of linked lists; identical to the number of registers.

Definition at line 132 of file dep_graph.hh.


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

Generated on Wed Dec 21 2022 10:24:18 for gem5 by doxygen 1.9.1