[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 01/18] tcg-arm: Fix local stack frame
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v4 01/18] tcg-arm: Fix local stack frame |
Date: |
Sat, 30 Mar 2013 21:14:16 +0000 |
On 30 March 2013 20:43, Richard Henderson <address@hidden> wrote:
> static void tcg_target_qemu_prologue(TCGContext *s)
> {
> - /* Calling convention requires us to save r4-r11 and lr;
> - * save also r12 to maintain stack 8-alignment.
> - */
> + int frame_size;
>
> + /* Calling convention requires us to save r4-r11 and lr; save also r12
> + to maintain stack 8-alignment. */
> /* stmdb sp!, { r4 - r12, lr } */
> tcg_out32(s, (COND_AL << 28) | 0x092d5ff0);
>
> + /* Allocate the local stack frame. */
> + frame_size = TCG_STATIC_CALL_ARGS_SIZE;
> + frame_size += CPU_TEMP_BUF_NLONGS * sizeof(long);
> + tcg_out_dat_rI(s, COND_AL, ARITH_SUB, TCG_REG_CALL_STACK,
> + TCG_REG_CALL_STACK, frame_size, 1);
If you're doing a sub sp, sp, #n anyway, you might as well
add 4 to that and drop the save/load of r12 from the stmdb/ldmia.
It was only in there to save having an extra sub/add insn.
> + tcg_set_frame(s, TCG_REG_CALL_STACK, TCG_STATIC_CALL_ARGS_SIZE,
> + CPU_TEMP_BUF_NLONGS * sizeof(long));
> +
> tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]);
>
> tcg_out_bx(s, COND_AL, tcg_target_call_iarg_regs[1]);
> tb_ret_addr = s->code_ptr;
>
> + /* Epilogue. We branch here via tb_ret_addr. */
> + tcg_out_dat_rI(s, COND_AL, ARITH_ADD, TCG_REG_CALL_STACK,
> + TCG_REG_CALL_STACK, frame_size, 1);
> +
> /* ldmia sp!, { r4 - r12, pc } */
> tcg_out32(s, (COND_AL << 28) | 0x08bd9ff0);
> }
> --
> 1.8.1.4
>
>
-- PMM
- [Qemu-devel] [PATCH v4 00/18] tcg-arm improvements, Richard Henderson, 2013/03/30
- [Qemu-devel] [PATCH v4 02/18] tcg-arm: Use bic to implement and with constant, Richard Henderson, 2013/03/30
- [Qemu-devel] [PATCH v4 03/18] tcg-arm: Handle negated constant arguments to and/sub, Richard Henderson, 2013/03/30
- [Qemu-devel] [PATCH v4 04/18] tcg-arm: Allow constant first argument to sub, Richard Henderson, 2013/03/30
- [Qemu-devel] [PATCH v4 05/18] tcg-arm: Use tcg_out_dat_rIN for compares, Richard Henderson, 2013/03/30
- [Qemu-devel] [PATCH v4 06/18] tcg-arm: Handle constant arguments to add2/sub2, Richard Henderson, 2013/03/30
- [Qemu-devel] [PATCH v4 07/18] tcg-arm: Improve constant generation, Richard Henderson, 2013/03/30
- [Qemu-devel] [PATCH v4 08/18] tcg-arm: Implement deposit for armv7, Richard Henderson, 2013/03/30
- [Qemu-devel] [PATCH v4 09/18] tcg-arm: Implement division instructions, Richard Henderson, 2013/03/30