Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/49782 )

Change subject: cpu: Add a [] operator to the RegClass type.
......................................................................

cpu: Add a [] operator to the RegClass type.

This will create a RegId with the given index.

Change-Id: I2c3e6859fce80ede5cdb70f85d881b514b6babb2
---
M src/cpu/reg_class.hh
1 file changed, 8 insertions(+), 0 deletions(-)



diff --git a/src/cpu/reg_class.hh b/src/cpu/reg_class.hh
index be076f6..26e9e60 100644
--- a/src/cpu/reg_class.hh
+++ b/src/cpu/reg_class.hh
@@ -128,6 +128,8 @@

     inline iterator begin() const;
     inline iterator end() const;
+
+    inline constexpr RegId operator[](RegIndex idx) const;
 };

/** Register ID: describe an architectural register with its class and index.
@@ -281,6 +283,12 @@
     return RegClassIterator(*this, size());
 }

+constexpr RegId
+RegClass::operator[](RegIndex idx) const
+{
+    return RegId(type(), idx);
+}
+
 template <typename ValueType>
 class TypedRegClassOps : public RegClassOps
 {

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49782
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: I2c3e6859fce80ede5cdb70f85d881b514b6babb2
Gerrit-Change-Number: 49782
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
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