Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: MemoryAccessHistoryItem.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 _MEMORYACCESSHISTORYITEM_H | |
24 | #define _MEMORYACCESSHISTORYITEM_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 | #include <list> | |
40 | ||
41 | #include "TsoCheckerDefs.h" | |
42 | #include "TsoNode.h" | |
43 | ||
44 | namespace Tso { | |
45 | ||
46 | ||
47 | class MemoryAccessHistoryItem { | |
48 | ||
49 | public: | |
50 | /** | |
51 | * Default constructor | |
52 | */ | |
53 | MemoryAccessHistoryItem(); | |
54 | ||
55 | /** | |
56 | * Copy constructor | |
57 | * | |
58 | * @param orig The MemoryAccessHistoryItem object to copy. | |
59 | */ | |
60 | MemoryAccessHistoryItem( const MemoryAccessHistoryItem &orig ); | |
61 | ||
62 | /** | |
63 | * Destructor | |
64 | */ | |
65 | virtual ~MemoryAccessHistoryItem(); | |
66 | ||
67 | /** | |
68 | * Equality operator | |
69 | * | |
70 | * @param rhs The right hand side of the equality operator | |
71 | * @return Return true if this objec and rhs are equal, | |
72 | * otherwise return false | |
73 | */ | |
74 | bool operator==( const MemoryAccessHistoryItem &rhs ) const; | |
75 | ||
76 | /** | |
77 | * Assignment operator | |
78 | * | |
79 | * @param rhs The right hand side of the assignment operator. | |
80 | * @return The lvalue of the assignment. | |
81 | */ | |
82 | const MemoryAccessHistoryItem & operator=( const MemoryAccessHistoryItem &rhs ); | |
83 | ||
84 | /** | |
85 | * Return a string representation of this MemoryAccessHistoryItem object. | |
86 | */ | |
87 | std::string toString() const; | |
88 | ||
89 | /** | |
90 | * Get the begin iterator of the stNodeList_ | |
91 | */ | |
92 | std::list<TsoNode*>::iterator stNodeBegin() { return stNodeList_.begin(); } | |
93 | ||
94 | /** | |
95 | * Get the end iterator of the stNodeList_ | |
96 | */ | |
97 | std::list<TsoNode*>::iterator stNodeEnd() { return stNodeList_.end(); } | |
98 | ||
99 | /** | |
100 | * Get the begin iterator of the ldNodeList_ | |
101 | */ | |
102 | std::list<TsoNode*>::iterator ldNodeBegin() { return ldNodeList_.begin(); } | |
103 | ||
104 | /** | |
105 | * Get the end iterator of the ldNodeList_ | |
106 | */ | |
107 | std::list<TsoNode*>::iterator ldNodeEnd() { return ldNodeList_.end(); } | |
108 | ||
109 | /** | |
110 | * Get the size of the stNodeList_ | |
111 | */ | |
112 | std::list<TsoNode*>::size_type stNodeSize() { return stNodeList_.size(); } | |
113 | ||
114 | /** | |
115 | * Erase stNodeList_ entry | |
116 | * @param ni The iterator whose corresponding entry is to be erased | |
117 | */ | |
118 | void stNodeErase (std::list<TsoNode*>::iterator ni) { stNodeList_.erase(ni); } | |
119 | ||
120 | /** | |
121 | * Push to the front of the stNodeList_ | |
122 | * @param node The node pointer to be pushed | |
123 | */ | |
124 | void stNodePushFront (TsoNode* node) { stNodeList_.push_front(node); } | |
125 | ||
126 | /** | |
127 | * Push to the front of the ldNodeList_ | |
128 | * @param node The node pointer to be pushed | |
129 | */ | |
130 | void ldNodePushFront (TsoNode* node) { ldNodeList_.push_front(node); } | |
131 | ||
132 | /** | |
133 | * Clear all entries in the ldNodeList_ | |
134 | */ | |
135 | void ldNodeClear () { ldNodeList_.clear(); } | |
136 | ||
137 | /****************************************************************** | |
138 | * Private variable get/set methods | |
139 | ******************************************************************/ | |
140 | void setAddr (uint64_t addr) { addr_ = addr; } | |
141 | void setData (uint8_t data) { data_ = data; } | |
142 | ||
143 | uint64_t getAddr() const { return addr_; } | |
144 | uint8_t getData() const { return data_; } | |
145 | ||
146 | protected: | |
147 | ||
148 | private: | |
149 | /** | |
150 | * addr_ is the byte address of this MemoryAccessHistoryItem | |
151 | */ | |
152 | uint64_t addr_; | |
153 | ||
154 | /** | |
155 | * data_ is the data of this MemoryAccessHistoryItem | |
156 | */ | |
157 | uint8_t data_; | |
158 | ||
159 | /** | |
160 | * stNodeList_ contains the TsoNode pointers of stores that write to this address <br> | |
161 | * Head node is the latest one. | |
162 | */ | |
163 | std::list<TsoNode*> stNodeList_; // store list, front is the latest | |
164 | ||
165 | /** | |
166 | * ldNodeList_ contains the TsoNode pointers of loads that reference to the data | |
167 | * written by the head node in the stNodeList_ | |
168 | */ | |
169 | std::list<TsoNode*> ldNodeList_; // loads that is flow dependent to the latest store node | |
170 | ||
171 | }; | |
172 | ||
173 | } /* namespace Tso */ | |
174 | ||
175 | #endif /* _MEMORYACCESSHISTORYITEM_H */ |