Commit 30079dde by Wilco Dijkstra Committed by Wilco Dijkstra

[AArch64] Use gen_frame_mem for callee-saves

The frame code uses a mixture of gen_rtx_MEM and gen_frame_mem for
callee-saves.  Callee-saves never alias with local variables, so using
gen_frame_mem is best.

    gcc/
	* config/aarch64/aarch64.c (aarch64_pushwb_single_reg):
	Use gen_frame_mem.
	(aarch64_pop_regs): Likewise.
	(aarch64_gen_load_pair): Likewise.
	(aarch64_save_callee_saves): Likewise.
	(aarch64_restore_callee_saves): Likewise.

From-SVN: r250919
parent 6f1a16cb
2017-08-07 Wilco Dijkstra <wdijkstr@arm.com>
* config/aarch64/aarch64.c (aarch64_pushwb_single_reg):
Use gen_frame_mem.
(aarch64_pop_regs): Likewise.
(aarch64_gen_load_pair): Likewise.
(aarch64_save_callee_saves): Likewise.
(aarch64_restore_callee_saves): Likewise.
2017-08-07 H.J. Lu <hongjiu.lu@intel.com> 2017-08-07 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/i386.c: Revert the last change. * config/i386/i386.c: Revert the last change.
......
...@@ -3069,7 +3069,7 @@ aarch64_pushwb_single_reg (machine_mode mode, unsigned regno, ...@@ -3069,7 +3069,7 @@ aarch64_pushwb_single_reg (machine_mode mode, unsigned regno,
reg = gen_rtx_REG (mode, regno); reg = gen_rtx_REG (mode, regno);
mem = gen_rtx_PRE_MODIFY (Pmode, base_rtx, mem = gen_rtx_PRE_MODIFY (Pmode, base_rtx,
plus_constant (Pmode, base_rtx, -adjustment)); plus_constant (Pmode, base_rtx, -adjustment));
mem = gen_rtx_MEM (mode, mem); mem = gen_frame_mem (mode, mem);
insn = emit_move_insn (mem, reg); insn = emit_move_insn (mem, reg);
RTX_FRAME_RELATED_P (insn) = 1; RTX_FRAME_RELATED_P (insn) = 1;
...@@ -3157,7 +3157,7 @@ aarch64_pop_regs (unsigned regno1, unsigned regno2, HOST_WIDE_INT adjustment, ...@@ -3157,7 +3157,7 @@ aarch64_pop_regs (unsigned regno1, unsigned regno2, HOST_WIDE_INT adjustment,
{ {
rtx mem = plus_constant (Pmode, stack_pointer_rtx, adjustment); rtx mem = plus_constant (Pmode, stack_pointer_rtx, adjustment);
mem = gen_rtx_POST_MODIFY (Pmode, stack_pointer_rtx, mem); mem = gen_rtx_POST_MODIFY (Pmode, stack_pointer_rtx, mem);
emit_move_insn (reg1, gen_rtx_MEM (mode, mem)); emit_move_insn (reg1, gen_frame_mem (mode, mem));
} }
else else
{ {
...@@ -3233,8 +3233,6 @@ aarch64_save_callee_saves (machine_mode mode, HOST_WIDE_INT start_offset, ...@@ -3233,8 +3233,6 @@ aarch64_save_callee_saves (machine_mode mode, HOST_WIDE_INT start_offset,
unsigned start, unsigned limit, bool skip_wb) unsigned start, unsigned limit, bool skip_wb)
{ {
rtx_insn *insn; rtx_insn *insn;
rtx (*gen_mem_ref) (machine_mode, rtx) = (frame_pointer_needed
? gen_frame_mem : gen_rtx_MEM);
unsigned regno; unsigned regno;
unsigned regno2; unsigned regno2;
...@@ -3255,8 +3253,8 @@ aarch64_save_callee_saves (machine_mode mode, HOST_WIDE_INT start_offset, ...@@ -3255,8 +3253,8 @@ aarch64_save_callee_saves (machine_mode mode, HOST_WIDE_INT start_offset,
reg = gen_rtx_REG (mode, regno); reg = gen_rtx_REG (mode, regno);
offset = start_offset + cfun->machine->frame.reg_offset[regno]; offset = start_offset + cfun->machine->frame.reg_offset[regno];
mem = gen_mem_ref (mode, plus_constant (Pmode, stack_pointer_rtx, mem = gen_frame_mem (mode, plus_constant (Pmode, stack_pointer_rtx,
offset)); offset));
regno2 = aarch64_next_callee_save (regno + 1, limit); regno2 = aarch64_next_callee_save (regno + 1, limit);
...@@ -3270,8 +3268,8 @@ aarch64_save_callee_saves (machine_mode mode, HOST_WIDE_INT start_offset, ...@@ -3270,8 +3268,8 @@ aarch64_save_callee_saves (machine_mode mode, HOST_WIDE_INT start_offset,
rtx mem2; rtx mem2;
offset = start_offset + cfun->machine->frame.reg_offset[regno2]; offset = start_offset + cfun->machine->frame.reg_offset[regno2];
mem2 = gen_mem_ref (mode, plus_constant (Pmode, stack_pointer_rtx, mem2 = gen_frame_mem (mode, plus_constant (Pmode, stack_pointer_rtx,
offset)); offset));
insn = emit_insn (aarch64_gen_store_pair (mode, mem, reg, mem2, insn = emit_insn (aarch64_gen_store_pair (mode, mem, reg, mem2,
reg2)); reg2));
...@@ -3300,8 +3298,6 @@ aarch64_restore_callee_saves (machine_mode mode, ...@@ -3300,8 +3298,6 @@ aarch64_restore_callee_saves (machine_mode mode,
unsigned limit, bool skip_wb, rtx *cfi_ops) unsigned limit, bool skip_wb, rtx *cfi_ops)
{ {
rtx base_rtx = stack_pointer_rtx; rtx base_rtx = stack_pointer_rtx;
rtx (*gen_mem_ref) (machine_mode, rtx) = (frame_pointer_needed
? gen_frame_mem : gen_rtx_MEM);
unsigned regno; unsigned regno;
unsigned regno2; unsigned regno2;
HOST_WIDE_INT offset; HOST_WIDE_INT offset;
...@@ -3322,7 +3318,7 @@ aarch64_restore_callee_saves (machine_mode mode, ...@@ -3322,7 +3318,7 @@ aarch64_restore_callee_saves (machine_mode mode,
reg = gen_rtx_REG (mode, regno); reg = gen_rtx_REG (mode, regno);
offset = start_offset + cfun->machine->frame.reg_offset[regno]; offset = start_offset + cfun->machine->frame.reg_offset[regno];
mem = gen_mem_ref (mode, plus_constant (Pmode, base_rtx, offset)); mem = gen_frame_mem (mode, plus_constant (Pmode, base_rtx, offset));
regno2 = aarch64_next_callee_save (regno + 1, limit); regno2 = aarch64_next_callee_save (regno + 1, limit);
...@@ -3335,7 +3331,7 @@ aarch64_restore_callee_saves (machine_mode mode, ...@@ -3335,7 +3331,7 @@ aarch64_restore_callee_saves (machine_mode mode,
rtx mem2; rtx mem2;
offset = start_offset + cfun->machine->frame.reg_offset[regno2]; offset = start_offset + cfun->machine->frame.reg_offset[regno2];
mem2 = gen_mem_ref (mode, plus_constant (Pmode, base_rtx, offset)); mem2 = gen_frame_mem (mode, plus_constant (Pmode, base_rtx, offset));
emit_insn (aarch64_gen_load_pair (mode, reg, mem, reg2, mem2)); emit_insn (aarch64_gen_load_pair (mode, reg, mem, reg2, mem2));
*cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg2, *cfi_ops); *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg2, *cfi_ops);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment