target-arm: Remove gen_{ld,st}* from Thumb insns

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Peter Maydell 2013-05-23 13:00:01 +01:00 committed by Blue Swirl
parent 5a839c0d54
commit c40c85560b
1 changed files with 46 additions and 25 deletions

View File

@ -9217,7 +9217,8 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
val &= ~(uint32_t)2; val &= ~(uint32_t)2;
addr = tcg_temp_new_i32(); addr = tcg_temp_new_i32();
tcg_gen_movi_i32(addr, val); tcg_gen_movi_i32(addr, val);
tmp = gen_ld32(addr, IS_USER(s)); tmp = tcg_temp_new_i32();
tcg_gen_qemu_ld32u(tmp, addr, IS_USER(s));
tcg_temp_free_i32(addr); tcg_temp_free_i32(addr);
store_reg(s, rd, tmp); store_reg(s, rd, tmp);
break; break;
@ -9412,37 +9413,43 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
tcg_gen_add_i32(addr, addr, tmp); tcg_gen_add_i32(addr, addr, tmp);
tcg_temp_free_i32(tmp); tcg_temp_free_i32(tmp);
if (op < 3) /* store */ if (op < 3) { /* store */
tmp = load_reg(s, rd); tmp = load_reg(s, rd);
} else {
tmp = tcg_temp_new_i32();
}
switch (op) { switch (op) {
case 0: /* str */ case 0: /* str */
gen_st32(tmp, addr, IS_USER(s)); tcg_gen_qemu_st32(tmp, addr, IS_USER(s));
break; break;
case 1: /* strh */ case 1: /* strh */
gen_st16(tmp, addr, IS_USER(s)); tcg_gen_qemu_st16(tmp, addr, IS_USER(s));
break; break;
case 2: /* strb */ case 2: /* strb */
gen_st8(tmp, addr, IS_USER(s)); tcg_gen_qemu_st8(tmp, addr, IS_USER(s));
break; break;
case 3: /* ldrsb */ case 3: /* ldrsb */
tmp = gen_ld8s(addr, IS_USER(s)); tcg_gen_qemu_ld8s(tmp, addr, IS_USER(s));
break; break;
case 4: /* ldr */ case 4: /* ldr */
tmp = gen_ld32(addr, IS_USER(s)); tcg_gen_qemu_ld32u(tmp, addr, IS_USER(s));
break; break;
case 5: /* ldrh */ case 5: /* ldrh */
tmp = gen_ld16u(addr, IS_USER(s)); tcg_gen_qemu_ld16u(tmp, addr, IS_USER(s));
break; break;
case 6: /* ldrb */ case 6: /* ldrb */
tmp = gen_ld8u(addr, IS_USER(s)); tcg_gen_qemu_ld8u(tmp, addr, IS_USER(s));
break; break;
case 7: /* ldrsh */ case 7: /* ldrsh */
tmp = gen_ld16s(addr, IS_USER(s)); tcg_gen_qemu_ld16s(tmp, addr, IS_USER(s));
break; break;
} }
if (op >= 3) /* load */ if (op >= 3) { /* load */
store_reg(s, rd, tmp); store_reg(s, rd, tmp);
} else {
tcg_temp_free_i32(tmp);
}
tcg_temp_free_i32(addr); tcg_temp_free_i32(addr);
break; break;
@ -9456,12 +9463,14 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
if (insn & (1 << 11)) { if (insn & (1 << 11)) {
/* load */ /* load */
tmp = gen_ld32(addr, IS_USER(s)); tmp = tcg_temp_new_i32();
tcg_gen_qemu_ld32u(tmp, addr, IS_USER(s));
store_reg(s, rd, tmp); store_reg(s, rd, tmp);
} else { } else {
/* store */ /* store */
tmp = load_reg(s, rd); tmp = load_reg(s, rd);
gen_st32(tmp, addr, IS_USER(s)); tcg_gen_qemu_st32(tmp, addr, IS_USER(s));
tcg_temp_free_i32(tmp);
} }
tcg_temp_free_i32(addr); tcg_temp_free_i32(addr);
break; break;
@ -9476,12 +9485,14 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
if (insn & (1 << 11)) { if (insn & (1 << 11)) {
/* load */ /* load */
tmp = gen_ld8u(addr, IS_USER(s)); tmp = tcg_temp_new_i32();
tcg_gen_qemu_ld8u(tmp, addr, IS_USER(s));
store_reg(s, rd, tmp); store_reg(s, rd, tmp);
} else { } else {
/* store */ /* store */
tmp = load_reg(s, rd); tmp = load_reg(s, rd);
gen_st8(tmp, addr, IS_USER(s)); tcg_gen_qemu_st8(tmp, addr, IS_USER(s));
tcg_temp_free_i32(tmp);
} }
tcg_temp_free_i32(addr); tcg_temp_free_i32(addr);
break; break;
@ -9496,12 +9507,14 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
if (insn & (1 << 11)) { if (insn & (1 << 11)) {
/* load */ /* load */
tmp = gen_ld16u(addr, IS_USER(s)); tmp = tcg_temp_new_i32();
tcg_gen_qemu_ld16u(tmp, addr, IS_USER(s));
store_reg(s, rd, tmp); store_reg(s, rd, tmp);
} else { } else {
/* store */ /* store */
tmp = load_reg(s, rd); tmp = load_reg(s, rd);
gen_st16(tmp, addr, IS_USER(s)); tcg_gen_qemu_st16(tmp, addr, IS_USER(s));
tcg_temp_free_i32(tmp);
} }
tcg_temp_free_i32(addr); tcg_temp_free_i32(addr);
break; break;
@ -9515,12 +9528,14 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
if (insn & (1 << 11)) { if (insn & (1 << 11)) {
/* load */ /* load */
tmp = gen_ld32(addr, IS_USER(s)); tmp = tcg_temp_new_i32();
tcg_gen_qemu_ld32u(tmp, addr, IS_USER(s));
store_reg(s, rd, tmp); store_reg(s, rd, tmp);
} else { } else {
/* store */ /* store */
tmp = load_reg(s, rd); tmp = load_reg(s, rd);
gen_st32(tmp, addr, IS_USER(s)); tcg_gen_qemu_st32(tmp, addr, IS_USER(s));
tcg_temp_free_i32(tmp);
} }
tcg_temp_free_i32(addr); tcg_temp_free_i32(addr);
break; break;
@ -9586,12 +9601,14 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
if (insn & (1 << i)) { if (insn & (1 << i)) {
if (insn & (1 << 11)) { if (insn & (1 << 11)) {
/* pop */ /* pop */
tmp = gen_ld32(addr, IS_USER(s)); tmp = tcg_temp_new_i32();
tcg_gen_qemu_ld32u(tmp, addr, IS_USER(s));
store_reg(s, i, tmp); store_reg(s, i, tmp);
} else { } else {
/* push */ /* push */
tmp = load_reg(s, i); tmp = load_reg(s, i);
gen_st32(tmp, addr, IS_USER(s)); tcg_gen_qemu_st32(tmp, addr, IS_USER(s));
tcg_temp_free_i32(tmp);
} }
/* advance to the next address. */ /* advance to the next address. */
tcg_gen_addi_i32(addr, addr, 4); tcg_gen_addi_i32(addr, addr, 4);
@ -9601,13 +9618,15 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
if (insn & (1 << 8)) { if (insn & (1 << 8)) {
if (insn & (1 << 11)) { if (insn & (1 << 11)) {
/* pop pc */ /* pop pc */
tmp = gen_ld32(addr, IS_USER(s)); tmp = tcg_temp_new_i32();
tcg_gen_qemu_ld32u(tmp, addr, IS_USER(s));
/* don't set the pc until the rest of the instruction /* don't set the pc until the rest of the instruction
has completed */ has completed */
} else { } else {
/* push lr */ /* push lr */
tmp = load_reg(s, 14); tmp = load_reg(s, 14);
gen_st32(tmp, addr, IS_USER(s)); tcg_gen_qemu_st32(tmp, addr, IS_USER(s));
tcg_temp_free_i32(tmp);
} }
tcg_gen_addi_i32(addr, addr, 4); tcg_gen_addi_i32(addr, addr, 4);
} }
@ -9730,7 +9749,8 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
if (insn & (1 << i)) { if (insn & (1 << i)) {
if (insn & (1 << 11)) { if (insn & (1 << 11)) {
/* load */ /* load */
tmp = gen_ld32(addr, IS_USER(s)); tmp = tcg_temp_new_i32();
tcg_gen_qemu_ld32u(tmp, addr, IS_USER(s));
if (i == rn) { if (i == rn) {
loaded_var = tmp; loaded_var = tmp;
} else { } else {
@ -9739,7 +9759,8 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s)
} else { } else {
/* store */ /* store */
tmp = load_reg(s, i); tmp = load_reg(s, i);
gen_st32(tmp, addr, IS_USER(s)); tcg_gen_qemu_st32(tmp, addr, IS_USER(s));
tcg_temp_free_i32(tmp);
} }
/* advance to the next address */ /* advance to the next address */
tcg_gen_addi_i32(addr, addr, 4); tcg_gen_addi_i32(addr, addr, 4);