Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/45228 )

Change subject: cpu: Get rid of the redundant PhysRegIndex type.
......................................................................

cpu: Get rid of the redundant PhysRegIndex type.

It was defined to be effectively the same type as RegIndex, which is a
uint16_t. Having two types for essentially the same thing (which the
compiler would treat as equivalent) adds unnecessary complexity.

Change-Id: Ibf6badc19e3b0a27c3bc3e68def1e686dbef3ea8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/45228
Tested-by: kokoro <[email protected]>
Reviewed-by: Giacomo Travaglini <[email protected]>
Maintainer: Giacomo Travaglini <[email protected]>
---
M src/cpu/o3/dep_graph.hh
M src/cpu/o3/probe/elastic_trace.hh
M src/cpu/o3/regfile.cc
M src/cpu/o3/rob.hh
M src/cpu/reg_class.hh
5 files changed, 20 insertions(+), 27 deletions(-)

Approvals:
  Giacomo Travaglini: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/cpu/o3/dep_graph.hh b/src/cpu/o3/dep_graph.hh
index 1100742..c34e8d9 100644
--- a/src/cpu/o3/dep_graph.hh
+++ b/src/cpu/o3/dep_graph.hh
@@ -87,27 +87,27 @@
     void reset();

     /** Inserts an instruction to be dependent on the given index. */
-    void insert(PhysRegIndex idx, const DynInstPtr &new_inst);
+    void insert(RegIndex idx, const DynInstPtr &new_inst);

     /** Sets the producing instruction of a given register. */
-    void setInst(PhysRegIndex idx, const DynInstPtr &new_inst)
+    void setInst(RegIndex idx, const DynInstPtr &new_inst)
     { dependGraph[idx].inst = new_inst; }

     /** Clears the producing instruction. */
-    void clearInst(PhysRegIndex idx)
+    void clearInst(RegIndex idx)
     { dependGraph[idx].inst = NULL; }

     /** Removes an instruction from a single linked list. */
-    void remove(PhysRegIndex idx, const DynInstPtr &inst_to_remove);
+    void remove(RegIndex idx, const DynInstPtr &inst_to_remove);

     /** Removes and returns the newest dependent of a specific register. */
-    DynInstPtr pop(PhysRegIndex idx);
+    DynInstPtr pop(RegIndex idx);

     /** Checks if the entire dependency graph is empty. */
     bool empty() const;

     /** Checks if there are any dependents on a specific register. */
-    bool empty(PhysRegIndex idx) const { return !dependGraph[idx].next; }
+    bool empty(RegIndex idx) const { return !dependGraph[idx].next; }

     /** Debugging function to dump out the dependency graph.
      */
@@ -179,8 +179,7 @@

 template <class DynInstPtr>
 void
