Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: MemoryAccessHistory.h | |
5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
7 | * | |
8 | * The above named program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public | |
10 | * License version 2 as published by the Free Software Foundation. | |
11 | * | |
12 | * The above named program is distributed in the hope that it will be | |
13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public | |
18 | * License along with this work; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | * | |
21 | * ========== Copyright Header End ============================================ | |
22 | */ | |
23 | #ifndef _MEMORYACCESSHISTORY_H | |
24 | #define _MEMORYACCESSHISTORY_H | |
25 | /************************************************************************ | |
26 | ** | |
27 | ** Copyright (C) 2002, Sun Microsystems, Inc. | |
28 | ** | |
29 | ** Sun considers its source code as an unpublished, proprietary | |
30 | ** trade secret and it is available only under strict license provisions. | |
31 | ** This copyright notice is placed here only to protect Sun in the event | |
32 | ** the source is deemed a published work. Disassembly, decompilation, | |
33 | ** or other means of reducing the object code to human readable form | |
34 | ** is prohibited by the license agreement under which this code is | |
35 | ** provided to the user or company in possession of this copy." | |
36 | ** | |
37 | *************************************************************************/ | |
38 | #include <iostream> | |
39 | ||
40 | #include <map> | |
41 | #include <list> | |
42 | ||
43 | #include "MemorySyncMessage.h" | |
44 | #include "TsoCheckerDefs.h" | |
45 | #include "TsoNode.h" | |
46 | #include "TsoEdge.h" | |
47 | #include "MemoryAccessHistoryItem.h" | |
48 | ||
49 | namespace Tso { | |
50 | ||
51 | class MemoryAccessHistory { | |
52 | ||
53 | public: | |
54 | /** | |
55 | * Default constructor | |
56 | */ | |
57 | MemoryAccessHistory(); | |
58 | ||
59 | /** | |
60 | * Copy constructor | |
61 | * | |
62 | * @param orig The MemoryAccessHistory object to copy. | |
63 | */ | |
64 | MemoryAccessHistory( const MemoryAccessHistory &orig ); | |
65 | ||
66 | /** | |
67 | * Destructor | |
68 | */ | |
69 | virtual ~MemoryAccessHistory(); | |
70 | ||
71 | /** | |
72 | * Equality operator | |
73 | * | |
74 | * @param rhs The right hand side of the equality operator | |
75 | * @return Return true if this objec and rhs are equal, | |
76 | * otherwise return false | |
77 | */ | |
78 | bool operator==( const MemoryAccessHistory &rhs ) const; | |
79 | ||
80 | /** | |
81 | * Assignment operator | |
82 | * | |
83 | * @param rhs The right hand side of the assignment operator. | |
84 | * @return The lvalue of the assignment. | |
85 | */ | |
86 | const MemoryAccessHistory & operator=( const MemoryAccessHistory &rhs ); | |
87 | ||
88 | /** | |
89 | * Return a string representation of this MemoryAccessHistory object. | |
90 | */ | |
91 | std::string toString() const; | |
92 | ||
93 | /** | |
94 | * This method performs the following tasks on a store node | |
95 | * - register a store to the hist_ if its address is a new one, | |
96 | * - create anti-dependence edges from all loads in the ldNodeList_ to this node, | |
97 | * - create the output_dependece edge from the prior store to this node, | |
98 | * - set retirement time of the prior store node | |
99 | * <p> | |
100 | * Note the aforementioned tasks are performed on every valid byte of the store node. | |
101 | * <p> | |
102 | * @param storeNode The node pointer to be handled | |
103 | */ | |
104 | void storeCommit (TsoNode* storeNode); | |
105 | ||
106 | /** | |
107 | * This method performs the following tasks on a load node | |
108 | * - create the flow-dependence edge from the store node that is the nearest one | |
109 | * (in time) before the load node to the node | |
110 | * - create the anti-dependence edge from the load node to the store node that is | |
111 | * the nearest (in time) after the load node | |
112 | * <p> | |
113 | * @param loadNode The node pointer to be handled | |
114 | */ | |
115 | void loadAccess (TsoNode* loadNode); | |
116 | ||
117 | /** | |
118 | * Remove a store node pointer from the stNodeList_ | |
119 | * @param storeNodeP The store node pointer to be removed | |
120 | */ | |
121 | void removeStoreNode (TsoNode* storeNodeP); | |
122 | ||
123 | protected: | |
124 | ||
125 | private: | |
126 | /** | |
127 | * hist_ contains a list of <addr, MemoryAccessHistoryItem> pair. | |
128 | * Each pair is for one byte, hence, the address is a byte address. | |
129 | * The corresponding MemoryAccessHistoryItem then keeps the update | |
130 | * history of this address. | |
131 | */ | |
132 | std::map<uint64_t,MemoryAccessHistoryItem> hist_; | |
133 | }; | |
134 | ||
135 | } /* namespace Tso */ | |
136 | ||
137 | #endif /* _MEMORYACCESSHISTORY_H */ |