gem5-dev@gem5.org

The gem5 Developer List

View all threads

[S] Change in gem5/gem5[develop]: cpu-minor: Use the InvalidRegClass to track invalid RegIds.

GB
Gabe Black (Gerrit)
Wed, Apr 27, 2022 8:27 PM

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

Change subject: cpu-minor: Use the InvalidRegClass to track invalid RegIds.
......................................................................

cpu-minor: Use the InvalidRegClass to track invalid RegIds.

Use that instead of the zero register. This avoids two assumptions,
first that there is a zero register in the first place, and second that
the zero register is an integer.

It also avoids referring to the IntRegClass in non-ISA specific code.
It's very likely that all ISAs will have integer registers, but we
should not build in assumptions about what types of registers an ISA has
in general. For instance, not all ISAs have vector predicate registers,
or a scalar floating point register file.

Change-Id: I730fec90f42b90b5be7e1baddf896e18c53e8510
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49711
Maintainer: Gabe Black gabe.black@gmail.com
Tested-by: kokoro noreply+kokoro@google.com
Reviewed-by: Giacomo Travaglini giacomo.travaglini@arm.com

M src/cpu/minor/scoreboard.cc
1 file changed, 28 insertions(+), 2 deletions(-)

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

diff --git a/src/cpu/minor/scoreboard.cc b/src/cpu/minor/scoreboard.cc
index 4637b8d..0e6ea75 100644
--- a/src/cpu/minor/scoreboard.cc
+++ b/src/cpu/minor/scoreboard.cc
@@ -84,6 +84,9 @@
/* Don't bother with Misc registers */
ret = false;
break;

  •  case InvalidRegClass:
    
  •    ret = false;
    
  •    break;
      default:
        panic("Unknown register class: %d", reg.classValue());
    }
    

@@ -135,8 +138,8 @@
" regIndex: %d final numResults: %d returnCycle: %d\n",
*inst, index, numResults[index], returnCycle[index]);
} else {

  •        /* Use zeroReg to mark invalid/untracked dests */
    
  •        inst->flatDestRegIdx[dest_index] = RegId(IntRegClass, zeroReg);
    
  •        /* Use an invalid ID to mark invalid/untracked dests */
    
  •        inst->flatDestRegIdx[dest_index] = RegId();
        }
    }
    
    }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49711
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: I730fec90f42b90b5be7e1baddf896e18c53e8510
Gerrit-Change-Number: 49711
Gerrit-PatchSet: 68
Gerrit-Owner: Gabe Black gabe.black@gmail.com
Gerrit-Reviewer: Gabe Black gabe.black@gmail.com
Gerrit-Reviewer: Giacomo Travaglini giacomo.travaglini@arm.com
Gerrit-Reviewer: ZHENGRONG WANG seanyukigeek@gmail.com
Gerrit-Reviewer: kokoro noreply+kokoro@google.com
Gerrit-MessageType: merged

Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/49711 ) Change subject: cpu-minor: Use the InvalidRegClass to track invalid RegIds. ...................................................................... cpu-minor: Use the InvalidRegClass to track invalid RegIds. Use that instead of the zero register. This avoids two assumptions, first that there is a zero register in the first place, and second that the zero register is an integer. It also avoids referring to the IntRegClass in non-ISA specific code. It's very likely that all ISAs will have integer registers, but we should not build in assumptions about what types of registers an ISA has in general. For instance, not all ISAs have vector predicate registers, or a scalar floating point register file. Change-Id: I730fec90f42b90b5be7e1baddf896e18c53e8510 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49711 Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> --- M src/cpu/minor/scoreboard.cc 1 file changed, 28 insertions(+), 2 deletions(-) Approvals: Giacomo Travaglini: Looks good to me, approved Gabe Black: Looks good to me, approved kokoro: Regressions pass diff --git a/src/cpu/minor/scoreboard.cc b/src/cpu/minor/scoreboard.cc index 4637b8d..0e6ea75 100644 --- a/src/cpu/minor/scoreboard.cc +++ b/src/cpu/minor/scoreboard.cc @@ -84,6 +84,9 @@ /* Don't bother with Misc registers */ ret = false; break; + case InvalidRegClass: + ret = false; + break; default: panic("Unknown register class: %d", reg.classValue()); } @@ -135,8 +138,8 @@ " regIndex: %d final numResults: %d returnCycle: %d\n", *inst, index, numResults[index], returnCycle[index]); } else { - /* Use zeroReg to mark invalid/untracked dests */ - inst->flatDestRegIdx[dest_index] = RegId(IntRegClass, zeroReg); + /* Use an invalid ID to mark invalid/untracked dests */ + inst->flatDestRegIdx[dest_index] = RegId(); } } } -- To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/49711 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: I730fec90f42b90b5be7e1baddf896e18c53e8510 Gerrit-Change-Number: 49711 Gerrit-PatchSet: 68 Gerrit-Owner: Gabe Black <gabe.black@gmail.com> Gerrit-Reviewer: Gabe Black <gabe.black@gmail.com> Gerrit-Reviewer: Giacomo Travaglini <giacomo.travaglini@arm.com> Gerrit-Reviewer: ZHENGRONG WANG <seanyukigeek@gmail.com> Gerrit-Reviewer: kokoro <noreply+kokoro@google.com> Gerrit-MessageType: merged