# HG changeset patch
# User Gabe Black <[email protected]>
# Date 1247031915 25200
# Node ID 1e69e4af6b8326bc39832eb283932765ca6028e8
# Parent  95d483300be325e2f201ce2cd111a6f6a53c0b3c
Registers: Eliminate the ISA defined integer register file.

diff --git a/src/arch/alpha/intregfile.cc b/src/arch/alpha/intregfile.cc
--- a/src/arch/alpha/intregfile.cc
+++ b/src/arch/alpha/intregfile.cc
@@ -30,11 +30,7 @@
  *          Kevin Lim
  */
 
-#include <cstring>
-
-#include "arch/alpha/isa_traits.hh"
 #include "arch/alpha/intregfile.hh"
-#include "sim/serialize.hh"
 
 namespace AlphaISA {
 
@@ -52,23 +48,5 @@
     /* 24 */ 24, 25, 26, 27, 28, 29, 30, 31 };
 #endif
 
-void
-IntRegFile::clear()
-{
-    std::memset(regs, 0, sizeof(regs));
-}
-
-void
-IntRegFile::serialize(std::ostream &os)
-{
-    SERIALIZE_ARRAY(regs, NumIntRegs);
-}
-
-void
-IntRegFile::unserialize(Checkpoint *cp, const std::string &section)
-{
-    UNSERIALIZE_ARRAY(regs, NumIntRegs);
-}
-
 } // namespace AlphaISA
 
diff --git a/src/arch/alpha/intregfile.hh b/src/arch/alpha/intregfile.hh
--- a/src/arch/alpha/intregfile.hh
+++ b/src/arch/alpha/intregfile.hh
@@ -32,42 +32,13 @@
 #ifndef __ARCH_ALPHA_INTREGFILE_HH__
 #define __ARCH_ALPHA_INTREGFILE_HH__
 
-#include <iosfwd>
-#include <string>
-
-#include "arch/alpha/types.hh"
-
-class Checkpoint;
+#include "arch/alpha/isa_traits.hh"
 
 namespace AlphaISA {
 
 // redirected register map, really only used for the full system case.
 extern const int reg_redir[NumIntRegs];
 
-class IntRegFile
-{
-  protected:
-    IntReg regs[NumIntRegs];
-
-  public:
-    IntReg
-    readReg(int intReg)
-    {
-        return regs[intReg];
-    }
-
-    void
-    setReg(int intReg, const IntReg &val)
-    {
-        regs[intReg] = val;
-    }
-
-    void clear();
-
-    void serialize(std::ostream &os);
-    void unserialize(Checkpoint *cp, const std::string &section);
-};
-
 } // namespace AlphaISA
 
 #endif // __ARCH_ALPHA_INTREGFILE_HH__
