arch: nuke arch/isa_specific.hh and move stuff to generated config/the_isa.hh
[gem5.git] / src / cpu / inorder / reg_dep_map.hh
1 /*
2 * Copyright (c) 2007 MIPS Technologies, Inc.
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: Korey Sewell
29 *
30 */
31
32 #ifndef CPU_INORDER_REG_DEP_MAP_HH
33 #define CPU_INORDER_REG_DEP_MAP_HH
34
35 #include <list>
36 #include <vector>
37
38 #include "arch/isa_traits.hh"
39 #include "config/the_isa.hh"
40 #include "cpu/inorder/pipeline_traits.hh"
41
42 class InOrderCPU;
43
44 class RegDepMap
45 {
46 typedef ThePipeline::DynInstPtr DynInstPtr;
47
48 public:
49 RegDepMap(int size = TheISA::TotalNumRegs);
50
51 ~RegDepMap() { }
52
53 std::string name();
54
55 void setCPU(InOrderCPU *_cpu);
56
57 /** Clear the Entire Map */
58 void clear();
59
60 /** Insert all of a instruction's destination registers into map*/
61 void insert(DynInstPtr inst);
62
63 /** Insert an instruction into a specific destination register index onto map */
64 void insert(unsigned idx, DynInstPtr inst);
65
66 /** Remove all of a instruction's destination registers into map*/
67 void remove(DynInstPtr inst);
68
69 /** Remove a specific instruction and destination register index from map */
70 void remove(unsigned idx, DynInstPtr inst);
71
72 /** Remove Front instruction from a destination register */
73 void removeFront(unsigned idx, DynInstPtr inst);
74
75 /** Is the current instruction able to read from this destination register? */
76 bool canRead(unsigned idx, DynInstPtr inst);
77
78 /** Is the current instruction able to get a forwarded value from another instruction
79 * for this destination register? */
80 DynInstPtr canForward(unsigned reg_idx, unsigned src_idx, DynInstPtr inst);
81
82 /** find an instruction to forward/bypass a value from */
83 DynInstPtr findBypassInst(unsigned idx);
84
85 /** Is the current instruction able to write to this destination register? */
86 bool canWrite(unsigned idx, DynInstPtr inst);
87
88 /** Size of Dependency of Map */
89 int depSize(unsigned idx);
90
91 protected:
92 // Eventually make this a map of lists for
93 // efficiency sake!
94 std::vector<std::list<DynInstPtr> > regMap;
95
96 InOrderCPU *cpu;
97 };
98
99 #endif
100
101
102
103
104
105
106