[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 48/55] target/openrisc: Prefer fast cpu_env() over slower CPU QOM
From: |
Thomas Huth |
Subject: |
[PULL 48/55] target/openrisc: Prefer fast cpu_env() over slower CPU QOM cast macro |
Date: |
Tue, 12 Mar 2024 13:43:32 +0100 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
Mechanical patch produced running the command documented
in scripts/coccinelle/cpu_env.cocci_template header.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240129164514.73104-21-philmd@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
target/openrisc/gdbstub.c | 6 ++----
target/openrisc/interrupt.c | 6 ++----
target/openrisc/translate.c | 6 ++----
3 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/target/openrisc/gdbstub.c b/target/openrisc/gdbstub.c
index d1074a0581..c2a77d5d4d 100644
--- a/target/openrisc/gdbstub.c
+++ b/target/openrisc/gdbstub.c
@@ -23,8 +23,7 @@
int openrisc_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n)
{
- OpenRISCCPU *cpu = OPENRISC_CPU(cs);
- CPUOpenRISCState *env = &cpu->env;
+ CPUOpenRISCState *env = cpu_env(cs);
if (n < 32) {
return gdb_get_reg32(mem_buf, cpu_get_gpr(env, n));
@@ -48,9 +47,8 @@ int openrisc_cpu_gdb_read_register(CPUState *cs, GByteArray
*mem_buf, int n)
int openrisc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
{
- OpenRISCCPU *cpu = OPENRISC_CPU(cs);
CPUClass *cc = CPU_GET_CLASS(cs);
- CPUOpenRISCState *env = &cpu->env;
+ CPUOpenRISCState *env = cpu_env(cs);
uint32_t tmp;
if (n > cc->gdb_num_core_regs) {
diff --git a/target/openrisc/interrupt.c b/target/openrisc/interrupt.c
index d4fdb8ce8e..b3b5b40577 100644
--- a/target/openrisc/interrupt.c
+++ b/target/openrisc/interrupt.c
@@ -29,8 +29,7 @@
void openrisc_cpu_do_interrupt(CPUState *cs)
{
- OpenRISCCPU *cpu = OPENRISC_CPU(cs);
- CPUOpenRISCState *env = &cpu->env;
+ CPUOpenRISCState *env = cpu_env(cs);
int exception = cs->exception_index;
env->epcr = env->pc;
@@ -105,8 +104,7 @@ void openrisc_cpu_do_interrupt(CPUState *cs)
bool openrisc_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
{
- OpenRISCCPU *cpu = OPENRISC_CPU(cs);
- CPUOpenRISCState *env = &cpu->env;
+ CPUOpenRISCState *env = cpu_env(cs);
int idx = -1;
if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->sr & SR_IEE)) {
diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c
index 785bcb6552..23fff46084 100644
--- a/target/openrisc/translate.c
+++ b/target/openrisc/translate.c
@@ -1564,8 +1564,7 @@ static void openrisc_tr_insn_start(DisasContextBase
*dcbase, CPUState *cs)
static void openrisc_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs)
{
DisasContext *dc = container_of(dcbase, DisasContext, base);
- OpenRISCCPU *cpu = OPENRISC_CPU(cs);
- uint32_t insn = translator_ldl(&cpu->env, &dc->base, dc->base.pc_next);
+ uint32_t insn = translator_ldl(cpu_env(cs), &dc->base, dc->base.pc_next);
if (!decode(dc, insn)) {
gen_illegal_exception(dc);
@@ -1668,8 +1667,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock
*tb, int *max_insns,
void openrisc_cpu_dump_state(CPUState *cs, FILE *f, int flags)
{
- OpenRISCCPU *cpu = OPENRISC_CPU(cs);
- CPUOpenRISCState *env = &cpu->env;
+ CPUOpenRISCState *env = cpu_env(cs);
int i;
qemu_fprintf(f, "PC=%08x\n", env->pc);
--
2.44.0
- [PULL 38/55] target/alpha: Prefer fast cpu_env() over slower CPU QOM cast macro, (continued)
- [PULL 38/55] target/alpha: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- [PULL 34/55] bulk: Access existing variables initialized to &S->F when available, Thomas Huth, 2024/03/12
- [PULL 45/55] target/microblaze: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- [PULL 47/55] target/nios2: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- [PULL 39/55] target/avr: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- [PULL 51/55] target/sh4: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- [PULL 40/55] target/cris: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- [PULL 37/55] target: Replace CPU_GET_CLASS(cpu -> obj) in cpu_reset_hold() handler, Thomas Huth, 2024/03/12
- [PULL 44/55] target/m68k: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- [PULL 42/55] target/i386/hvf: Use CPUState typedef, Thomas Huth, 2024/03/12
- [PULL 48/55] target/openrisc: Prefer fast cpu_env() over slower CPU QOM cast macro,
Thomas Huth <=
- [PULL 49/55] target/ppc: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- [PULL 50/55] target/rx: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- [PULL 52/55] target/sparc: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- [PULL 55/55] user: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- [PULL 29/55] hw/virtio/vhost: Fix missing ERRP_GUARD() for error_prepend(), Thomas Huth, 2024/03/12
- [PULL 33/55] error: Move ERRP_GUARD() to the beginning of the function, Thomas Huth, 2024/03/12
- [PULL 32/55] target/s390x/cpu_models: Fix missing ERRP_GUARD() for error_prepend(), Thomas Huth, 2024/03/12
- [PULL 53/55] target/tricore: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- [PULL 54/55] target/xtensa: Prefer fast cpu_env() over slower CPU QOM cast macro, Thomas Huth, 2024/03/12
- Re: [PULL 00/55] Misc ERRP_GUARD() and cpu_env() patches, Peter Maydell, 2024/03/12