-DependencyGraph<DynInstPtr>::insert(PhysRegIndex idx,
-        const DynInstPtr &new_inst)
+DependencyGraph<DynInstPtr>::insert(RegIndex idx, const DynInstPtr &new_inst)
 {
     //Add this new, dependent instruction at the head of the dependency
     //chain.
@@ -200,7 +199,7 @@

 template <class DynInstPtr>
 void
-DependencyGraph<DynInstPtr>::remove(PhysRegIndex idx,
+DependencyGraph<DynInstPtr>::remove(RegIndex idx,
                                     const DynInstPtr &inst_to_remove)
 {
     DepEntry *prev = &dependGraph[idx];
@@ -238,7 +237,7 @@

 template <class DynInstPtr>
 DynInstPtr
-DependencyGraph<DynInstPtr>::pop(PhysRegIndex idx)
+DependencyGraph<DynInstPtr>::pop(RegIndex idx)
 {
     DepEntry *node;
     node = dependGraph[idx].next;
diff --git a/src/cpu/o3/probe/elastic_trace.hh b/src/cpu/o3/probe/elastic_trace.hh
index 24148b7..fb802d5 100644
--- a/src/cpu/o3/probe/elastic_trace.hh
+++ b/src/cpu/o3/probe/elastic_trace.hh
@@ -87,7 +87,7 @@
   public:
     typedef typename O3CPUImpl::DynInstPtr DynInstPtr;
     typedef typename O3CPUImpl::DynInstConstPtr DynInstConstPtr;
-    typedef typename std::pair<InstSeqNum, PhysRegIndex> SeqNumRegPair;
+    typedef typename std::pair<InstSeqNum, RegIndex> SeqNumRegPair;

     /** Trace record types corresponding to instruction node types */
     typedef ProtoMessage::InstDepRecord::RecordType RecordType;
@@ -239,7 +239,7 @@
* After Write dependencies. The key is the renamed physical register and
      * the value is the instruction sequence number of its last producer.
      */
-    std::unordered_map<PhysRegIndex, InstSeqNum> physRegDepMap;
+    std::unordered_map<RegIndex, InstSeqNum> physRegDepMap;

     /**
* @defgroup TraceInfo Struct for a record in the instruction dependency
diff --git a/src/cpu/o3/regfile.cc b/src/cpu/o3/regfile.cc
index 8871b48..bdbea30 100644
--- a/src/cpu/o3/regfile.cc
+++ b/src/cpu/o3/regfile.cc
@@ -72,8 +72,8 @@
                    + _numPhysicalCCRegs),
       vecMode(vmode)
 {
-    PhysRegIndex phys_reg;
-    PhysRegIndex flat_reg_idx = 0;
+    RegIndex phys_reg;
+    RegIndex flat_reg_idx = 0;

     // The initial batch of registers are the integer ones
     for (phys_reg = 0; phys_reg < numPhysicalIntRegs; phys_reg++) {
diff --git a/src/cpu/o3/rob.hh b/src/cpu/o3/rob.hh
index 6d972eb..ba5e027 100644
--- a/src/cpu/o3/rob.hh
+++ b/src/cpu/o3/rob.hh
@@ -62,7 +62,7 @@
     typedef typename Impl::O3CPU O3CPU;
     typedef typename Impl::DynInstPtr DynInstPtr;

-    typedef std::pair<RegIndex, PhysRegIndex> UnmapInfo;
+    typedef std::pair<RegIndex, RegIndex> UnmapInfo;
     typedef typename std::list<DynInstPtr>::iterator InstIt;

     /** Possible ROB statuses. */
diff --git a/src/cpu/reg_class.hh b/src/cpu/reg_class.hh
index 7081409..36c4206 100644
--- a/src/cpu/reg_class.hh
+++ b/src/cpu/reg_class.hh
@@ -188,12 +188,6 @@
     }
 };

-/** Physical register index type.
- * Although the Impl might be a better for this, but there are a few classes
- * that need this typedef yet are not templated on the Impl.
- */
-using PhysRegIndex = short int;
-
 /** Physical register ID.
  * Like a register ID but physical. The inheritance is private because the
  * only relationship between this types is functional, and it is done to
@@ -201,7 +195,7 @@
 class PhysRegId : private RegId
 {
   private:
-    PhysRegIndex flatIdx;
+    RegIndex flatIdx;
     int numPinnedWritesToComplete;
     bool pinned;

@@ -211,15 +205,15 @@
     {}

     /** Scalar PhysRegId constructor. */
-    explicit PhysRegId(RegClass _regClass, PhysRegIndex _regIdx,
-              PhysRegIndex _flatIdx)
+    explicit PhysRegId(RegClass _regClass, RegIndex _regIdx,
+              RegIndex _flatIdx)
         : RegId(_regClass, _regIdx), flatIdx(_flatIdx),
           numPinnedWritesToComplete(0), pinned(false)
     {}

     /** Vector PhysRegId constructor (w/ elemIndex). */
-    explicit PhysRegId(RegClass _regClass, PhysRegIndex _regIdx,
-              ElemIndex elem_idx, PhysRegIndex flat_idx)
+    explicit PhysRegId(RegClass _regClass, RegIndex _regIdx,
+              ElemIndex elem_idx, RegIndex flat_idx)
         : RegId(_regClass, _regIdx, elem_idx), flatIdx(flat_idx),
           numPinnedWritesToComplete(0), pinned(false)
     {}
@@ -263,7 +257,7 @@
     bool isFixedMapping() const { return !isRenameable(); }

     /** Flat index accessor */
-    const PhysRegIndex& flatIndex() const { return flatIdx; }
+    const RegIndex& flatIndex() const { return flatIdx; }

     static PhysRegId
     elemId(PhysRegId* vid, ElemIndex elem)



2 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/45228
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ibf6badc19e3b0a27c3bc3e68def1e686dbef3ea8
Gerrit-Change-Number: 45228
Gerrit-PatchSet: 5
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to