[Qemu-devel] [PATCH v11 07/29] target/i386: [tcg] Refactor init_globals

Lluís Vilanova posted 29 patches 8 years, 7 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v11 07/29] target/i386: [tcg] Refactor init_globals
Posted by Lluís Vilanova 8 years, 7 months ago
Incrementally paves the way towards using the generic instruction translation
loop.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 target/i386/translate.c |   29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/target/i386/translate.c b/target/i386/translate.c
index 04453ce48a..d015ea73fa 100644
--- a/target/i386/translate.c
+++ b/target/i386/translate.c
@@ -8435,6 +8435,22 @@ static void i386_trblock_init_disas_context(DisasContextBase *dcbase, CPUState *
 #endif
 }
 
+static void i386_trblock_init_globals(DisasContextBase *dcbase, CPUState *cpu)
+{
+    cpu_T0 = tcg_temp_new();
+    cpu_T1 = tcg_temp_new();
+    cpu_A0 = tcg_temp_new();
+
+    cpu_tmp0 = tcg_temp_new();
+    cpu_tmp1_i64 = tcg_temp_new_i64();
+    cpu_tmp2_i32 = tcg_temp_new_i32();
+    cpu_tmp3_i32 = tcg_temp_new_i32();
+    cpu_tmp4 = tcg_temp_new();
+    cpu_ptr0 = tcg_temp_new_ptr();
+    cpu_ptr1 = tcg_temp_new_ptr();
+    cpu_cc_srcT = tcg_temp_local_new();
+}
+
 /* generate intermediate code for basic block 'tb'.  */
 void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb)
 {
@@ -8451,18 +8467,7 @@ void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb)
     dc->base.pc_next = dc->base.pc_first;
     i386_trblock_init_disas_context(&dc->base, cpu);
 
-    cpu_T0 = tcg_temp_new();
-    cpu_T1 = tcg_temp_new();
-    cpu_A0 = tcg_temp_new();
-
-    cpu_tmp0 = tcg_temp_new();
-    cpu_tmp1_i64 = tcg_temp_new_i64();
-    cpu_tmp2_i32 = tcg_temp_new_i32();
-    cpu_tmp3_i32 = tcg_temp_new_i32();
-    cpu_tmp4 = tcg_temp_new();
-    cpu_ptr0 = tcg_temp_new_ptr();
-    cpu_ptr1 = tcg_temp_new_ptr();
-    cpu_cc_srcT = tcg_temp_local_new();
+    i386_trblock_init_globals(&dc->base, cpu);
 
     num_insns = 0;
     max_insns = tb->cflags & CF_COUNT_MASK;


Re: [Qemu-devel] [PATCH v11 07/29] target/i386: [tcg] Refactor init_globals
Posted by Emilio G. Cota 8 years, 7 months ago
On Wed, Jun 28, 2017 at 15:44:54 +0300, Lluís Vilanova wrote:
> Incrementally paves the way towards using the generic instruction translation
> loop.
> 
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>  target/i386/translate.c |   29 +++++++++++++++++------------
>  1 file changed, 17 insertions(+), 12 deletions(-)
> 
> diff --git a/target/i386/translate.c b/target/i386/translate.c
> index 04453ce48a..d015ea73fa 100644
> --- a/target/i386/translate.c
> +++ b/target/i386/translate.c
> @@ -8435,6 +8435,22 @@ static void i386_trblock_init_disas_context(DisasContextBase *dcbase, CPUState *
>  #endif
>  }
>  
> +static void i386_trblock_init_globals(DisasContextBase *dcbase, CPUState *cpu)

I'd do the s/trblock/tr/ conversion to all other patches. But I won't
mention it again :)

Reviewed-by: Emilio G. Cota <cota@braap.org>

		E.

Re: [Qemu-devel] [PATCH v11 07/29] target/i386: [tcg] Refactor init_globals
Posted by Richard Henderson 8 years, 7 months ago
On 06/28/2017 05:44 AM, Lluís Vilanova wrote:
> Incrementally paves the way towards using the generic instruction translation
> loop.
> 
> Signed-off-by: Lluís Vilanova<vilanova@ac.upc.edu>
> ---
>   target/i386/translate.c |   29 +++++++++++++++++------------
>   1 file changed, 17 insertions(+), 12 deletions(-)

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


r~