From 488ec8321c26bab71a1e9791e1639b2704131297 Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Fri, 14 Mar 2008 17:35:02 +0000 Subject: [PATCH] Use memory globals for G registers --- target-sparc/translate.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/target-sparc/translate.c b/target-sparc/translate.c index c188bcc282..933a2f1343 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -47,6 +47,7 @@ /* global register indexes */ static TCGv cpu_env, cpu_T[3], cpu_regwptr, cpu_cc_src, cpu_cc_dst, cpu_psr; +static TCGv cpu_gregs[8]; #ifdef TARGET_SPARC64 static TCGv cpu_xcc; #endif @@ -222,7 +223,7 @@ static inline void gen_movl_reg_TN(int reg, TCGv tn) if (reg == 0) tcg_gen_movi_tl(tn, 0); else if (reg < 8) - tcg_gen_ld_tl(tn, cpu_env, offsetof(CPUState, gregs[reg])); + tcg_gen_mov_tl(tn, cpu_gregs[reg]); else { tcg_gen_ld_tl(tn, cpu_regwptr, (reg - 8) * sizeof(target_ulong)); } @@ -250,7 +251,7 @@ static inline void gen_movl_TN_reg(int reg, TCGv tn) if (reg == 0) return; else if (reg < 8) - tcg_gen_st_tl(tn, cpu_env, offsetof(CPUState, gregs[reg])); + tcg_gen_mov_tl(cpu_gregs[reg], tn); else { tcg_gen_st_tl(tn, cpu_regwptr, (reg - 8) * sizeof(target_ulong)); } @@ -4673,6 +4674,17 @@ CPUSPARCState *cpu_sparc_init(const char *cpu_model) CPUSPARCState *env; const sparc_def_t *def; static int inited; + unsigned int i; + static const char * const gregnames[8] = { + NULL, // g0 not used + "g1", + "g2", + "g3", + "g4", + "g5", + "g6", + "g7", + }; def = cpu_sparc_find_by_name(cpu_model); if (!def) @@ -4729,6 +4741,10 @@ CPUSPARCState *cpu_sparc_init(const char *cpu_model) cpu_psr = tcg_global_mem_new(TCG_TYPE_I32, TCG_AREG0, offsetof(CPUState, psr), "psr"); + for (i = 1; i < 8; i++) + cpu_gregs[i] = tcg_global_mem_new(TCG_TYPE_TL, TCG_AREG0, + offsetof(CPUState, gregs[i]), + gregnames[i]); } cpu_reset(env); -- 2.11.4.GIT