qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/3] target/hexagon: avoid shadowing globals


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v2 3/3] target/hexagon: avoid shadowing globals
Date: Mon, 9 Oct 2023 08:09:28 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

Hi Brian,

On 6/10/23 00:22, Brian Cain wrote:
The typedef `vaddr` is shadowed by `vaddr` identifiers, so we rename the
identifiers to avoid shadowing the type name.

This one surprises me, since we have other occurences:

include/exec/memory.h:751:bool memory_get_xlat_addr(IOMMUTLBEntry *iotlb, void **vaddr, include/qemu/plugin.h:199:void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, target/arm/internals.h:643:G_NORETURN void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, target/i386/tcg/helper-tcg.h:70:G_NORETURN void handle_unaligned_access(CPUX86State *env, vaddr vaddr,
...

$ git grep -w vaddr, | wc -l
     207

What is the error/warning like?

The global `cpu_env` is shadowed by local `cpu_env` arguments, so we
rename the function arguments to avoid shadowing the global.

Signed-off-by: Brian Cain <bcain@quicinc.com>
---
  target/hexagon/genptr.c                 | 56 ++++++++++++-------------
  target/hexagon/genptr.h                 | 18 ++++----
  target/hexagon/mmvec/system_ext_mmvec.c |  4 +-
  target/hexagon/mmvec/system_ext_mmvec.h |  2 +-
  target/hexagon/op_helper.c              |  4 +-
  5 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c
index 217bc7bb5a..11377ac92b 100644
--- a/target/hexagon/genptr.c
+++ b/target/hexagon/genptr.c
@@ -334,28 +334,28 @@ void gen_set_byte_i64(int N, TCGv_i64 result, TCGv src)
      tcg_gen_deposit_i64(result, result, src64, N * 8, 8);
  }
-static inline void gen_load_locked4u(TCGv dest, TCGv vaddr, int mem_index)
+static inline void gen_load_locked4u(TCGv dest, TCGv v_addr, int mem_index)
  {
-    tcg_gen_qemu_ld_tl(dest, vaddr, mem_index, MO_TEUL);
-    tcg_gen_mov_tl(hex_llsc_addr, vaddr);
+    tcg_gen_qemu_ld_tl(dest, v_addr, mem_index, MO_TEUL);
+    tcg_gen_mov_tl(hex_llsc_addr, v_addr);
      tcg_gen_mov_tl(hex_llsc_val, dest);
  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]