From: Nathan Froyd <froydnj@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/4] create TCG slots for registers based on CPU
Date: Sat, 28 Mar 2009 14:30:17 -0700 [thread overview]
Message-ID: <1238275817-9758-5-git-send-email-froydnj@codesourcery.com> (raw)
In-Reply-To: <1238275817-9758-1-git-send-email-froydnj@codesourcery.com>
There's no point in creating floating-point registers if the chip we're
emulating doesn't have them. Likewise for Altivec and SPE registers.
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
---
target-ppc/translate.c | 52 +++++++++++++++++++++++++++--------------------
1 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 412c8d0..8170718 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -104,36 +104,42 @@ void ppc_translate_init(const ppc_def_t *def)
offsetof(CPUState, gpr[i]), p);
p += (i < 10) ? 3 : 4;
#if !defined(TARGET_PPC64)
- sprintf(p, "r%dH", i);
- cpu_gprh[i] = tcg_global_mem_new_i32(TCG_AREG0,
- offsetof(CPUState, gprh[i]), p);
- p += (i < 10) ? 4 : 5;
+ if (def->insns_flags & PPC_SPE) {
+ sprintf(p, "r%dH", i);
+ cpu_gprh[i] = tcg_global_mem_new_i32(TCG_AREG0,
+ offsetof(CPUState, gprh[i]), p);
+ p += (i < 10) ? 4 : 5;
+ }
#endif
- sprintf(p, "fp%d", i);
- cpu_fpr[i] = tcg_global_mem_new_i64(TCG_AREG0,
- offsetof(CPUState, fpr[i]), p);
- p += (i < 10) ? 4 : 5;
+ if (def->insns_flags & PPC_FLOAT) {
+ sprintf(p, "fp%d", i);
+ cpu_fpr[i] = tcg_global_mem_new_i64(TCG_AREG0,
+ offsetof(CPUState, fpr[i]), p);
+ p += (i < 10) ? 4 : 5;
+ }
- sprintf(p, "avr%dH", i);
+ if (def->insns_flags & PPC_ALTIVEC) {
+ sprintf(p, "avr%dH", i);
#ifdef WORDS_BIGENDIAN
- cpu_avrh[i] = tcg_global_mem_new_i64(TCG_AREG0,
- offsetof(CPUState, avr[i].u64[0]), p);
+ cpu_avrh[i] = tcg_global_mem_new_i64(TCG_AREG0,
+ offsetof(CPUState, avr[i].u64[0]), p);
#else
- cpu_avrh[i] = tcg_global_mem_new_i64(TCG_AREG0,
- offsetof(CPUState, avr[i].u64[1]), p);
+ cpu_avrh[i] = tcg_global_mem_new_i64(TCG_AREG0,
+ offsetof(CPUState, avr[i].u64[1]), p);
#endif
- p += (i < 10) ? 6 : 7;
+ p += (i < 10) ? 6 : 7;
- sprintf(p, "avr%dL", i);
+ sprintf(p, "avr%dL", i);
#ifdef WORDS_BIGENDIAN
- cpu_avrl[i] = tcg_global_mem_new_i64(TCG_AREG0,
- offsetof(CPUState, avr[i].u64[1]), p);
+ cpu_avrl[i] = tcg_global_mem_new_i64(TCG_AREG0,
+ offsetof(CPUState, avr[i].u64[1]), p);
#else
- cpu_avrl[i] = tcg_global_mem_new_i64(TCG_AREG0,
- offsetof(CPUState, avr[i].u64[0]), p);
+ cpu_avrl[i] = tcg_global_mem_new_i64(TCG_AREG0,
+ offsetof(CPUState, avr[i].u64[0]), p);
#endif
- p += (i < 10) ? 6 : 7;
+ p += (i < 10) ? 6 : 7;
+ }
}
cpu_nip = tcg_global_mem_new(TCG_AREG0,
@@ -154,8 +160,10 @@ void ppc_translate_init(const ppc_def_t *def)
cpu_reserve = tcg_global_mem_new(TCG_AREG0,
offsetof(CPUState, reserve), "reserve");
- cpu_fpscr = tcg_global_mem_new_i32(TCG_AREG0,
- offsetof(CPUState, fpscr), "fpscr");
+ if (def->insns_flags & PPC_FLOAT) {
+ cpu_fpscr = tcg_global_mem_new_i32(TCG_AREG0,
+ offsetof(CPUState, fpscr), "fpscr");
+ }
cpu_access_type = tcg_global_mem_new_i32(TCG_AREG0,
offsetof(CPUState, access_type), "access_type");
--
1.6.0.5
next prev parent reply other threads:[~2009-03-28 21:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-28 21:30 [Qemu-devel] [PATCH 0/4] target-ppc: create TCG slots for registers based on CPU Nathan Froyd
2009-03-28 21:30 ` [Qemu-devel] [PATCH 1/4] move PPC insn flags to cpu.h Nathan Froyd
2009-03-28 22:58 ` Aurelien Jarno
2009-03-28 23:07 ` Nathan Froyd
2009-03-28 23:14 ` Aurelien Jarno
2009-03-28 21:30 ` [Qemu-devel] [PATCH 2/4] move ppc_def_t definition " Nathan Froyd
2009-03-28 21:30 ` [Qemu-devel] [PATCH 3/4] pass the cpu definition to ppc_translate_init Nathan Froyd
2009-03-28 21:30 ` Nathan Froyd [this message]
2009-03-28 22:54 ` [Qemu-devel] [PATCH 0/4] target-ppc: create TCG slots for registers based on CPU Aurelien Jarno
2009-03-29 0:18 ` Nathan Froyd
2009-03-29 13:34 ` Aurelien Jarno
2009-03-29 14:42 ` Aurelien Jarno
2009-03-29 14:57 ` Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1238275817-9758-5-git-send-email-froydnj@codesourcery.com \
--to=froydnj@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).