aboutsummaryrefslogtreecommitdiff
path: root/target/riscv
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-08-07 12:10:23 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-08-21 06:30:35 -0400
commitabff1abfe8113a989215ed33c48839a827e531f1 (patch)
treefb31d57aff267871822d237052c264788664047e /target/riscv
parent2c44220d055d12142f27cf513848f17d6007ae35 (diff)
downloadqemu-abff1abfe8113a989215ed33c48839a827e531f1.zip
qemu-abff1abfe8113a989215ed33c48839a827e531f1.tar.gz
qemu-abff1abfe8113a989215ed33c48839a827e531f1.tar.bz2
meson: target
Similar to hw_arch, each architecture defines two sourceset which are placed in dictionaries target_arch and target_softmmu_arch. These are then picked up from there when building the per-emulator static_library. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/riscv')
-rw-r--r--target/riscv/Makefile.objs28
-rw-r--r--target/riscv/meson.build34
-rw-r--r--target/riscv/translate.c4
3 files changed, 36 insertions, 30 deletions
diff --git a/target/riscv/Makefile.objs b/target/riscv/Makefile.objs
deleted file mode 100644
index 1cd4c58..0000000
--- a/target/riscv/Makefile.objs
+++ /dev/null
@@ -1,28 +0,0 @@
-obj-y += translate.o op_helper.o cpu_helper.o cpu.o csr.o fpu_helper.o vector_helper.o gdbstub.o
-obj-$(CONFIG_SOFTMMU) += pmp.o
-
-ifeq ($(CONFIG_SOFTMMU),y)
-obj-y += monitor.o
-endif
-
-DECODETREE = $(SRC_PATH)/scripts/decodetree.py
-
-decode32-y = $(SRC_PATH)/target/riscv/insn32.decode
-decode32-$(TARGET_RISCV64) += $(SRC_PATH)/target/riscv/insn32-64.decode
-
-decode16-y = $(SRC_PATH)/target/riscv/insn16.decode
-decode16-$(TARGET_RISCV32) += $(SRC_PATH)/target/riscv/insn16-32.decode
-decode16-$(TARGET_RISCV64) += $(SRC_PATH)/target/riscv/insn16-64.decode
-
-target/riscv/decode_insn32.c.inc: $(decode32-y) $(DECODETREE)
- $(call quiet-command, \
- $(PYTHON) $(DECODETREE) -o $@ --static-decode decode_insn32 \
- $(decode32-y), "GEN", $(TARGET_DIR)$@)
-
-target/riscv/decode_insn16.c.inc: $(decode16-y) $(DECODETREE)
- $(call quiet-command, \
- $(PYTHON) $(DECODETREE) -o $@ --static-decode decode_insn16 \
- --insnwidth 16 $(decode16-y), "GEN", $(TARGET_DIR)$@)
-
-target/riscv/translate.o: target/riscv/decode_insn32.c.inc \
- target/riscv/decode_insn16.c.inc
diff --git a/target/riscv/meson.build b/target/riscv/meson.build
new file mode 100644
index 0000000..abd647f
--- /dev/null
+++ b/target/riscv/meson.build
@@ -0,0 +1,34 @@
+# FIXME extra_args should accept files()
+dir = meson.current_source_dir()
+gen32 = [
+ decodetree.process('insn16.decode', extra_args: [dir / 'insn16-32.decode', '--static-decode=decode_insn16', '--insnwidth=16']),
+ decodetree.process('insn32.decode', extra_args: '--static-decode=decode_insn32'),
+]
+
+gen64 = [
+ decodetree.process('insn16.decode', extra_args: [dir / 'insn16-64.decode', '--static-decode=decode_insn16', '--insnwidth=16']),
+ decodetree.process('insn32.decode', extra_args: [dir / 'insn32-64.decode', '--static-decode=decode_insn32']),
+]
+
+riscv_ss = ss.source_set()
+riscv_ss.add(when: 'TARGET_RISCV32', if_true: gen32)
+riscv_ss.add(when: 'TARGET_RISCV64', if_true: gen64)
+riscv_ss.add(files(
+ 'cpu.c',
+ 'cpu_helper.c',
+ 'csr.c',
+ 'fpu_helper.c',
+ 'gdbstub.c',
+ 'op_helper.c',
+ 'vector_helper.c',
+ 'translate.c',
+))
+
+riscv_softmmu_ss = ss.source_set()
+riscv_softmmu_ss.add(files(
+ 'pmp.c',
+ 'monitor.c'
+))
+
+target_arch += {'riscv': riscv_ss}
+target_softmmu_arch += {'riscv': riscv_softmmu_ss}
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
index 5ef5613..d0485c0 100644
--- a/target/riscv/translate.c
+++ b/target/riscv/translate.c
@@ -583,7 +583,7 @@ static int ex_rvc_shifti(DisasContext *ctx, int imm)
}
/* Include the auto-generated decoder for 32 bit insn */
-#include "decode_insn32.c.inc"
+#include "decode-insn32.c.inc"
static bool gen_arith_imm_fn(DisasContext *ctx, arg_i *a,
void (*func)(TCGv, TCGv, target_long))
@@ -728,7 +728,7 @@ static bool gen_shift(DisasContext *ctx, arg_r *a,
#include "insn_trans/trans_privileged.c.inc"
/* Include the auto-generated decoder for 16 bit insn */
-#include "decode_insn16.c.inc"
+#include "decode-insn16.c.inc"
static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode)
{