[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 35/76] target/microblaze: Add decodetree infrastructure
From: |
Richard Henderson |
Subject: |
[PATCH v2 35/76] target/microblaze: Add decodetree infrastructure |
Date: |
Fri, 28 Aug 2020 07:18:48 -0700 |
The new interface is a stub that recognizes no instructions.
It falls back to the old decoder for all instructions.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/microblaze/insns.decode | 18 ++++++++++++++++++
target/microblaze/translate.c | 11 +++++++++--
target/microblaze/meson.build | 3 +++
3 files changed, 30 insertions(+), 2 deletions(-)
create mode 100644 target/microblaze/insns.decode
diff --git a/target/microblaze/insns.decode b/target/microblaze/insns.decode
new file mode 100644
index 0000000000..1ed9ca0731
--- /dev/null
+++ b/target/microblaze/insns.decode
@@ -0,0 +1,18 @@
+#
+# MicroBlaze instruction decode definitions.
+#
+# Copyright (c) 2020 Richard Henderson <rth@twiddle.net>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
+#
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
index 65ce8f3cd6..e624093745 100644
--- a/target/microblaze/translate.c
+++ b/target/microblaze/translate.c
@@ -81,6 +81,9 @@ typedef struct DisasContext {
int abort_at_next_insn;
} DisasContext;
+/* Include the auto-generated decoder. */
+#include "decode-insns.c.inc"
+
static inline void t_sync_flags(DisasContext *dc)
{
/* Synch the tb dependent flags between translator and runtime. */
@@ -1506,7 +1509,7 @@ static struct decoder_info {
{{0, 0}, dec_null}
};
-static inline void decode(DisasContext *dc, uint32_t ir)
+static void old_decode(DisasContext *dc, uint32_t ir)
{
int i;
@@ -1584,6 +1587,7 @@ static void mb_tr_translate_insn(DisasContextBase *dcb,
CPUState *cs)
{
DisasContext *dc = container_of(dcb, DisasContext, base);
CPUMBState *env = cs->env_ptr;
+ uint32_t ir;
/* TODO: This should raise an exception, not terminate qemu. */
if (dc->base.pc_next & 3) {
@@ -1592,7 +1596,10 @@ static void mb_tr_translate_insn(DisasContextBase *dcb,
CPUState *cs)
}
dc->clear_imm = 1;
- decode(dc, cpu_ldl_code(env, dc->base.pc_next));
+ ir = cpu_ldl_code(env, dc->base.pc_next);
+ if (!decode(dc, ir)) {
+ old_decode(dc, ir);
+ }
if (dc->clear_imm && (dc->tb_flags & IMM_FLAG)) {
dc->tb_flags &= ~IMM_FLAG;
tcg_gen_discard_i32(cpu_imm);
diff --git a/target/microblaze/meson.build b/target/microblaze/meson.build
index b8fe4afe61..639c3f73a8 100644
--- a/target/microblaze/meson.build
+++ b/target/microblaze/meson.build
@@ -1,4 +1,7 @@
+gen = decodetree.process('insns.decode')
+
microblaze_ss = ss.source_set()
+microblaze_ss.add(gen)
microblaze_ss.add(files(
'cpu.c',
'gdbstub.c',
--
2.25.1
- [PATCH v2 27/76] target/microblaze: Check singlestep_enabled in gen_goto_tb, (continued)
- [PATCH v2 27/76] target/microblaze: Check singlestep_enabled in gen_goto_tb, Richard Henderson, 2020/08/28
- [PATCH v2 29/76] target/microblaze: Convert to translator_loop, Richard Henderson, 2020/08/28
- [PATCH v2 30/76] target/microblaze: Remove SIM_COMPAT, Richard Henderson, 2020/08/28
- [PATCH v2 28/76] target/microblaze: Convert to DisasContextBase, Richard Henderson, 2020/08/28
- [PATCH v2 31/76] target/microblaze: Remove DISAS_GNU, Richard Henderson, 2020/08/28
- [PATCH v2 33/76] target/microblaze: Remove LOG_DIS, Richard Henderson, 2020/08/28
- [PATCH v2 32/76] target/microblaze: Remove empty D macros, Richard Henderson, 2020/08/28
- [PATCH v2 35/76] target/microblaze: Add decodetree infrastructure,
Richard Henderson <=
- [PATCH v2 37/76] target/microblaze: Convert dec_sub to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 38/76] target/microblaze: Implement cmp and cmpu inline, Richard Henderson, 2020/08/28
- [PATCH v2 36/76] target/microblaze: Convert dec_add to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 34/76] target/microblaze: Ensure imm constant is always available, Richard Henderson, 2020/08/28
- [PATCH v2 39/76] target/microblaze: Convert dec_pattern to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 40/76] target/microblaze: Convert dec_and, dec_or, dec_xor to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 42/76] target/microblaze: Convert dec_div to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 41/76] target/microblaze: Convert dec_mul to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 45/76] target/microblaze: Convert dec_barrel to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 43/76] target/microblaze: Unwind properly when raising divide-by-zero, Richard Henderson, 2020/08/28