On 1/27/24 08:03, Philippe Mathieu-Daudé wrote:
Add a Coccinelle script to convert the following slow path
(due to the QOM cast macro):

   &ARCH_CPU(..)->env

to the following fast path:

   cpu_env(..)

Signed-off-by: Philippe Mathieu-Daudé<phi...@linaro.org>
---
  MAINTAINERS                               |  1 +
  scripts/coccinelle/cpu_env.cocci_template | 92 +++++++++++++++++++++++
  2 files changed, 93 insertions(+)
  create mode 100644 scripts/coccinelle/cpu_env.cocci_template

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


+/* Both first_cpu/current_cpu are CPUState* */
+@@
+symbol first_cpu;
+symbol current_cpu;
+@@
+(
+-    CPU(first_cpu)
++    first_cpu
+|
+-    CPU(current_cpu)
++    current_cpu
+)

I think part of Paolo's query is if there are any new instances of

commit 96449e4a30a56e3303d6d0407aca130c71671754
Author: Philippe Mathieu-Daudé <phi...@linaro.org>
Date:   Tue May 12 09:00:18 2020 +0200

    target: Remove unnecessary CPU() cast
...
      @@
      typedef CPUState;
      CPUState *s;
      @@
      -   CPU(s)
      +   s


r~

Reply via email to