changeset 7274310be1bb in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=7274310be1bb
description:
        isa: clean up register constants

        Clean up and add some consistency to the *_Base_DepTag
        constants as well as some related register constants:
        - Get rid of NumMiscArchRegs, TotalArchRegs, and TotalDataRegs
          since they're never used and not always defined
        - Set FP_Base_DepTag = NumIntRegs when possible (i.e.,
          every case except x86)
        - Set Ctrl_Base_DepTag = FP_Base_DepTag + NumFloatRegs
          (this was true before, but wasn't always expressed
          that way)
        - Drastically reduce the number of arbitrary constants
          appearing in these calculations

diffstat:

 src/arch/alpha/registers.hh |   9 +++------
 src/arch/mips/registers.hh  |  15 ++++-----------
 src/arch/sparc/miscregs.hh  |   1 -
 src/arch/sparc/registers.hh |  14 +++++++-------
 src/arch/x86/registers.hh   |  24 ++++++++----------------
 5 files changed, 22 insertions(+), 41 deletions(-)

diffs (157 lines):

diff -r 9c3a4595cce9 -r 7274310be1bb src/arch/alpha/registers.hh
--- a/src/arch/alpha/registers.hh       Tue Oct 15 14:22:43 2013 -0400
+++ b/src/arch/alpha/registers.hh       Tue Oct 15 14:22:43 2013 -0400
@@ -88,23 +88,20 @@
 const int NumIntArchRegs = 32;
 const int NumPALShadowRegs = 8;
 const int NumFloatArchRegs = 32;
-const int NumMiscArchRegs = NUM_MISCREGS;
 
 const int NumIntRegs = NumIntArchRegs + NumPALShadowRegs;
 const int NumFloatRegs = NumFloatArchRegs;
-const int NumMiscRegs = NumMiscArchRegs;
+const int NumMiscRegs = NUM_MISCREGS;
 
 const int TotalNumRegs =
     NumIntRegs + NumFloatRegs + NumMiscRegs;
 
-const int TotalDataRegs = NumIntRegs + NumFloatRegs;
-
 // These enumerate all the registers for dependence tracking.
 enum DependenceTags {
     // 0..31 are the integer regs 0..31
     // 32..63 are the FP regs 0..31, i.e. use (reg + FP_Base_DepTag)
-    FP_Base_DepTag = 40,
-    Ctrl_Base_DepTag = 72,
+    FP_Base_DepTag = NumIntRegs,
+    Ctrl_Base_DepTag = FP_Base_DepTag + NumFloatRegs,
     Max_DepTag = Ctrl_Base_DepTag + NumMiscRegs + NumInternalProcRegs
 };
 
diff -r 9c3a4595cce9 -r 7274310be1bb src/arch/mips/registers.hh
--- a/src/arch/mips/registers.hh        Tue Oct 15 14:22:43 2013 -0400
+++ b/src/arch/mips/registers.hh        Tue Oct 15 14:22:43 2013 -0400
@@ -115,15 +115,6 @@
 
 const int SyscallPseudoReturnReg = 3;
 
-//@TODO: Implementing ShadowSets needs to
-//edit this value such that:
-//TotalArchRegs = NumIntArchRegs * ShadowSets
-const int TotalArchRegs = NumIntArchRegs;
-
-// These help enumerate all the registers for dependence tracking.
-const int FP_Base_DepTag = NumIntRegs;
-const int Ctrl_Base_DepTag = FP_Base_DepTag + NumFloatRegs;
-
 // Enumerate names for 'Control' Registers in the CPU
 // Reference MIPS32 Arch. for Programmers, Vol. III, Ch.8
 // (Register Number-Register Select) Summary of Register
@@ -281,9 +272,11 @@
     MISCREG_NUMREGS
 };
 
-const int TotalDataRegs = NumIntRegs + NumFloatRegs;
+const int NumMiscRegs = MISCREG_NUMREGS;
 
-const int NumMiscRegs = MISCREG_NUMREGS;
+// These help enumerate all the registers for dependence tracking.
+const int FP_Base_DepTag = NumIntRegs;
+const int Ctrl_Base_DepTag = FP_Base_DepTag + NumFloatRegs;
 const int Max_DepTag = Ctrl_Base_DepTag + NumMiscRegs;
 
 const int TotalNumRegs = NumIntRegs + NumFloatRegs + NumMiscRegs;