diff --git a/src/arch/alpha/regfile.cc b/src/arch/alpha/regfile.cc
--- a/src/arch/alpha/regfile.cc
+++ b/src/arch/alpha/regfile.cc
@@ -41,7 +41,6 @@
 void
 RegFile::serialize(EventManager *em, ostream &os)
 {
-    intRegFile.serialize(os);
     SERIALIZE_SCALAR(pc);
     SERIALIZE_SCALAR(npc);
 #if FULL_SYSTEM
@@ -52,7 +51,6 @@
 void
 RegFile::unserialize(EventManager *em, Checkpoint *cp, const string &section)
 {
-    intRegFile.unserialize(cp, section);
     UNSERIALIZE_SCALAR(pc);
     UNSERIALIZE_SCALAR(npc);
 #if FULL_SYSTEM
diff --git a/src/arch/alpha/regfile.hh b/src/arch/alpha/regfile.hh
--- a/src/arch/alpha/regfile.hh
+++ b/src/arch/alpha/regfile.hh
@@ -89,9 +89,6 @@
     setNextNPC(Addr val)
     { }
 
-  protected:
-    IntRegFile intRegFile;          // (signed) integer register file
-
   public:
 #if FULL_SYSTEM
     int intrflag;                   // interrupt flag
@@ -100,19 +97,6 @@
     void
     clear()
     {
-        intRegFile.clear();
-    }
-
-    IntReg
-    readIntReg(int intReg)
-    {
-        return intRegFile.readReg(intReg);
-    }
-
-    void
-    setIntReg(int intReg, const IntReg &val)
-    {
-        intRegFile.setReg(intReg, val);
     }
 
     void serialize(EventManager *em, std::ostream &os);
diff --git a/src/arch/arm/regfile/int_regfile.hh 
b/src/arch/arm/regfile/int_regfile.hh
--- a/src/arch/arm/regfile/int_regfile.hh
+++ b/src/arch/arm/regfile/int_regfile.hh
@@ -43,11 +43,6 @@
 
 namespace ArmISA
 {
-    static inline std::string getIntRegName(RegIndex)
-    {
-        return "";
-    }
-
     enum MiscIntRegNums {
         zero_reg = NumIntArchRegs,
         addr_reg,
@@ -77,42 +72,6 @@
         r14_abt
     };
 
-    class IntRegFile
-    {
-      protected:
-        IntReg regs[NumIntRegs];
-
-      public:
-        IntReg readReg(int intReg)
-        {
-            DPRINTF(IntRegs, "Reading int reg %d as %#x.\n",
-                    intReg, regs[intReg]);
-            return regs[intReg];
-        }
-
-        void clear()
-        {
-            bzero(regs, sizeof(regs));
-        }
-
-        Fault setReg(int intReg, const IntReg &val)
-        {
-            DPRINTF(IntRegs, "Setting int reg %d to %#x.\n", intReg, val);
-            regs[intReg] = val;
-            return NoFault;
-        }
-
-        void serialize(std::ostream &os)
-        {
-            SERIALIZE_ARRAY(regs, NumIntRegs);
-        }
-
-        void unserialize(Checkpoint *cp, const std::string &section)
-        {
-            UNSERIALIZE_ARRAY(regs, NumIntRegs);
-        }
-    };
-
 } // namespace ArmISA
 
 #endif
diff --git a/src/arch/arm/regfile/regfile.cc b/src/arch/arm/regfile/regfile.cc
--- a/src/arch/arm/regfile/regfile.cc
+++ b/src/arch/arm/regfile/regfile.cc
@@ -57,7 +57,6 @@
 void
 RegFile::serialize(EventManager *em, ostream &os)
 {
-    intRegFile.serialize(os);
     SERIALIZE_SCALAR(npc);
     SERIALIZE_SCALAR(nnpc);
 }
@@ -65,7 +64,6 @@
 void
 RegFile::unserialize(EventManager *em, Checkpoint *cp, const string &section)
 {
-    intRegFile.unserialize(cp, section);
     UNSERIALIZE_SCALAR(npc);
     UNSERIALIZE_SCALAR(nnpc);
 }
diff --git a/src/arch/arm/regfile/regfile.hh b/src/arch/arm/regfile/regfile.hh
--- a/src/arch/arm/regfile/regfile.hh
+++ b/src/arch/arm/regfile/regfile.hh
@@ -67,25 +67,10 @@
 
     class RegFile
     {
-      protected:
-        IntRegFile intRegFile;         // (signed) integer register file
-
       public:
 
         void clear()
-        {
-            intRegFile.clear();
-        }
-
-        IntReg readIntReg(int intReg)
-        {
-            return intRegFile.readReg(intReg);
-        }
-
-        void setIntReg(int intReg, const IntReg &val)
-        {
-            intRegFile.setReg(intReg, val);
-        }
+        {}
       protected:
 
         Addr pc;                       // program counter
@@ -95,14 +80,12 @@
       public:
         Addr readPC()
         {
-            return intRegFile.readReg(PCReg);
-            //return pc;
+            return pc;
         }
 
         void setPC(Addr val)
         {
-            intRegFile.setReg(PCReg, val);
-            //pc = val;
+            pc = val;
         }
 
         Addr readNextPC()
diff --git a/src/arch/mips/SConscript b/src/arch/mips/SConscript
--- a/src/arch/mips/SConscript
+++ b/src/arch/mips/SConscript
@@ -35,7 +35,6 @@
 if env['TARGET_ISA'] == 'mips':
     Source('faults.cc')
     Source('isa.cc')
-    Source('regfile/int_regfile.cc')
     Source('regfile/misc_regfile.cc')
     Source('regfile/regfile.cc')
     Source('tlb.cc')
diff --git a/src/arch/mips/regfile.cc b/src/arch/mips/regfile.cc
--- a/src/arch/mips/regfile.cc
+++ b/src/arch/mips/regfile.cc
@@ -48,7 +48,6 @@
 
 void RegFile::clear()
 {
-    intRegFile.clear();
     miscRegFile.clear();
 }
 
@@ -56,18 +55,7 @@
 RegFile::reset(std::string core_name, ThreadID num_threads,
                unsigned num_vpes)
 {
-    bzero(&intRegFile, sizeof(intRegFile));
     miscRegFile.reset(core_name, num_threads, num_vpes);
-}
-
-IntReg RegFile::readIntReg(int intReg)
-{
-    return intRegFile.readReg(intReg);
-}
-
-Fault RegFile::setIntReg(int intReg, const IntReg &val)
-{
-    return intRegFile.setReg(intReg, val);
 }
 
 MiscReg
@@ -128,7 +116,6 @@
 void
 RegFile::serialize(std::ostream &os)
 {
-    intRegFile.serialize(os);
     miscRegFile.serialize(os);
 
     SERIALIZE_SCALAR(pc);
@@ -140,7 +127,6 @@
 void
 RegFile::unserialize(Checkpoint *cp, const std::string &section)
 {
-    intRegFile.unserialize(cp, section);
     miscRegFile.unserialize(cp, section);
     UNSERIALIZE_SCALAR(pc);
     UNSERIALIZE_SCALAR(npc);
diff --git a/src/arch/mips/regfile/int_regfile.cc 
b/src/arch/mips/regfile/int_regfile.cc
deleted file mode 100644
--- a/src/arch/mips/regfile/int_regfile.cc
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2003-2005 The Regents of The University of Michigan
- * Copyright (c) 2007 MIPS Technologies, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Gabe Black
- *          Korey Sewell
- *          Jaidev Patwardhan
- */
-
-#include "arch/mips/regfile/int_regfile.hh"
-#include "sim/serialize.hh"
-
-using namespace MipsISA;
-using namespace std;
-
-void
-IntRegFile::clear()
-{
-    bzero(&regs, sizeof(regs));
-    currShadowSet=0;
-}
-
-int
-IntRegFile::readShadowSet()
-{
-  return currShadowSet;
-}
-
-void
-IntRegFile::setShadowSet(int css)
-{
-    DPRINTF(MipsPRA, "Setting Shadow Set to :%d (%s)\n", css, currShadowSet);
-    currShadowSet = css;
-}
-
-IntReg
-IntRegFile::readReg(int intReg)
-{
-    if (intReg < NumIntArchRegs) {
-        // Regular GPR Read
-        DPRINTF(MipsPRA, "Reading Reg: %d, CurrShadowSet: %d\n", intReg,
-              currShadowSet);
-
-        return regs[intReg + NumIntArchRegs * currShadowSet];
-    } else {
-        unsigned special_reg_num = intReg - NumIntArchRegs;
-
-        // Read A Special Reg
-        return regs[TotalArchRegs + special_reg_num];
-    }
-}
-
-Fault
-IntRegFile::setReg(int intReg, const IntReg &val)
-{
-    if (intReg != ZeroReg) {
-        if (intReg < NumIntArchRegs) {
-          regs[intReg + NumIntArchRegs * currShadowSet] = val;
-        } else {
-          unsigned special_reg_num = intReg - NumIntArchRegs;
-
-          regs[TotalArchRegs + special_reg_num] = val;
-        }
-    }
-
-    return NoFault;
-}
-
-void
-IntRegFile::serialize(std::ostream &os)
-{
-    SERIALIZE_ARRAY(regs, NumIntRegs);
-}
-
-void
-IntRegFile::unserialize(Checkpoint *cp, const std::string &section)
-{
-    UNSERIALIZE_ARRAY(regs, NumIntRegs);
-}
diff --git a/src/arch/mips/regfile/int_regfile.hh 
b/src/arch/mips/regfile/int_regfile.hh
--- a/src/arch/mips/regfile/int_regfile.hh
+++ b/src/arch/mips/regfile/int_regfile.hh
@@ -65,23 +65,6 @@
     //TotalArchRegs = NumIntArchRegs * ShadowSets
     const int TotalArchRegs = NumIntArchRegs;
 
-    class IntRegFile
-    {
-      protected:
-        IntReg regs[NumIntRegs];
-        int currShadowSet;
-      public:
-        void clear();
-        int readShadowSet();
-        void setShadowSet(int css);
-        IntReg readReg(int intReg);
-        Fault setReg(int intReg, const IntReg &val);
-
-        void serialize(std::ostream &os);
-        void unserialize(Checkpoint *cp, const std::string &section);
-
-    };
-
 } // namespace MipsISA
 
 #endif
diff --git a/src/arch/mips/regfile/regfile.cc b/src/arch/mips/regfile/regfile.cc
--- a/src/arch/mips/regfile/regfile.cc
+++ b/src/arch/mips/regfile/regfile.cc
@@ -40,31 +40,16 @@
 void
 RegFile::clear()
 {
-    intRegFile.clear();
 }
 
 void
 RegFile::reset(std::string core_name, ThreadID num_threads, unsigned num_vpes,
                BaseCPU *_cpu)
 {
-    bzero(&intRegFile, sizeof(intRegFile));
-}
-
-IntReg
-RegFile::readIntReg(int intReg)
-{
-    return intRegFile.readReg(intReg);
-}
-
-Fault
-RegFile::setIntReg(int intReg, const IntReg &val)
-{
-    return intRegFile.setReg(intReg, val);
 }
 
 void
 RegFile::setShadowSet(int css){
-    intRegFile.setShadowSet(css);
 }
 
 
@@ -107,7 +92,6 @@
 void
 RegFile::serialize(EventManager *em, std::ostream &os)
 {
-    intRegFile.serialize(os);
     SERIALIZE_SCALAR(pc);
     SERIALIZE_SCALAR(npc);
     SERIALIZE_SCALAR(nnpc);
@@ -117,7 +101,6 @@
 RegFile::unserialize(EventManager *em, Checkpoint *cp,
     const std::string &section)
 {
-    intRegFile.unserialize(cp, section);
     UNSERIALIZE_SCALAR(pc);
     UNSERIALIZE_SCALAR(npc);
     UNSERIALIZE_SCALAR(nnpc);
diff --git a/src/arch/mips/regfile/regfile.hh b/src/arch/mips/regfile/regfile.hh
--- a/src/arch/mips/regfile/regfile.hh
+++ b/src/arch/mips/regfile/regfile.hh
@@ -79,15 +79,10 @@
                                         // used to implement branch delay slot
                                         // not real register
 
-        IntRegFile intRegFile;          // (signed) integer register file
-
       public:
         void clear();
         void reset(std::string core_name, ThreadID num_threads,
                    unsigned num_vpes, BaseCPU *_cpu);
-
-        IntReg readIntReg(int intReg);
-        Fault setIntReg(int intReg, const IntReg &val);
 
         void setShadowSet(int css);
 
diff --git a/src/arch/sparc/SConscript b/src/arch/sparc/SConscript
--- a/src/arch/sparc/SConscript
+++ b/src/arch/sparc/SConscript
@@ -34,7 +34,6 @@
 if env['TARGET_ISA'] == 'sparc':
     Source('asi.cc')
     Source('faults.cc')
-    Source('intregfile.cc')
     Source('isa.cc')
     Source('miscregfile.cc')
     Source('pagetable.cc')
diff --git a/src/arch/sparc/intregfile.cc b/src/arch/sparc/intregfile.cc
deleted file mode 100644
--- a/src/arch/sparc/intregfile.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2003-2005 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Gabe Black
- *          Ali Saidi
- */
-
-#include "arch/sparc/intregfile.hh"
-#include "base/trace.hh"
-#include "base/misc.hh"
-#include "sim/serialize.hh"
-
-#include <string.h>
-
-using namespace SparcISA;
-using namespace std;
-
-class Checkpoint;
-
-void IntRegFile::clear()
-{
-    memset(regs, 0, sizeof(IntReg) * NumIntRegs);
-}
-
-IntRegFile::IntRegFile()
-{
-    clear();
-}
-
-IntReg IntRegFile::readReg(int intReg)
-{
-    DPRINTF(IntRegs, "Read register %d = 0x%x\n", intReg, regs[intReg]);
-    return regs[intReg];
-}
-
-void IntRegFile::setReg(int intReg, const IntReg &val)
-{
-    if(intReg)
-    {
-        DPRINTF(IntRegs, "Wrote register %d = 0x%x\n", intReg, val);
-        regs[intReg] = val;
-    }
-    return;
-}
-
-void IntRegFile::serialize(std::ostream &os)
-{
-    SERIALIZE_ARRAY(regs, NumIntRegs);
-    SERIALIZE_ARRAY(microRegs, NumMicroIntRegs);
-}
-
-void IntRegFile::unserialize(Checkpoint *cp, const std::string &section)
-{
-    UNSERIALIZE_ARRAY(regs, NumIntRegs);
-    UNSERIALIZE_ARRAY(microRegs, NumMicroIntRegs);
-}
diff --git a/src/arch/sparc/intregfile.hh b/src/arch/sparc/intregfile.hh
--- a/src/arch/sparc/intregfile.hh
+++ b/src/arch/sparc/intregfile.hh
@@ -32,39 +32,12 @@
 #ifndef __ARCH_SPARC_INTREGFILE_HH__
 #define __ARCH_SPARC_INTREGFILE_HH__
 
-#include "arch/sparc/isa_traits.hh"
-#include "arch/sparc/types.hh"
-#include "base/bitfield.hh"
-
-#include <string>
-
-class Checkpoint;
+#include "arch/sparc/sparc_traits.hh"
 
 namespace SparcISA
 {
     const int NumIntArchRegs = 32;
     const int NumIntRegs = (MaxGL + 1) * 8 + NWindows * 16 + NumMicroIntRegs;
-
-    class IntRegFile
-    {
-      protected:
-        IntReg microRegs[NumMicroIntRegs];
-        IntReg regs[NumIntRegs];
-
-      public:
-
-        void clear();
-
-        IntRegFile();
-
-        IntReg readReg(int intReg);
-
-        void setReg(int intReg, const IntReg &val);
-
-        void serialize(std::ostream &os);
-
-        void unserialize(Checkpoint *cp, const std::string &section);
-    };
 }
 
 #endif
diff --git a/src/arch/sparc/predecoder.hh b/src/arch/sparc/predecoder.hh
--- a/src/arch/sparc/predecoder.hh
+++ b/src/arch/sparc/predecoder.hh
@@ -32,6 +32,7 @@
 #define __ARCH_SPARC_PREDECODER_HH__
 
 #include "arch/sparc/types.hh"
+#include "base/bitfield.hh"
 #include "base/misc.hh"
 #include "base/types.hh"
 #include "cpu/thread_context.hh"
diff --git a/src/arch/sparc/regfile.cc b/src/arch/sparc/regfile.cc
--- a/src/arch/sparc/regfile.cc
+++ b/src/arch/sparc/regfile.cc
@@ -68,25 +68,9 @@
     nnpc = val;
 }
 
-void RegFile::clear()
-{
-    intRegFile.clear();
-}
-
-IntReg RegFile::readIntReg(int intReg)
-{
-    return intRegFile.readReg(intReg);
-}
-
-void RegFile::setIntReg(int intReg, const IntReg &val)
-{
-    intRegFile.setReg(intReg, val);
-}
-
 void
 RegFile::serialize(EventManager *em, ostream &os)
 {
-    intRegFile.serialize(os);
     SERIALIZE_SCALAR(pc);
     SERIALIZE_SCALAR(npc);
     SERIALIZE_SCALAR(nnpc);
@@ -95,7 +79,6 @@
 void
 RegFile::unserialize(EventManager *em, Checkpoint *cp, const string &section)
 {
-    intRegFile.unserialize(cp, section);
     UNSERIALIZE_SCALAR(pc);
     UNSERIALIZE_SCALAR(npc);
     UNSERIALIZE_SCALAR(nnpc);
diff --git a/src/arch/sparc/regfile.hh b/src/arch/sparc/regfile.hh
--- a/src/arch/sparc/regfile.hh
+++ b/src/arch/sparc/regfile.hh
@@ -61,16 +61,10 @@
         Addr readNextNPC();
         void setNextNPC(Addr val);
 
-      protected:
-        IntRegFile intRegFile;          // integer register file
-
       public:
 
-        void clear();
-
-        IntReg readIntReg(int intReg);
-
-        void setIntReg(int intReg, const IntReg &val);
+        void clear()
+        {}
 
         void serialize(EventManager *em, std::ostream &os);
         void unserialize(EventManager *em, Checkpoint *cp,
diff --git a/src/arch/x86/SConscript b/src/arch/x86/SConscript
--- a/src/arch/x86/SConscript
+++ b/src/arch/x86/SConscript
@@ -94,7 +94,6 @@
     Source('insts/microop.cc')
     Source('insts/microregop.cc')
     Source('insts/static_inst.cc')
-    Source('intregfile.cc')
     Source('isa.cc')
     Source('miscregfile.cc')
     Source('pagetable.cc')
diff --git a/src/arch/x86/intregfile.cc b/src/arch/x86/intregfile.cc
deleted file mode 100644
--- a/src/arch/x86/intregfile.cc
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2003-2007 The Regents of The University of Michigan
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Gabe Black
- */
-
-/*
- * Copyright (c) 2007 The Hewlett-Packard Development Company
- * All rights reserved.
- *
- * Redistribution and use of this software in source and binary forms,
- * with or without modification, are permitted provided that the
- * following conditions are met:
- *
- * The software must be used only for Non-Commercial Use which means any
- * use which is NOT directed to receiving any direct monetary
- * compensation for, or commercial advantage from such use.  Illustrative
- * examples of non-commercial use are academic research, personal study,
- * teaching, education and corporate research & development.
- * Illustrative examples of commercial use are distributing products for
- * commercial advantage and providing services using the software for
- * commercial advantage.
- *
- * If you wish to use this software or functionality therein that may be
- * covered by patents for commercial use, please contact:
- *     Director of Intellectual Property Licensing
- *     Office of Strategy and Technology
- *     Hewlett-Packard Company
- *     1501 Page Mill Road
- *     Palo Alto, California  94304
- *
- * Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.  Redistributions
- * in binary form must reproduce the above copyright notice, this list of
- * conditions and the following disclaimer in the documentation and/or
- * other materials provided with the distribution.  Neither the name of
- * the COPYRIGHT HOLDER(s), HEWLETT-PACKARD COMPANY, nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.  No right of
- * sublicense is granted herewith.  Derivatives of the software and
- * output created using the software may be prepared, but only for
- * Non-Commercial Uses.  Derivatives of the software may be shared with
- * others provided: (i) the others agree to abide by the list of
- * conditions herein which includes the Non-Commercial Use restrictions;
- * and (ii) such Derivatives of the software include the above copyright
- * notice to acknowledge the contribution from this software where
- * applicable, this list of conditions and the disclaimer below.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Gabe Black
- */
-
-#include "arch/x86/intregfile.hh"
-#include "base/misc.hh"
-#include "base/trace.hh"
-#include "sim/serialize.hh"
-
-#include <string.h>
-
-using namespace X86ISA;
-using namespace std;
-
-class Checkpoint;
-
-int IntRegFile::flattenIndex(int reg)
-{
-    return reg;
-}
-
-void IntRegFile::clear()
-{
-    memset(regs, 0, sizeof(IntReg) * NumIntRegs);
-}
-
-IntReg IntRegFile::readReg(int intReg)
-{
-    DPRINTF(IntRegs, "Read int reg %d and got value %#x\n",
-            intReg, regs[intReg]);
-    return regs[intReg];
-}
-
-void IntRegFile::setReg(int intReg, const IntReg &val)
-{
-    DPRINTF(IntRegs, "Setting int reg %d to value %#x\n",
-            intReg, val);
-    regs[intReg] = val;
-}
-
-void IntRegFile::serialize(std::ostream &os)
-{
-    SERIALIZE_ARRAY(regs, NumIntRegs);
-}
-
-void IntRegFile::unserialize(Checkpoint *cp, const std::string &section)
-{
-    UNSERIALIZE_ARRAY(regs, NumIntRegs);
-}
diff --git a/src/arch/x86/intregfile.hh b/src/arch/x86/intregfile.hh
--- a/src/arch/x86/intregfile.hh
+++ b/src/arch/x86/intregfile.hh
@@ -89,41 +89,14 @@
 #define __ARCH_X86_INTREGFILE_HH__
 
 #include "arch/x86/intregs.hh"
-#include "arch/x86/types.hh"
 #include "arch/x86/x86_traits.hh"
-
-#include <string>
-
-class Checkpoint;
 
 namespace X86ISA
 {
-    class Regfile;
-
     const int NumIntArchRegs = NUM_INTREGS;
     const int NumIntRegs =
         NumIntArchRegs + NumMicroIntRegs +
         NumPseudoIntRegs + NumImplicitIntRegs;
-
-    class IntRegFile
-    {
-      protected:
-        IntReg regs[NumIntRegs];
-
-      public:
-
-        int flattenIndex(int reg);
-
-        void clear();
-
-        IntReg readReg(int intReg);
-
-        void setReg(int intReg, const IntReg &val);
-
-        void serialize(std::ostream &os);
-
-        void unserialize(Checkpoint *cp, const std::string &section);
-    };
 }
 
 #endif //__ARCH_X86_INTREGFILE__
diff --git a/src/arch/x86/regfile.cc b/src/arch/x86/regfile.cc
--- a/src/arch/x86/regfile.cc
+++ b/src/arch/x86/regfile.cc
@@ -127,21 +127,6 @@
 void RegFile::setNextNPC(Addr val)
 { }
 
-void RegFile::clear()
-{
-    intRegFile.clear();
-}
-
-IntReg RegFile::readIntReg(int intReg)
-{
-    return intRegFile.readReg(intReg);
-}
-
-void RegFile::setIntReg(int intReg, const IntReg &val)
-{
-    intRegFile.setReg(intReg, val);
-}
-
 void
 X86ISA::copyMiscRegs(ThreadContext *src, ThreadContext *dest)
 {
@@ -167,15 +152,3 @@
     dest->setPC(src->readPC());
     dest->setNextPC(src->readNextPC());
 }
-
-void
-RegFile::serialize(EventManager *em, std::ostream &os)
-{
-    intRegFile.serialize(os);
-}
-
-void
-RegFile::unserialize(EventManager *em, Checkpoint *cp, const string &section)
-{
-    intRegFile.unserialize(cp, section);
-}
diff --git a/src/arch/x86/regfile.hh b/src/arch/x86/regfile.hh
--- a/src/arch/x86/regfile.hh
+++ b/src/arch/x86/regfile.hh
@@ -97,20 +97,17 @@
         Addr readNextNPC();
         void setNextNPC(Addr val);
 
-      protected:
-        IntRegFile intRegFile; // integer register file
-
       public:
 
-        void clear();
+        void clear()
+        {}
 
-        IntReg readIntReg(int intReg);
+        void serialize(EventManager *em, std::ostream &os)
+        {}
 
-        void setIntReg(int intReg, const IntReg &val);
-
-        void serialize(EventManager *em, std::ostream &os);
         void unserialize(EventManager *em, Checkpoint *cp,
-            const std::string &section);
+                const std::string &section)
+        {}
     };
 
     void copyRegs(ThreadContext *src, ThreadContext *dest);
diff --git a/src/cpu/inorder/cpu.cc b/src/cpu/inorder/cpu.cc
--- a/src/cpu/inorder/cpu.cc
+++ b/src/cpu/inorder/cpu.cc
@@ -264,7 +264,7 @@
         squashSeqNum[tid] = MaxAddr;
         lastSquashCycle[tid] = 0;
 
-        intRegFile[tid].clear();
+        memset(intRegs[tid], 0, sizeof(intRegs[tid]));
         memset(floatRegs.i[tid], 0, sizeof(floatRegs.i[tid]));
         isa[tid].clear();
 
@@ -886,7 +886,7 @@
 uint64_t
 InOrderCPU::readIntReg(int reg_idx, ThreadID tid)
 {
-    return intRegFile[tid].readReg(reg_idx);
+    return intRegs[tid][reg_idx];
 }
 
 FloatReg
@@ -904,7 +904,7 @@
 void
 InOrderCPU::setIntReg(int reg_idx, uint64_t val, ThreadID tid)
 {
-    intRegFile[tid].setReg(reg_idx, val);
+    intRegs[tid][reg_idx] = val;
 }
 
 
diff --git a/src/cpu/inorder/cpu.hh b/src/cpu/inorder/cpu.hh
--- a/src/cpu/inorder/cpu.hh
+++ b/src/cpu/inorder/cpu.hh
@@ -258,11 +258,11 @@
     TheISA::IntReg nextNPC[ThePipeline::MaxThreads];
 
     /** The Register File for the CPU */
-    TheISA::IntRegFile intRegFile[ThePipeline::MaxThreads];;
     union {
         FloatReg f[ThePipeline::MaxThreads][TheISA::NumFloatRegs];
         FloatRegBits i[ThePipeline::MaxThreads][TheISA::NumFloatRegs];
     } floatRegs;
+    TheISA::IntReg intRegs[ThePipeline::MaxThreads][TheISA::NumIntRegs];
 
     /** ISA state */
     TheISA::ISA isa[ThePipeline::MaxThreads];
diff --git a/src/cpu/simple_thread.cc b/src/cpu/simple_thread.cc
--- a/src/cpu/simple_thread.cc
+++ b/src/cpu/simple_thread.cc
@@ -71,7 +71,7 @@
 
     quiesceEvent = new EndQuiesceEvent(tc);
 
-    regs.clear();
+    clearArchRegs();
 
     if (cpu->params()->profile) {
         profile = new FunctionProfile(system->kernelSymtab);
@@ -96,7 +96,7 @@
     : ThreadState(_cpu, _thread_num, _process, _asid),
       cpu(_cpu), itb(_itb), dtb(_dtb)
 {
-    regs.clear();
+    clearArchRegs();
     tc = new ProxyThreadContext<SimpleThread>(this);
 }
 
@@ -193,6 +193,7 @@
     ThreadState::serialize(os);
     regs.serialize(cpu, os);
     SERIALIZE_ARRAY(floatRegs.i, TheISA::NumFloatRegs);
+    SERIALIZE_ARRAY(intRegs, TheISA::NumIntRegs);
     // thread_num and cpu_id are deterministic from the config
 }
 
@@ -203,6 +204,7 @@
     ThreadState::unserialize(cp, section);
     regs.unserialize(cpu, cp, section);
     UNSERIALIZE_ARRAY(floatRegs.i, TheISA::NumFloatRegs);
+    UNSERIALIZE_ARRAY(intRegs, TheISA::NumIntRegs);
     // thread_num and cpu_id are deterministic from the config
 }
 
diff --git a/src/cpu/simple_thread.hh b/src/cpu/simple_thread.hh
--- a/src/cpu/simple_thread.hh
+++ b/src/cpu/simple_thread.hh
@@ -36,6 +36,7 @@
 #include "arch/isa_traits.hh"
 #include "arch/regfile.hh"
 #include "arch/tlb.hh"
+#include "arch/types.hh"
 #include "base/types.hh"
 #include "config/full_system.hh"
 #include "cpu/thread_context.hh"
@@ -104,6 +105,7 @@
         FloatReg f[TheISA::NumFloatRegs];
         FloatRegBits i[TheISA::NumFloatRegs];
     } floatRegs;
+    TheISA::IntReg intRegs[TheISA::NumIntRegs];
     TheISA::ISA isa;    // one "instance" of the current ISA.
 
   public:
@@ -231,6 +233,7 @@
     void clearArchRegs()
     {
         regs.clear();
+        memset(intRegs, 0, sizeof(intRegs));
         memset(floatRegs.i, 0, sizeof(floatRegs.i));
     }
 
@@ -240,7 +243,7 @@
     uint64_t readIntReg(int reg_idx)
     {
         int flatIndex = isa.flattenIntIndex(reg_idx);
-        return regs.readIntReg(flatIndex);
+        return intRegs[flatIndex];
     }
 
     FloatReg readFloatReg(int reg_idx)
@@ -258,7 +261,7 @@
     void setIntReg(int reg_idx, uint64_t val)
     {
         int flatIndex = isa.flattenIntIndex(reg_idx);
-        regs.setIntReg(flatIndex, val);
+        intRegs[flatIndex] = val;
     }
 
     void setFloatReg(int reg_idx, FloatReg val)
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to