changeset bb25e7646c41 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=bb25e7646c41
description:
ISA: Make the decode function part of the ISA's decoder.
diffstat:
src/arch/alpha/SConscript | 1 +
src/arch/alpha/decoder.cc | 38 +++++++++++++
src/arch/alpha/decoder.hh | 24 +++++++-
src/arch/alpha/isa/main.isa | 1 +
src/arch/arm/SConscript | 1 +
src/arch/arm/decoder.cc | 38 +++++++++++++
src/arch/arm/decoder.hh | 24 +++++++-
src/arch/arm/isa/includes.isa | 1 +
src/arch/generic/SConscript | 31 ----------
src/arch/generic/decoder.cc | 38 -------------
src/arch/generic/decoder.hh | 64 ----------------------
src/arch/isa_parser.py | 2 +-
src/arch/mips/SConscript | 1 +
src/arch/mips/decoder.cc | 38 +++++++++++++
src/arch/mips/decoder.hh | 24 +++++++-
src/arch/mips/isa/includes.isa | 1 +
src/arch/power/SConscript | 1 +
src/arch/power/decoder.cc | 38 +++++++++++++
src/arch/power/decoder.hh | 24 +++++++-
src/arch/power/isa/includes.isa | 1 +
src/arch/sparc/SConscript | 1 +
src/arch/sparc/decoder.cc | 38 +++++++++++++
src/arch/sparc/decoder.hh | 24 +++++++-
src/arch/sparc/isa/includes.isa | 1 +
src/arch/x86/SConscript | 1 +
src/arch/x86/decoder.cc | 38 +++++++++++++
src/arch/x86/decoder.hh | 24 +++++++-
src/arch/x86/isa/includes.isa | 1 +
src/arch/x86/isa_traits.hh | 3 -
src/cpu/SConscript | 1 +
src/cpu/decode_cache.cc | 113 ++++++++++++++++++++++++++++++++++++++++
src/cpu/decode_cache.hh | 84 +++--------------------------
32 files changed, 491 insertions(+), 229 deletions(-)
diffs (truncated from 1033 to 300 lines):
diff -r 736048daf279 -r bb25e7646c41 src/arch/alpha/SConscript
--- a/src/arch/alpha/SConscript Fri May 25 00:54:39 2012 -0700
+++ b/src/arch/alpha/SConscript Fri May 25 00:55:24 2012 -0700
@@ -32,6 +32,7 @@
Import('*')
if env['TARGET_ISA'] == 'alpha':
+ Source('decoder.cc')
Source('ev5.cc')
Source('faults.cc')
Source('freebsd/system.cc')
diff -r 736048daf279 -r bb25e7646c41 src/arch/alpha/decoder.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/arch/alpha/decoder.cc Fri May 25 00:55:24 2012 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011 Google
+ * 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
+ */
+
+#include "arch/alpha/decoder.hh"
+
+namespace AlphaISA
+{
+
+DecodeCache Decoder::defaultCache;
+
+}
diff -r 736048daf279 -r bb25e7646c41 src/arch/alpha/decoder.hh
--- a/src/arch/alpha/decoder.hh Fri May 25 00:54:39 2012 -0700
+++ b/src/arch/alpha/decoder.hh Fri May 25 00:55:24 2012 -0700
@@ -31,13 +31,31 @@
#ifndef __ARCH_ALPHA_DECODER_HH__
#define __ARCH_ALPHA_DECODER_HH__
-#include "arch/generic/decoder.hh"
+#include "arch/types.hh"
+#include "cpu/decode_cache.hh"
+#include "cpu/static_inst_fwd.hh"
namespace AlphaISA
{
-class Decoder : public GenericISA::Decoder
-{};
+class Decoder
+{
+ protected:
+ /// A cache of decoded instruction objects.
+ static DecodeCache defaultCache;
+
+ public:
+ StaticInstPtr decodeInst(ExtMachInst mach_inst);
+
+ /// Decode a machine instruction.
+ /// @param mach_inst The binary instruction to decode.
+ /// @retval A pointer to the corresponding StaticInst object.
+ StaticInstPtr
+ decode(ExtMachInst mach_inst, Addr addr)
+ {
+ return defaultCache.decode(this, mach_inst, addr);
+ }
+};
} // namespace AlphaISA
diff -r 736048daf279 -r bb25e7646c41 src/arch/alpha/isa/main.isa
--- a/src/arch/alpha/isa/main.isa Fri May 25 00:54:39 2012 -0700
+++ b/src/arch/alpha/isa/main.isa Fri May 25 00:55:24 2012 -0700
@@ -56,6 +56,7 @@
output decoder {{
#include <cmath>
+#include "arch/alpha/decoder.hh"
#include "arch/alpha/registers.hh"
#include "arch/alpha/regredir.hh"
#include "base/loader/symtab.hh"
diff -r 736048daf279 -r bb25e7646c41 src/arch/arm/SConscript
--- a/src/arch/arm/SConscript Fri May 25 00:54:39 2012 -0700
+++ b/src/arch/arm/SConscript Fri May 25 00:55:24 2012 -0700
@@ -47,6 +47,7 @@
# Workaround for bug in SCons version > 0.97d20071212
# Scons bug id: 2006 M5 Bug id: 308
Dir('isa/formats')
+ Source('decoder.cc')
Source('faults.cc')
Source('insts/macromem.cc')
Source('insts/mem.cc')
diff -r 736048daf279 -r bb25e7646c41 src/arch/arm/decoder.cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/arch/arm/decoder.cc Fri May 25 00:55:24 2012 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2011 Google
+ * 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
+ */
+
+#include "arch/arm/decoder.hh"
+
+namespace ArmISA
+{
+
+DecodeCache Decoder::defaultCache;
+
+}
diff -r 736048daf279 -r bb25e7646c41 src/arch/arm/decoder.hh
--- a/src/arch/arm/decoder.hh Fri May 25 00:54:39 2012 -0700
+++ b/src/arch/arm/decoder.hh Fri May 25 00:55:24 2012 -0700
@@ -31,13 +31,31 @@
#ifndef __ARCH_ARM_DECODER_HH__
#define __ARCH_ARM_DECODER_HH__
-#include "arch/generic/decoder.hh"
+#include "arch/types.hh"
+#include "cpu/decode_cache.hh"
+#include "cpu/static_inst_fwd.hh"
namespace ArmISA
{
-class Decoder : public GenericISA::Decoder
-{};
+class Decoder
+{
+ protected:
+ /// A cache of decoded instruction objects.
+ static DecodeCache defaultCache;
+
+ public:
+ StaticInstPtr decodeInst(ExtMachInst mach_inst);
+
+ /// Decode a machine instruction.
+ /// @param mach_inst The binary instruction to decode.
+ /// @retval A pointer to the corresponding StaticInst object.
+ StaticInstPtr
+ decode(ExtMachInst mach_inst, Addr addr)
+ {
+ return defaultCache.decode(this, mach_inst, addr);
+ }
+};
} // namespace ArmISA
diff -r 736048daf279 -r bb25e7646c41 src/arch/arm/isa/includes.isa
--- a/src/arch/arm/isa/includes.isa Fri May 25 00:54:39 2012 -0700
+++ b/src/arch/arm/isa/includes.isa Fri May 25 00:55:24 2012 -0700
@@ -63,6 +63,7 @@
}};
output decoder {{
+#include "arch/arm/decoder.hh"
#include "arch/arm/faults.hh"
#include "arch/arm/intregs.hh"
#include "arch/arm/isa_traits.hh"
diff -r 736048daf279 -r bb25e7646c41 src/arch/generic/SConscript
--- a/src/arch/generic/SConscript Fri May 25 00:54:39 2012 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-# Copyright (c) 2012 Google
-# 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
-
-Import('*')
-
-Source('decoder.cc')
diff -r 736048daf279 -r bb25e7646c41 src/arch/generic/decoder.cc
--- a/src/arch/generic/decoder.cc Fri May 25 00:54:39 2012 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2011 Google
- * 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
- */
-
-#include "arch/generic/decoder.hh"
-
-namespace GenericISA
-{
-
-DecodeCache<TheISA::decodeInst> Decoder::defaultCache;
-
-}
diff -r 736048daf279 -r bb25e7646c41 src/arch/generic/decoder.hh
--- a/src/arch/generic/decoder.hh Fri May 25 00:54:39 2012 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2011-2012 Google
- * 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.
- *
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev