[PATCH v17 03/16] tcg: Record nb_deleted_ops in TCGContext

Richard Henderson posted 16 patches 2 years, 4 months ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, "Dr. David Alan Gilbert" <dave@treblig.org>, Peter Xu <peterx@redhat.com>, David Hildenbrand <david@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Laurent Vivier <laurent@vivier.eu>, Nicholas Piggin <npiggin@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>
[PATCH v17 03/16] tcg: Record nb_deleted_ops in TCGContext
Posted by Richard Henderson 2 years, 4 months ago
Record the number of ops that are removed during optimization.
To be copied into TBStatistics when desired.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 include/tcg/tcg.h | 1 +
 tcg/tcg.c         | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index e49574b7c7..d60349878f 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -566,6 +566,7 @@ struct TCGContext {
 
     /* Used by TBStatistics */
     int orig_nb_ops;
+    int nb_deleted_ops;
 
     /* Exit to translator on overflow. */
     sigjmp_buf jmp_trans;
diff --git a/tcg/tcg.c b/tcg/tcg.c
index e90b0a0c69..60be2f429c 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1494,6 +1494,7 @@ void tcg_func_start(TCGContext *s)
 
     s->nb_ops = 0;
     s->nb_labels = 0;
+    s->nb_deleted_ops = 0;
     s->current_frame_offset = s->frame_start;
 
 #ifdef CONFIG_DEBUG_TCG
@@ -3049,6 +3050,7 @@ void tcg_op_remove(TCGContext *s, TCGOp *op)
     QTAILQ_REMOVE(&s->ops, op, link);
     QTAILQ_INSERT_TAIL(&s->free_ops, op, link);
     s->nb_ops--;
+    s->nb_deleted_ops++;
 }
 
 void tcg_remove_ops_after(TCGOp *op)
-- 
2.34.1
Re: [PATCH v17 03/16] tcg: Record nb_deleted_ops in TCGContext
Posted by Alex Bennée 2 years, 3 months ago
Richard Henderson <richard.henderson@linaro.org> writes:

> Record the number of ops that are removed during optimization.
> To be copied into TBStatistics when desired.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro