diff mbox

[v1,2/2] gen-icount: Use constant value promises

Message ID 145287211039.25408.7085421323101489964.stgit@localhost (mailing list archive)
State New, archived
Headers show

Commit Message

Lluís Vilanova Jan. 15, 2016, 3:35 p.m. UTC
Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 include/exec/gen-icount.h |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h
index 05d89d3..98d7a85 100644
--- a/include/exec/gen-icount.h
+++ b/include/exec/gen-icount.h
@@ -5,7 +5,7 @@ 
 
 /* Helpers for instruction counting code generation.  */
 
-static TCGArg *icount_arg;
+static TCGv_promise_i32 icount_promise;
 static TCGLabel *icount_label;
 static TCGLabel *exitreq_label;
 
@@ -30,13 +30,11 @@  static inline void gen_tb_start(TranslationBlock *tb)
     tcg_gen_ld_i32(count, cpu_env,
                    -ENV_OFFSET + offsetof(CPUState, icount_decr.u32));
 
-    imm = tcg_temp_new_i32();
-    tcg_gen_movi_i32(imm, 0xdeadbeef);
+    imm = tcg_promise_i32(&icount_promise);
 
     /* This is a horrid hack to allow fixing up the value later.  */
     i = tcg_ctx.gen_last_op_idx;
     i = tcg_ctx.gen_op_buf[i].args;
-    icount_arg = &tcg_ctx.gen_opparam_buf[i + 1];
 
     tcg_gen_sub_i32(count, count, imm);
     tcg_temp_free_i32(imm);
@@ -53,7 +51,7 @@  static void gen_tb_end(TranslationBlock *tb, int num_insns)
     tcg_gen_exit_tb((uintptr_t)tb + TB_EXIT_REQUESTED);
 
     if (tb->cflags & CF_USE_ICOUNT) {
-        *icount_arg = num_insns;
+        tcg_set_promise_i32(icount_promise, num_insns);
         gen_set_label(icount_label);
         tcg_gen_exit_tb((uintptr_t)tb + TB_EXIT_ICOUNT_EXPIRED);
     }