cpu: Refactor memory system checks
[gem5.git] / src / cpu / inorder / reg_dep_map.hh
index 77d0cf0cae4d87a60e718eb346988482ca02b0b5..fa69e22342166f7173685fccd52b36c96865226c 100644 (file)
 
 #include <list>
 #include <vector>
+#include <string>
 
 #include "arch/isa_traits.hh"
 #include "config/the_isa.hh"
 #include "cpu/inorder/pipeline_traits.hh"
 
-class InOrderCPU;
-
 class RegDepMap
 {
+  public:
     typedef ThePipeline::DynInstPtr DynInstPtr;
+    typedef TheISA::RegIndex RegIndex;
+    typedef uint8_t RegType;
 
-  public:
     RegDepMap(int size = TheISA::TotalNumRegs);
-
     ~RegDepMap();
 
+    static std::string mapNames[];
+
     std::string name();
 
     void setCPU(InOrderCPU *_cpu);
@@ -60,47 +62,47 @@ class RegDepMap
     /** Insert all of a instruction's destination registers into map*/
     void insert(DynInstPtr inst);
 
-    /** Insert an instruction into a specific destination register index
-     *  onto map
-     */
-    void insert(unsigned idx, DynInstPtr inst);
-
     /** Remove all of a instruction's destination registers into map*/
     void remove(DynInstPtr inst);
 
-    /** Remove a specific instruction and dest. register index from map*/
-    void remove(unsigned idx, DynInstPtr inst);
-
     /** Remove Front instruction from a destination register */
-    void removeFront(unsigned idx, DynInstPtr inst);
+    void removeFront(uint8_t reg_type, RegIndex idx, DynInstPtr inst);
 
     /** Is the current instruction able to read from this
      *  destination register?
      */
-    bool canRead(unsigned idx, DynInstPtr inst);
+    bool canRead(uint8_t reg_type, RegIndex idx, DynInstPtr inst);
 
     /** Is the current instruction able to get a forwarded value from
      *  another instruction for this destination register?
      */
-    DynInstPtr canForward(unsigned reg_idx, DynInstPtr inst, unsigned clean_idx);
+    DynInstPtr canForward(uint8_t reg_type, unsigned reg_idx,
+                          DynInstPtr inst);
 
     /** find an instruction to forward/bypass a value from */
-    DynInstPtr findBypassInst(unsigned idx);
+    DynInstPtr findBypassInst(RegIndex idx);
 
     /** Is the current instruction able to write to this
      *  destination register?
      */
-    bool canWrite(unsigned idx, DynInstPtr inst);
+    bool canWrite(uint8_t reg_type, RegIndex idx, DynInstPtr inst);
 
     /** Size of Dependency of Map */
-    int depSize(unsigned idx);
+    int depSize(RegIndex idx);
 
     void dump();
     
-  protected:
-    // Eventually make this a map of lists for
-    // efficiency sake!
-    std::vector<std::list<DynInstPtr> > regMap;
+  private:
+    /** Insert an instruction into a specific destination register index
+     *  onto map.
+     */
+    void insert(uint8_t reg_type, RegIndex idx, DynInstPtr inst);
+
+    /** Remove a specific instruction and dest. register index from map */
+    void remove(uint8_t reg_type, RegIndex idx, DynInstPtr inst);
+
+    typedef std::vector<std::list<DynInstPtr> > DepMap;
+    std::vector<DepMap> regMap;
 
     InOrderCPU *cpu;
 };