diff -r 9c3a4595cce9 -r 7274310be1bb src/arch/sparc/miscregs.hh
--- a/src/arch/sparc/miscregs.hh        Tue Oct 15 14:22:43 2013 -0400
+++ b/src/arch/sparc/miscregs.hh        Tue Oct 15 14:22:43 2013 -0400
@@ -155,7 +155,6 @@
 };
 
 
-const int NumMiscArchRegs = MISCREG_NUMMISCREGS;
 const int NumMiscRegs = MISCREG_NUMMISCREGS;
 
 }
diff -r 9c3a4595cce9 -r 7274310be1bb src/arch/sparc/registers.hh
--- a/src/arch/sparc/registers.hh       Tue Oct 15 14:22:43 2013 -0400
+++ b/src/arch/sparc/registers.hh       Tue Oct 15 14:22:43 2013 -0400
@@ -57,13 +57,6 @@
 
 typedef uint16_t RegIndex;
 
-// These enumerate all the registers for dependence tracking.
-enum DependenceTags {
-    FP_Base_DepTag = 32*3+9,
-    Ctrl_Base_DepTag = FP_Base_DepTag + 64,
-    Max_DepTag = Ctrl_Base_DepTag + NumMiscRegs
-};
-
 // semantically meaningful register indices
 const int ZeroReg = 0;      // architecturally meaningful
 // the rest of these depend on the ABI
@@ -80,6 +73,13 @@
 
 const int TotalNumRegs = NumIntRegs + NumFloatRegs + NumMiscRegs;
 
+// These enumerate all the registers for dependence tracking.
+enum DependenceTags {
+    FP_Base_DepTag = NumIntRegs,
+    Ctrl_Base_DepTag = FP_Base_DepTag + NumFloatRegs,
+    Max_DepTag = Ctrl_Base_DepTag + NumMiscRegs
+};
+
 } // namespace SparcISA
 
 #endif
diff -r 9c3a4595cce9 -r 7274310be1bb src/arch/x86/registers.hh
--- a/src/arch/x86/registers.hh Tue Oct 15 14:22:43 2013 -0400
+++ b/src/arch/x86/registers.hh Tue Oct 15 14:22:43 2013 -0400
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2007 The Hewlett-Packard Development Company
+ * Copyright (c) 2013 Advanced Micro Devices, Inc.
  * All rights reserved.
  *
  * The license below extends only to copyright in the software and shall
@@ -50,7 +51,6 @@
 using X86ISAInst::MaxInstSrcRegs;
 using X86ISAInst::MaxInstDestRegs;
 using X86ISAInst::MaxMiscDestRegs;
-const int NumMiscArchRegs = NUM_MISCREGS;
 const int NumMiscRegs = NUM_MISCREGS;
 
 const int NumIntArchRegs = NUM_INTREGS;
@@ -58,26 +58,18 @@
     NumIntArchRegs + NumMicroIntRegs +
     NumPseudoIntRegs + NumImplicitIntRegs;
 
-//Each 128 bit xmm register is broken into two effective 64 bit registers.
+// Each 128 bit xmm register is broken into two effective 64 bit registers.
+// Add 8 for the indices that are mapped over the fp stack
 const int NumFloatRegs =
-    NumMMXRegs + 2 * NumXMMRegs + NumMicroFpRegs;
-const int NumFloatArchRegs = NumFloatRegs + 8;
+    NumMMXRegs + 2 * NumXMMRegs + NumMicroFpRegs + 8;
 
 // These enumerate all the registers for dependence tracking.
 enum DependenceTags {
-    //There are 16 microcode registers at the moment. This is an
-    //unusually large constant to make sure there isn't overflow.
+    // FP_Base_DepTag must be large enough to be bigger than any integer
+    // register index which has the IntFoldBit (1 << 6) set.  To be safe
+    // we just start at (1 << 7) == 128.
     FP_Base_DepTag = 128,
-    Ctrl_Base_DepTag =
-        FP_Base_DepTag +
-        //mmx/x87 registers
-        8 +
-        //xmm registers
-        16 * 2 +
-        //The microcode fp registers
-        8 +
-        //The indices that are mapped over the fp stack
-        8,
+    Ctrl_Base_DepTag = FP_Base_DepTag + NumFloatRegs,
     Max_DepTag = Ctrl_Base_DepTag + NumMiscRegs
 };
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to