Deleted Added
sdiff udiff text old ( 2669:f2b336e89d2a ) new ( 2674:6d4afef73a20 )
full compact
1
2#ifndef __CPU_O3_DEP_GRAPH_HH__
3#define __CPU_O3_DEP_GRAPH_HH__
4
5#include "cpu/o3/comm.hh"
6
7template <class DynInstPtr>
8class DependencyEntry
9{
10 public:
11 DependencyEntry()
12 : inst(NULL), next(NULL)
13 { }
14
15 DynInstPtr inst;
16 //Might want to include data about what arch. register the
17 //dependence is waiting on.
18 DependencyEntry<DynInstPtr> *next;
19};
20
21template <class DynInstPtr>
22class DependencyGraph
23{
24 public:
25 typedef DependencyEntry<DynInstPtr> DepEntry;
26
27 DependencyGraph()
28 : numEntries(0), memAllocCounter(0), nodesTraversed(0), nodesRemoved(0)
29 { }
30
31 void resize(int num_entries);
32
33 void reset();
34
35 void insert(PhysRegIndex idx, DynInstPtr &new_inst);
36
37 void setInst(PhysRegIndex idx, DynInstPtr &new_inst)
38 { dependGraph[idx].inst = new_inst; }
39
40 void clearInst(PhysRegIndex idx)
41 { dependGraph[idx].inst = NULL; }
42
43 void remove(PhysRegIndex idx, DynInstPtr &inst_to_remove);
44
45 DynInstPtr pop(PhysRegIndex idx);
46
47 bool empty(PhysRegIndex idx) { return !dependGraph[idx].next; }
48
49 /** Debugging function to dump out the dependency graph.
50 */
51 void dump();
52
53 private:
54 /** Array of linked lists. Each linked list is a list of all the
55 * instructions that depend upon a given register. The actual
56 * register's index is used to index into the graph; ie all
57 * instructions in flight that are dependent upon r34 will be
58 * in the linked list of dependGraph[34].
59 */
60 DepEntry *dependGraph;
61
62 int numEntries;
63
64 // Debug variable, remove when done testing.
65 unsigned memAllocCounter;
66
67 public:
68 uint64_t nodesTraversed;
69 uint64_t nodesRemoved;
70};
71
72template <class DynInstPtr>
73void
74DependencyGraph<DynInstPtr>::resize(int num_entries)
75{
76 numEntries = num_entries;

--- 137 unchanged lines hidden ---