Skip to content

Commit

Permalink
meson: target
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
bonzini committed Aug 21, 2020
1 parent 2c44220 commit abff1ab
Show file tree
Hide file tree
Showing 62 changed files with 595 additions and 328 deletions.
3 changes: 1 addition & 2 deletions Makefile.target
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ obj-$(CONFIG_TCG) += tcg/tcg-common.o tcg/optimize.o
obj-$(CONFIG_TCG_INTERPRETER) += tcg/tci.o
obj-$(CONFIG_TCG_INTERPRETER) += disas/tci.o
obj-$(CONFIG_TCG) += fpu/softfloat.o
obj-y += target/$(TARGET_BASE_ARCH)/
obj-y += disas.o
obj-$(call notempty,$(TARGET_XML_FILES)) += gdbstub-xml.o
LIBS := $(libs_cpu) $(LIBS)
Expand Down Expand Up @@ -168,7 +167,7 @@ LIBS := $(LIBS) $(BRLAPI_LIBS) $(SDL_LIBS) $(SPICE_LIBS) $(OPENGL_LIBS) $(SECCOM
LIBS := $(LIBS) $(COREAUDIO_LIBS) $(DSOUND_LIBS)
LIBS := $(LIBS) $(VDE_LIBS) $(SLIRP_LIBS)
LIBS := $(LIBS) $(LIBUSB_LIBS) $(SMARTCARD_LIBS) $(USB_REDIR_LIBS)
LIBS := $(LIBS) $(VIRGL_LIBS)
LIBS := $(LIBS) $(VIRGL_LIBS) $(CURSES_LIBS)

generated-files-y += hmp-commands.h hmp-commands-info.h

Expand Down
5 changes: 0 additions & 5 deletions libdecnumber/Makefile.objs

This file was deleted.

7 changes: 7 additions & 0 deletions libdecnumber/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
libdecnumber = files(
'decContext.c',
'decNumber.c',
'dpd/decimal128.c',
'dpd/decimal32.c',
'dpd/decimal64.c',
)
11 changes: 11 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -647,10 +647,15 @@ libqemuutil = static_library('qemuutil',
qemuutil = declare_dependency(link_with: libqemuutil,
sources: genh + version_res)

decodetree = generator(find_program('scripts/decodetree.py'),
output: 'decode-@[email protected]',
arguments: ['@INPUT@', '@EXTRA_ARGS@', '-o', '@OUTPUT@'])

subdir('audio')
subdir('io')
subdir('chardev')
subdir('fsdev')
subdir('libdecnumber')
subdir('target')
subdir('dump')

Expand Down Expand Up @@ -787,6 +792,9 @@ foreach target : target_dirs
if target.endswith('-softmmu')
qemu_target_name = 'qemu-system-' + target_name
target_type='system'
t = target_softmmu_arch[arch].apply(config_target, strict: false)
arch_srcs += t.sources()

hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
hw = hw_arch[hw_dir].apply(config_target, strict: false)
arch_srcs += hw.sources()
Expand All @@ -807,6 +815,9 @@ foreach target : target_dirs
)
endif

t = target_arch[arch].apply(config_target, strict: false)
arch_srcs += t.sources()

target_common = common_ss.apply(config_target, strict: false)
objects = common_all.extract_objects(target_common.sources())

Expand Down
2 changes: 1 addition & 1 deletion scripts/decodetree.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ def main():
long_opts = ['decode=', 'translate=', 'output=', 'insnwidth=',
'static-decode=', 'varinsnwidth=']
try:
(opts, args) = getopt.getopt(sys.argv[1:], 'o:vw:', long_opts)
(opts, args) = getopt.gnu_getopt(sys.argv[1:], 'o:vw:', long_opts)
except getopt.GetoptError as err:
error(0, err)
for o, a in opts:
Expand Down
4 changes: 0 additions & 4 deletions target/alpha/Makefile.objs

This file was deleted.

18 changes: 18 additions & 0 deletions target/alpha/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
alpha_ss = ss.source_set()
alpha_ss.add(files(
'cpu.c',
'fpu_helper.c',
'gdbstub.c',
'helper.c',
'int_helper.c',
'mem_helper.c',
'sys_helper.c',
'translate.c',
'vax_helper.c',
))

alpha_softmmu_ss = ss.source_set()
alpha_softmmu_ss.add(files('machine.c'))

target_arch += {'alpha': alpha_ss}
target_softmmu_arch += {'alpha': alpha_softmmu_ss}
89 changes: 0 additions & 89 deletions target/arm/Makefile.objs

This file was deleted.

62 changes: 62 additions & 0 deletions target/arm/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
gen = [
decodetree.process('sve.decode', extra_args: '--decode=disas_sve'),
decodetree.process('neon-shared.decode', extra_args: '--static-decode=disas_neon_shared'),
decodetree.process('neon-dp.decode', extra_args: '--static-decode=disas_neon_dp'),
decodetree.process('neon-ls.decode', extra_args: '--static-decode=disas_neon_ls'),
decodetree.process('vfp.decode', extra_args: '--static-decode=disas_vfp'),
decodetree.process('vfp-uncond.decode', extra_args: '--static-decode=disas_vfp_uncond'),
decodetree.process('a32.decode', extra_args: '--static-decode=disas_a32'),
decodetree.process('a32-uncond.decode', extra_args: '--static-decode=disas_a32_uncond'),
decodetree.process('t32.decode', extra_args: '--static-decode=disas_t32'),
decodetree.process('t16.decode', extra_args: ['-w', '16', '--static-decode=disas_t16']),
]

arm_ss = ss.source_set()
arm_ss.add(gen)
arm_ss.add(files(
'cpu.c',
'crypto_helper.c',
'debug_helper.c',
'gdbstub.c',
'helper.c',
'iwmmxt_helper.c',
'm_helper.c',
'neon_helper.c',
'op_helper.c',
'tlb_helper.c',
'translate.c',
'vec_helper.c',
'vfp_helper.c',
'cpu_tcg.c',
))
arm_ss.add(zlib)

arm_ss.add(when: 'CONFIG_TCG', if_true: files('arm-semi.c'))

kvm_ss = ss.source_set()
kvm_ss.add(when: 'TARGET_AARCH64', if_true: files('kvm64.c'), if_false: files('kvm32.c'))
arm_ss.add_all(when: 'CONFIG_KVM', if_true: kvm_ss)
arm_ss.add(when: 'CONFIG_KVM', if_true: files('kvm.c'), if_false: files('kvm-stub.c'))

arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
'cpu64.c',
'gdbstub64.c',
'helper-a64.c',
'mte_helper.c',
'pauth_helper.c',
'sve_helper.c',
'translate-a64.c',
'translate-sve.c',
))

