diff mbox

[15/22] gen-icount: fold exitreq_label into TCGContext

Message ID 1499586614-20507-16-git-send-email-cota@braap.org
State New
Headers show

Commit Message

Emilio Cota July 9, 2017, 7:50 a.m. UTC
Before we make TCGContext thread-local.

Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 include/exec/gen-icount.h | 7 +++----
 tcg/tcg.h                 | 2 ++
 2 files changed, 5 insertions(+), 4 deletions(-)

Comments

Richard Henderson July 9, 2017, 8:36 p.m. UTC | #1
On 07/08/2017 09:50 PM, Emilio G. Cota wrote:
> Before we make TCGContext thread-local.
> 
> Signed-off-by: Emilio G. Cota<cota@braap.org>
> ---
>   include/exec/gen-icount.h | 7 +++----
>   tcg/tcg.h                 | 2 ++
>   2 files changed, 5 insertions(+), 4 deletions(-)

Reviewed-by: Richard Henderson <rth@twiddle.net>


r~
Alex Bennée July 12, 2017, 3:29 p.m. UTC | #2
Emilio G. Cota <cota@braap.org> writes:

> Before we make TCGContext thread-local.
>
> Signed-off-by: Emilio G. Cota <cota@braap.org>

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

> ---
>  include/exec/gen-icount.h | 7 +++----
>  tcg/tcg.h                 | 2 ++
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h
> index 9b3cb14..489aff7 100644
> --- a/include/exec/gen-icount.h
> +++ b/include/exec/gen-icount.h
> @@ -6,13 +6,12 @@
>  /* Helpers for instruction counting code generation.  */
>
>  static int icount_start_insn_idx;
> -static TCGLabel *exitreq_label;
>
>  static inline void gen_tb_start(TranslationBlock *tb)
>  {
>      TCGv_i32 count, imm;
>
> -    exitreq_label = gen_new_label();
> +    tcg_ctx.exitreq_label = gen_new_label();
>      if (tb->cflags & CF_USE_ICOUNT) {
>          count = tcg_temp_local_new_i32();
>      } else {
> @@ -34,7 +33,7 @@ static inline void gen_tb_start(TranslationBlock *tb)
>          tcg_temp_free_i32(imm);
>      }
>
> -    tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, exitreq_label);
> +    tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, tcg_ctx.exitreq_label);
>
>      if (tb->cflags & CF_USE_ICOUNT) {
>          tcg_gen_st16_i32(count, tcg_ctx.tcg_env,
> @@ -52,7 +51,7 @@ static inline void gen_tb_end(TranslationBlock *tb, int num_insns)
>          tcg_set_insn_param(icount_start_insn_idx, 1, num_insns);
>      }
>
> -    gen_set_label(exitreq_label);
> +    gen_set_label(tcg_ctx.exitreq_label);
>      tcg_gen_exit_tb((uintptr_t)tb + TB_EXIT_REQUESTED);
>
>      /* Terminate the linked list.  */
> diff --git a/tcg/tcg.h b/tcg/tcg.h
> index 4f57878..534ead5 100644
> --- a/tcg/tcg.h
> +++ b/tcg/tcg.h
> @@ -711,6 +711,8 @@ struct TCGContext {
>      /* The TCGBackendData structure is private to tcg-target.inc.c.  */
>      struct TCGBackendData *be;
>
> +    TCGLabel *exitreq_label;
> +
>      TCGTempSet free_temps[TCG_TYPE_COUNT * 2];
>      TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */


--
Alex Bennée
diff mbox

Patch

diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h
index 9b3cb14..489aff7 100644
--- a/include/exec/gen-icount.h
+++ b/include/exec/gen-icount.h
@@ -6,13 +6,12 @@ 
 /* Helpers for instruction counting code generation.  */
 
 static int icount_start_insn_idx;
-static TCGLabel *exitreq_label;
 
 static inline void gen_tb_start(TranslationBlock *tb)
 {
     TCGv_i32 count, imm;
 
-    exitreq_label = gen_new_label();
+    tcg_ctx.exitreq_label = gen_new_label();
     if (tb->cflags & CF_USE_ICOUNT) {
         count = tcg_temp_local_new_i32();
     } else {
@@ -34,7 +33,7 @@  static inline void gen_tb_start(TranslationBlock *tb)
         tcg_temp_free_i32(imm);
     }
 
-    tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, exitreq_label);
+    tcg_gen_brcondi_i32(TCG_COND_LT, count, 0, tcg_ctx.exitreq_label);
 
     if (tb->cflags & CF_USE_ICOUNT) {
         tcg_gen_st16_i32(count, tcg_ctx.tcg_env,
@@ -52,7 +51,7 @@  static inline void gen_tb_end(TranslationBlock *tb, int num_insns)
         tcg_set_insn_param(icount_start_insn_idx, 1, num_insns);
     }
 
-    gen_set_label(exitreq_label);
+    gen_set_label(tcg_ctx.exitreq_label);
     tcg_gen_exit_tb((uintptr_t)tb + TB_EXIT_REQUESTED);
 
     /* Terminate the linked list.  */
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 4f57878..534ead5 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -711,6 +711,8 @@  struct TCGContext {
     /* The TCGBackendData structure is private to tcg-target.inc.c.  */
     struct TCGBackendData *be;
 
+    TCGLabel *exitreq_label;
+
     TCGTempSet free_temps[TCG_TYPE_COUNT * 2];
     TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */