* [PATCH][AArch64] Use gen_frame_mem for callee-saves
@ 2017-08-04 12:25 Wilco Dijkstra
2017-08-07 13:39 ` Richard Earnshaw (lists)
0 siblings, 1 reply; 2+ messages in thread
From: Wilco Dijkstra @ 2017-08-04 12:25 UTC (permalink / raw)
To: GCC Patches, James Greenhalgh; +Cc: nd
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 correct. Minor cleanup - no change in code.
OK for commit?
ChangeLog:
2017-08-04 Wilco Dijkstra <wdijkstr@arm.com>
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.
--
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index f7cdcaf5a759ee1eb90a4a370d9a3625f7bdc4dd..e5c6c1ca65269a209e893729ce3230f70bd4e808 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -3072,7 +3072,7 @@ aarch64_pushwb_single_reg (machine_mode mode, unsigned regno,
reg = gen_rtx_REG (mode, regno);
mem = gen_rtx_PRE_MODIFY (Pmode, base_rtx,
plus_constant (Pmode, base_rtx, -adjustment));
- mem = gen_rtx_MEM (mode, mem);
+ mem = gen_frame_mem (mode, mem);
insn = emit_move_insn (mem, reg);
RTX_FRAME_RELATED_P (insn) = 1;
@@ -3160,7 +3160,7 @@ aarch64_pop_regs (unsigned regno1, unsigned regno2, HOST_WIDE_INT adjustment,
{
rtx mem = plus_constant (Pmode, stack_pointer_rtx, adjustment);
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
{
@@ -3236,8 +3236,6 @@ aarch64_save_callee_saves (machine_mode mode, HOST_WIDE_INT start_offset,
unsigned start, unsigned limit, bool skip_wb)
{
rtx_insn *insn;
- rtx (*gen_mem_ref) (machine_mode, rtx) = (frame_pointer_needed
- ? gen_frame_mem : gen_rtx_MEM);
unsigned regno;
unsigned regno2;
@@ -3258,8 +3256,8 @@ aarch64_save_callee_saves (machine_mode mode, HOST_WIDE_INT start_offset,
reg = gen_rtx_REG (mode, regno);
offset = start_offset + cfun->machine->frame.reg_offset[regno];
- mem = gen_mem_ref (mode, plus_constant (Pmode, stack_pointer_rtx,
- offset));
+ mem = gen_frame_mem (mode, plus_constant (Pmode, stack_pointer_rtx,
+ offset));
regno2 = aarch64_next_callee_save (regno + 1, limit);
@@ -3273,8 +3271,8 @@ aarch64_save_callee_saves (machine_mode mode, HOST_WIDE_INT start_offset,
rtx mem2;
offset = start_offset + cfun->machine->frame.reg_offset[regno2];
- mem2 = gen_mem_ref (mode, plus_constant (Pmode, stack_pointer_rtx,
- offset));
+ mem2 = gen_frame_mem (mode, plus_constant (Pmode, stack_pointer_rtx,
+ offset));
insn = emit_insn (aarch64_gen_store_pair (mode, mem, reg, mem2,
reg2));
@@ -3303,8 +3301,6 @@ aarch64_restore_callee_saves (machine_mode mode,
unsigned limit, bool skip_wb, rtx *cfi_ops)
{
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 regno2;
HOST_WIDE_INT offset;
@@ -3325,7 +3321,7 @@ aarch64_restore_callee_saves (machine_mode mode,
reg = gen_rtx_REG (mode, 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);
@@ -3338,7 +3334,7 @@ aarch64_restore_callee_saves (machine_mode mode,
rtx mem2;
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));
*cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg2, *cfi_ops);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][AArch64] Use gen_frame_mem for callee-saves
2017-08-04 12:25 [PATCH][AArch64] Use gen_frame_mem for callee-saves Wilco Dijkstra
@ 2017-08-07 13:39 ` Richard Earnshaw (lists)
0 siblings, 0 replies; 2+ messages in thread
From: Richard Earnshaw (lists) @ 2017-08-07 13:39 UTC (permalink / raw)
To: Wilco Dijkstra, GCC Patches, James Greenhalgh; +Cc: nd
On 04/08/17 13:24, Wilco Dijkstra wrote:
> 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 correct. Minor cleanup - no change in code.
>
> OK for commit?
OK.
R.
>
> ChangeLog:
> 2017-08-04 Wilco Dijkstra <wdijkstr@arm.com>
>
> 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.
> --
>
> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
> index f7cdcaf5a759ee1eb90a4a370d9a3625f7bdc4dd..e5c6c1ca65269a209e893729ce3230f70bd4e808 100644
> --- a/gcc/config/aarch64/aarch64.c
> +++ b/gcc/config/aarch64/aarch64.c
> @@ -3072,7 +3072,7 @@ aarch64_pushwb_single_reg (machine_mode mode, unsigned regno,
> reg = gen_rtx_REG (mode, regno);
> mem = gen_rtx_PRE_MODIFY (Pmode, base_rtx,
> plus_constant (Pmode, base_rtx, -adjustment));
> - mem = gen_rtx_MEM (mode, mem);
> + mem = gen_frame_mem (mode, mem);
>
> insn = emit_move_insn (mem, reg);
> RTX_FRAME_RELATED_P (insn) = 1;
> @@ -3160,7 +3160,7 @@ aarch64_pop_regs (unsigned regno1, unsigned regno2, HOST_WIDE_INT adjustment,
> {
> rtx mem = plus_constant (Pmode, stack_pointer_rtx, adjustment);
> 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
> {
> @@ -3236,8 +3236,6 @@ aarch64_save_callee_saves (machine_mode mode, HOST_WIDE_INT start_offset,
> unsigned start, unsigned limit, bool skip_wb)
> {
> rtx_insn *insn;
> - rtx (*gen_mem_ref) (machine_mode, rtx) = (frame_pointer_needed
> - ? gen_frame_mem : gen_rtx_MEM);
> unsigned regno;
> unsigned regno2;
>
> @@ -3258,8 +3256,8 @@ aarch64_save_callee_saves (machine_mode mode, HOST_WIDE_INT start_offset,
>
> reg = gen_rtx_REG (mode, regno);
> offset = start_offset + cfun->machine->frame.reg_offset[regno];
> - mem = gen_mem_ref (mode, plus_constant (Pmode, stack_pointer_rtx,
> - offset));
> + mem = gen_frame_mem (mode, plus_constant (Pmode, stack_pointer_rtx,
> + offset));
>
> regno2 = aarch64_next_callee_save (regno + 1, limit);
>
> @@ -3273,8 +3271,8 @@ aarch64_save_callee_saves (machine_mode mode, HOST_WIDE_INT start_offset,
> rtx mem2;
>
> offset = start_offset + cfun->machine->frame.reg_offset[regno2];
> - mem2 = gen_mem_ref (mode, plus_constant (Pmode, stack_pointer_rtx,
> - offset));
> + mem2 = gen_frame_mem (mode, plus_constant (Pmode, stack_pointer_rtx,
> + offset));
> insn = emit_insn (aarch64_gen_store_pair (mode, mem, reg, mem2,
> reg2));
>
> @@ -3303,8 +3301,6 @@ aarch64_restore_callee_saves (machine_mode mode,
> unsigned limit, bool skip_wb, rtx *cfi_ops)
> {
> 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 regno2;
> HOST_WIDE_INT offset;
> @@ -3325,7 +3321,7 @@ aarch64_restore_callee_saves (machine_mode mode,
>
> reg = gen_rtx_REG (mode, 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);
>
> @@ -3338,7 +3334,7 @@ aarch64_restore_callee_saves (machine_mode mode,
> rtx mem2;
>
> 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));
>
> *cfi_ops = alloc_reg_note (REG_CFA_RESTORE, reg2, *cfi_ops);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-07 13:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-04 12:25 [PATCH][AArch64] Use gen_frame_mem for callee-saves Wilco Dijkstra
2017-08-07 13:39 ` Richard Earnshaw (lists)
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 read-only IMAP folder(s) and NNTP newsgroup(s).