arm_softmmu_ss = ss.source_set()
arm_softmmu_ss.add(files(
'arch_dump.c',
'arm-powerctl.c',
'machine.c',
'monitor.c',
'psci.c',
))

target_arch += {'arm': arm_ss}
target_softmmu_arch += {'arm': arm_softmmu_ss}
34 changes: 0 additions & 34 deletions target/avr/Makefile.objs

This file was deleted.

2 changes: 1 addition & 1 deletion target/avr/disas.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static int append_16(DisasContext *ctx, int x)

/* Include the auto-generated decoder. */
static bool decode_insn(DisasContext *ctx, uint16_t insn);
#include "decode_insn.c.inc"
#include "decode-insn.c.inc"

#define output(mnemonic, format, ...) \
(pctx->info->fprintf_func(pctx->info->stream, "%-9s " format, \
Expand Down
20 changes: 20 additions & 0 deletions target/avr/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
gen = [
decodetree.process('insn.decode', extra_args: [ '--decode', 'decode_insn',
'--insnwidth', '16' ])
]

avr_ss = ss.source_set()
avr_softmmu_ss = ss.source_set()

avr_ss.add(gen)
avr_ss.add(files(
'translate.c',
'helper.c',
'cpu.c',
'gdbstub.c',
'disas.c'))

avr_softmmu_ss.add(files('machine.c'))

target_arch += {'avr': avr_ss}
target_softmmu_arch += {'avr': avr_softmmu_ss}
2 changes: 1 addition & 1 deletion target/avr/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static bool avr_have_feature(DisasContext *ctx, int feature)
}

static bool decode_insn(DisasContext *ctx, uint16_t insn);
#include "decode_insn.c.inc"
#include "decode-insn.c.inc"

/*
* Arithmetic Instructions
Expand Down
3 changes: 0 additions & 3 deletions target/cris/Makefile.objs

This file was deleted.

14 changes: 14 additions & 0 deletions target/cris/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cris_ss = ss.source_set()
cris_ss.add(files(
'cpu.c',
'gdbstub.c',
'helper.c',
'op_helper.c',
'translate.c',
))

cris_softmmu_ss = ss.source_set()
cris_softmmu_ss.add(files('mmu.c', 'machine.c'))

target_arch += {'cris': cris_ss}
target_softmmu_arch += {'cris': cris_softmmu_ss}
11 changes: 0 additions & 11 deletions target/hppa/Makefile.objs

This file was deleted.

19 changes: 19 additions & 0 deletions target/hppa/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
gen = decodetree.process('insns.decode')

hppa_ss = ss.source_set()
hppa_ss.add(gen)
hppa_ss.add(files(
'cpu.c',
'gdbstub.c',
'helper.c',
'int_helper.c',
'mem_helper.c',
'op_helper.c',
'translate.c',
))

hppa_softmmu_ss = ss.source_set()
hppa_softmmu_ss.add(files('machine.c'))

target_arch += {'hppa': hppa_ss}
target_softmmu_arch += {'hppa': hppa_softmmu_ss}
2 changes: 1 addition & 1 deletion target/hppa/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ static int expand_shl11(DisasContext *ctx, int val)


/* Include the auto-generated decoder. */
#include "decode.c.inc"
#include "decode-insns.c.inc"

/* We are not using a goto_tb (for whatever reason), but have updated
the iaq (for whatever reason), so don't do it again on exit. */
Expand Down
Loading

0 comments on commit abff1ab

Please sign in to comment.