Go to the documentation of this file.
41 #ifndef __CPU_O3_DEP_GRAPH_HH__
42 #define __CPU_O3_DEP_GRAPH_HH__
47 template <
class DynInstPtr>
70 template <
class DynInstPtr>
84 void resize(
int num_entries);
138 template <
class DynInstPtr>
143 template <
class DynInstPtr>
147 numEntries = num_entries;
148 dependGraph.resize(numEntries);
151 template <
class DynInstPtr>
159 for (
int i = 0;
i < numEntries; ++
i) {
160 curr = dependGraph[
i].
next;
172 if (dependGraph[
i].inst) {
173 dependGraph[
i].
inst = NULL;
176 dependGraph[
i].next = NULL;
180 template <
class DynInstPtr>
183 const DynInstPtr &new_inst)
191 new_entry->
next = dependGraph[idx].next;
192 new_entry->
inst = new_inst;
195 dependGraph[idx].next = new_entry;
201 template <
class DynInstPtr>
204 const DynInstPtr &inst_to_remove)
220 while (curr->
inst != inst_to_remove) {
225 assert(curr != NULL);
239 template <
class DynInstPtr>
244 node = dependGraph[idx].
next;
245 DynInstPtr inst = NULL;
248 dependGraph[idx].next = node->
next;
256 template <
class DynInstPtr>
260 for (
int i = 0;
i < numEntries; ++
i) {
267 template <
class DynInstPtr>
273 for (
int i = 0;
i < numEntries; ++
i)
275 curr = &dependGraph[
i];
278 cprintf(
"dependGraph[%i]: producer: %s [sn:%lli] consumer: ",
279 i, curr->
inst->pcState(), curr->
inst->seqNum);
281 cprintf(
"dependGraph[%i]: No producer. consumer: ",
i);
284 while (curr->
next != NULL) {
288 curr->
inst->pcState(), curr->
inst->seqNum);
293 cprintf(
"memAllocCounter: %i\n", memAllocCounter);
296 #endif // __CPU_O3_DEP_GRAPH_HH__
void resize(int num_entries)
Resize the dependency graph to have num_entries registers.
void remove(PhysRegIndex idx, const DynInstPtr &inst_to_remove)
Removes an instruction from a single linked list.
DependencyEntry< DynInstPtr > DepEntry
bool empty() const
Checks if the entire dependency graph is empty.
Array of linked list that maintains the dependencies between producing instructions and consuming ins...
DependencyGraph()
Default construction.
void cprintf(const char *format, const Args &...args)
DependencyEntry< DynInstPtr > * next
bool empty(PhysRegIndex idx) const
Checks if there are any dependents on a specific register.
void dump()
Debugging function to dump out the dependency graph.
DynInstPtr pop(PhysRegIndex idx)
Removes and returns the newest dependent of a specific register.
short int PhysRegIndex
Physical register index type.
void clearInst(PhysRegIndex idx)
Clears the producing instruction.
int numEntries
Number of linked lists; identical to the number of registers.
void setInst(PhysRegIndex idx, const DynInstPtr &new_inst)
Sets the producing instruction of a given register.
void reset()
Clears all of the linked lists.
std::vector< DepEntry > dependGraph
Array of linked lists.
void insert(PhysRegIndex idx, const DynInstPtr &new_inst)
Inserts an instruction to be dependent on the given index.
Generated on Wed Sep 30 2020 14:02:09 for gem5 by doxygen 1.8.17