41#ifndef __CPU_O3_DEP_GRAPH_HH__
42#define __CPU_O3_DEP_GRAPH_HH__
53template <
class DynInstPtr>
76template <
class DynInstPtr>
144template <
class DynInstPtr>
149template <
class DynInstPtr>
153 numEntries = num_entries;
154 dependGraph.resize(numEntries);
157template <
class DynInstPtr>
165 for (
int i = 0;
i < numEntries; ++
i) {
166 curr = dependGraph[
i].
next;
178 if (dependGraph[
i].inst) {
179 dependGraph[
i].
inst = NULL;
182 dependGraph[
i].next = NULL;
186template <
class DynInstPtr>
196 new_entry->
next = dependGraph[idx].next;
197 new_entry->
inst = new_inst;
200 dependGraph[idx].next = new_entry;
206template <
class DynInstPtr>
225 while (curr->
inst != inst_to_remove) {
230 assert(curr != NULL);
244template <
class DynInstPtr>
249 node = dependGraph[idx].
next;
253 dependGraph[idx].next = node->
next;
261template <
class DynInstPtr>
265 for (
int i = 0;
i < numEntries; ++
i) {
272template <
class DynInstPtr>
278 for (
int i = 0;
i < numEntries; ++
i)
280 curr = &dependGraph[
i];
283 cprintf(
"dependGraph[%i]: producer: %s [sn:%lli] consumer: ",
286 cprintf(
"dependGraph[%i]: No producer. consumer: ",
i);
289 while (curr->
next != NULL) {
298 cprintf(
"memAllocCounter: %i\n", memAllocCounter);
DependencyEntry< DynInstPtr > * next
Array of linked list that maintains the dependencies between producing instructions and consuming ins...
void clearInst(RegIndex idx)
Clears the producing instruction.
DependencyGraph()
Default construction.
void insert(RegIndex idx, const DynInstPtr &new_inst)
Inserts an instruction to be dependent on the given index.
bool empty(RegIndex idx) const
Checks if there are any dependents on a specific register.
bool empty() const
Checks if the entire dependency graph is empty.
void remove(RegIndex idx, const DynInstPtr &inst_to_remove)
Removes an instruction from a single linked list.
void reset()
Clears all of the linked lists.
int numEntries
Number of linked lists; identical to the number of registers.
DynInstPtr pop(RegIndex idx)
Removes and returns the newest dependent of a specific register.
void resize(int num_entries)
Resize the dependency graph to have num_entries registers.
std::vector< DepEntry > dependGraph
Array of linked lists.
void setInst(RegIndex idx, const DynInstPtr &new_inst)
Sets the producing instruction of a given register.
void dump()
Debugging function to dump out the dependency graph.
DependencyEntry< DynInstPtr > DepEntry
const PCStateBase & pcState() const override
Read the PC state of this instruction.
InstSeqNum seqNum
The sequence number of the instruction.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
void cprintf(const char *format, const Args &...args)