[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 05/11] target-mips: add gen_base_offset_addr
From: |
Nathan Froyd |
Subject: |
Re: [Qemu-devel] [PATCH 05/11] target-mips: add gen_base_offset_addr |
Date: |
Tue, 8 Dec 2009 10:01:01 -0800 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
This is a common pattern in existing code. We'll also use it to
implement the mips16 SAVE/RESTORE instructions.
Signed-off-by: Nathan Froyd <address@hidden>
---
Argh, please use this one instead; the arguments passed to
gen_op_addr_add in gen_base_offset_addr are in the "proper" order.
target-mips/translate.c | 40 ++++++++++++++++------------------------
1 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 3751516..b38b97f 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -981,6 +981,19 @@ OP_ST_ATOMIC(scd,st64,ld64,0x7);
#endif
#undef OP_ST_ATOMIC
+static void gen_base_offset_addr (DisasContext *ctx, TCGv addr,
+ int base, int16_t offset)
+{
+ if (base == 0) {
+ tcg_gen_movi_tl(addr, offset);
+ } else if (offset == 0) {
+ gen_load_gpr(addr, base);
+ } else {
+ tcg_gen_movi_tl(addr, offset);
+ gen_op_addr_add(ctx, addr, cpu_gpr[base], addr);
+ }
+}
+
/* Load and store */
static void gen_ldst (DisasContext *ctx, uint32_t opc, int rt,
int base, int16_t offset)
@@ -989,14 +1002,7 @@ static void gen_ldst (DisasContext *ctx, uint32_t opc,
int rt,
TCGv t0 = tcg_temp_new();
TCGv t1 = tcg_temp_new();
- if (base == 0) {
- tcg_gen_movi_tl(t0, offset);
- } else if (offset == 0) {
- gen_load_gpr(t0, base);
- } else {
- tcg_gen_movi_tl(t0, offset);
- gen_op_addr_add(ctx, t0, cpu_gpr[base], t0);
- }
+ gen_base_offset_addr(ctx, t0, base, offset);
/* Don't do NOP if destination is zero: we must perform the actual
memory access. */
switch (opc) {
@@ -1147,14 +1153,7 @@ static void gen_st_cond (DisasContext *ctx, uint32_t
opc, int rt,
t0 = tcg_temp_local_new();
- if (base == 0) {
- tcg_gen_movi_tl(t0, offset);
- } else if (offset == 0) {
- gen_load_gpr(t0, base);
- } else {
- tcg_gen_movi_tl(t0, offset);
- gen_op_addr_add(ctx, t0, cpu_gpr[base], t0);
- }
+ gen_base_offset_addr(ctx, t0, base, offset);
/* Don't do NOP if destination is zero: we must perform the actual
memory access. */
@@ -1186,14 +1185,7 @@ static void gen_flt_ldst (DisasContext *ctx, uint32_t
opc, int ft,
const char *opn = "flt_ldst";
TCGv t0 = tcg_temp_new();
- if (base == 0) {
- tcg_gen_movi_tl(t0, offset);
- } else if (offset == 0) {
- gen_load_gpr(t0, base);
- } else {
- tcg_gen_movi_tl(t0, offset);
- gen_op_addr_add(ctx, t0, cpu_gpr[base], t0);
- }
+ gen_base_offset_addr(ctx, t0, base, offset);
/* Don't do NOP if destination is zero: we must perform the actual
memory access. */
switch (opc) {
--
1.6.3.2
- [Qemu-devel] [PATCH v2 00/11] target-mips: add mips16 support, Nathan Froyd, 2009/12/08
- [Qemu-devel] [PATCH 11/11] target-mips: set Config1.CA for MIPS16-aware CPUs, Nathan Froyd, 2009/12/08
- [Qemu-devel] [PATCH 02/11] target-mips: change interrupt bits to be mips16-aware, Nathan Froyd, 2009/12/08
- [Qemu-devel] [PATCH 09/11] gdbstub: add MIPS16 support, Nathan Froyd, 2009/12/08
- [Qemu-devel] [PATCH 01/11] target-mips: add new HFLAGs for JALX and 16/32-bit delay slots, Nathan Froyd, 2009/12/08
- [Qemu-devel] [PATCH 08/11] target-mips: add mips16 instruction decoding, Nathan Froyd, 2009/12/08
- [Qemu-devel] [PATCH 05/11] target-mips: add gen_base_offset_addr, Nathan Froyd, 2009/12/08
- Re: [Qemu-devel] [PATCH 05/11] target-mips: add gen_base_offset_addr,
Nathan Froyd <=
- [Qemu-devel] [PATCH 10/11] target-mips: add copyright notice for mips16 work, Nathan Froyd, 2009/12/08
- [Qemu-devel] [PATCH 04/11] target-mips: make gen_compute_branch 16/32-bit-aware, Nathan Froyd, 2009/12/08
- [Qemu-devel] [PATCH 03/11] target-mips: move ROTR and ROTRV inside gen_shift_{imm, }, Nathan Froyd, 2009/12/08
- [Qemu-devel] [PATCH 07/11] target-mips: add enums for MIPS16 opcodes, Nathan Froyd, 2009/12/08
- [Qemu-devel] [PATCH 06/11] target-mips: split out delay slot handling, Nathan Froyd, 2009/12/08