[PATCH 07/10] accel/tcg: Reduce log_pc() declaration scope

Philippe Mathieu-Daudé posted 10 patches 1 week, 1 day ago
[PATCH 07/10] accel/tcg: Reduce log_pc() declaration scope
Posted by Philippe Mathieu-Daudé 1 week, 1 day ago
log_pc() is only used in cpu-exec.c, move it there.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 accel/tcg/internal-target.h | 10 ----------
 accel/tcg/cpu-exec.c        | 10 ++++++++++
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/accel/tcg/internal-target.h b/accel/tcg/internal-target.h
index fe109724c6..750b3706b1 100644
--- a/accel/tcg/internal-target.h
+++ b/accel/tcg/internal-target.h
@@ -71,16 +71,6 @@ G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
 
 bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc);
 
-/* Return the current PC from CPU, which may be cached in TB. */
-static inline vaddr log_pc(CPUState *cpu, const TranslationBlock *tb)
-{
-    if (tb_cflags(tb) & CF_PCREL) {
-        return cpu->cc->get_pc(cpu);
-    } else {
-        return tb->pc;
-    }
-}
-
 /**
  * tcg_req_mo:
  * @type: TCGBar
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 033f5fab10..73bc9f00f7 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -433,6 +433,16 @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
     return tb->tc.ptr;
 }
 
+/* Return the current PC from CPU, which may be cached in TB. */
+static inline vaddr log_pc(CPUState *cpu, const TranslationBlock *tb)
+{
+    if (tb_cflags(tb) & CF_PCREL) {
+        return cpu->cc->get_pc(cpu);
+    } else {
+        return tb->pc;
+    }
+}
+
 /* Execute a TB, and fix up the CPU state afterwards if necessary */
 /*
  * Disable CFI checks.
-- 
2.45.2


Re: [PATCH 07/10] accel/tcg: Reduce log_pc() declaration scope
Posted by Richard Henderson 1 week ago
On 11/15/24 07:20, Philippe Mathieu-Daudé wrote:
> log_pc() is only used in cpu-exec.c, move it there.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   accel/tcg/internal-target.h | 10 ----------
>   accel/tcg/cpu-exec.c        | 10 ++++++++++
>   2 files changed, 10 insertions(+), 10 deletions(-)

Last use outside of cpu-exec.c removed in dafa0ecc9785.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

Re: [PATCH 07/10] accel/tcg: Reduce log_pc() declaration scope
Posted by Peter Maydell 1 week, 1 day ago
On Fri, 15 Nov 2024 at 15:22, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> log_pc() is only used in cpu-exec.c, move it there.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM