CPU: Get rid of the now unnecessary getInst/setInst family of functions.
[gem5.git] / src / cpu / ozone / ea_list.hh
1 /*
2 * Copyright (c) 2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Kevin Lim
29 * Nathan Binkert
30 */
31
32 #ifndef __CPU_EA_LIST_HH__
33 #define __CPU_EA_LIST_HH__
34
35 #include <list>
36 #include <utility>
37
38 #include "base/types.hh"
39 #include "cpu/inst_seq.hh"
40
41 /**
42 * Simple class to hold onto a list of pairs, each pair having a memory
43 * instruction's sequence number and effective addr. This list can be used
44 * for memory disambiguation. However, if I ever want to forward results, I
45 * may have to use a list that holds DynInstPtrs. Hence this may change in
46 * the future.
47 */
48 class EAList {
49 private:
50 typedef std::pair<InstSeqNum, Addr> instEA;
51 typedef std::list<instEA>::iterator eaListIt;
52 typedef std::list<instEA>::const_iterator constEAListIt;
53
54 std::list<instEA> eaList;
55
56 public:
57 EAList() { }
58 ~EAList() { }
59
60 void addAddr(const InstSeqNum &new_sn, const Addr &new_ea);
61
62 void clearAddr(const InstSeqNum &sn_to_clear, const Addr &ea_to_clear);
63
64 /** Checks if any instructions older than check_sn have a conflicting
65 * address with check_ea. Note that this function does not handle the
66 * sequence number rolling over.
67 */
68 bool checkConflict(const InstSeqNum &check_sn, const Addr &check_ea) const;
69
70 void clear();
71
72 void commit(const InstSeqNum &commit_sn);
73 };
74
75 #endif // __CPU_EA_LIST_HH__