* [PATCH][AArch64] Simplify aarch64_can_eliminate
@ 2017-08-07 14:13 Wilco Dijkstra
2017-08-15 16:27 ` Wilco Dijkstra
0 siblings, 1 reply; 3+ messages in thread
From: Wilco Dijkstra @ 2017-08-07 14:13 UTC (permalink / raw)
To: GCC Patches, James Greenhalgh; +Cc: nd, Richard Earnshaw
Simplify aarch64_can_eliminate - if we need a frame pointer, we must
eliminate to HARD_FRAME_POINTER_REGNUM. Rather than hardcoding all
combinations from the ELIMINABLE_REGS list, just do the correct check.
ChangeLog:
2017-08-07 Wilco Dijkstra <wdijkstr@arm.com>
gcc/
* config/aarch64/aarch64.c (aarch64_can_eliminate): Simplify logic.
--
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 9463edf63ffe770062b4120fada090e20c93a269..fbb4244cb58d2a25203aa27342c2f7988c30bd98 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5858,26 +5858,12 @@ aarch64_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x,
}
static bool
-aarch64_can_eliminate (const int from, const int to)
+aarch64_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
{
- /* If we need a frame pointer, we must eliminate FRAME_POINTER_REGNUM into
- HARD_FRAME_POINTER_REGNUM and not into STACK_POINTER_REGNUM. */
-
+ /* If we need a frame pointer, ARG_POINTER_REGNUM and FRAME_POINTER_REGNUM
+ can only eliminate to HARD_FRAME_POINTER_REGNUM. */
if (frame_pointer_needed)
- {
- if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
- return true;
- if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
- return false;
- if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM
- && !cfun->calls_alloca)
- return true;
- if (from == FRAME_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
- return true;
-
- return false;
- }
-
+ return to == HARD_FRAME_POINTER_REGNUM;
return true;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][AArch64] Simplify aarch64_can_eliminate
2017-08-07 14:13 [PATCH][AArch64] Simplify aarch64_can_eliminate Wilco Dijkstra
@ 2017-08-15 16:27 ` Wilco Dijkstra
2017-11-07 17:27 ` James Greenhalgh
0 siblings, 1 reply; 3+ messages in thread
From: Wilco Dijkstra @ 2017-08-15 16:27 UTC (permalink / raw)
To: GCC Patches, James Greenhalgh; +Cc: nd, Richard Earnshaw
ping
From: Wilco Dijkstra
Sent: 07 August 2017 15:13
To: GCC Patches; James Greenhalgh
Cc: nd; Richard Earnshaw
Subject: [PATCH][AArch64] Simplify aarch64_can_eliminate
Simplify aarch64_can_eliminate - if we need a frame pointer, we must
eliminate to HARD_FRAME_POINTER_REGNUM. Rather than hardcoding all
combinations from the ELIMINABLE_REGS list, just do the correct check.
ChangeLog:
2017-08-07 Wilco Dijkstra <wdijkstr@arm.com>
gcc/
* config/aarch64/aarch64.c (aarch64_can_eliminate): Simplify logic.
--
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 9463edf63ffe770062b4120fada090e20c93a269..fbb4244cb58d2a25203aa27342c2f7988c30bd98 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5858,26 +5858,12 @@ aarch64_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x,
}
static bool
-aarch64_can_eliminate (const int from, const int to)
+aarch64_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
{
- /* If we need a frame pointer, we must eliminate FRAME_POINTER_REGNUM into
- HARD_FRAME_POINTER_REGNUM and not into STACK_POINTER_REGNUM. */
-
+ /* If we need a frame pointer, ARG_POINTER_REGNUM and FRAME_POINTER_REGNUM
+ can only eliminate to HARD_FRAME_POINTER_REGNUM. */
if (frame_pointer_needed)
- {
- if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
- return true;
- if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
- return false;
- if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM
- && !cfun->calls_alloca)
- return true;
- if (from == FRAME_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
- return true;
-
- return false;
- }
-
+ return to == HARD_FRAME_POINTER_REGNUM;
return true;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][AArch64] Simplify aarch64_can_eliminate
2017-08-15 16:27 ` Wilco Dijkstra
@ 2017-11-07 17:27 ` James Greenhalgh
0 siblings, 0 replies; 3+ messages in thread
From: James Greenhalgh @ 2017-11-07 17:27 UTC (permalink / raw)
To: Wilco Dijkstra; +Cc: GCC Patches, nd, Richard Earnshaw
On Tue, Aug 15, 2017 at 05:25:06PM +0100, Wilco Dijkstra wrote:
>
> ping
>
>
> From: Wilco Dijkstra
> Sent: 07 August 2017 15:13
> To: GCC Patches; James Greenhalgh
> Cc: nd; Richard Earnshaw
> Subject: [PATCH][AArch64] Simplify aarch64_can_eliminate
> Â
> Simplify aarch64_can_eliminate - if we need a frame pointer, we must
> eliminate to HARD_FRAME_POINTER_REGNUM. Rather than hardcoding all
> combinations from the ELIMINABLE_REGS list, just do the correct check.
>
> ChangeLog:
> 2017-08-07 Wilco Dijkstra <wdijkstr@arm.com>
>
> Â Â Â gcc/
> Â Â Â Â Â Â Â * config/aarch64/aarch64.c (aarch64_can_eliminate): Simplify logic.
> --
>
> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
> index 9463edf63ffe770062b4120fada090e20c93a269..fbb4244cb58d2a25203aa27342c2f7988c30bd98 100644
> --- a/gcc/config/aarch64/aarch64.c
> +++ b/gcc/config/aarch64/aarch64.c
> @@ -5858,26 +5858,12 @@ aarch64_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x,
> Â }
> Â
> Â static bool
> -aarch64_can_eliminate (const int from, const int to)
> +aarch64_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
> Â {
> -Â /* If we need a frame pointer, we must eliminate FRAME_POINTER_REGNUM into
> -    HARD_FRAME_POINTER_REGNUM and not into STACK_POINTER_REGNUM. */
> -
> +Â /* If we need a frame pointer, ARG_POINTER_REGNUM and FRAME_POINTER_REGNUM
> +    can only eliminate to HARD_FRAME_POINTER_REGNUM. */
Please add an assert in here,
(from == ARG_POINTER_REGNUM || from == FRAME_POINTER_REGNUM)
Otherwise, OK (please test this against a recent trunk).
Reviewed-By: James Greenhalgh <james.greenhalgh@arm.com>
Thanks,
James
> Â Â if (frame_pointer_needed)
> -Â Â Â {
> -Â Â Â Â Â if (from == ARG_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
> -Â Â Â Â Â Â return true;
> -Â Â Â Â Â if (from == ARG_POINTER_REGNUM && to == STACK_POINTER_REGNUM)
> -Â Â Â Â Â Â return false;
> -Â Â Â Â Â if (from == FRAME_POINTER_REGNUM && to == STACK_POINTER_REGNUM
> -Â Â Â Â Â Â Â Â && !cfun->calls_alloca)
> -Â Â Â Â Â Â return true;
> -Â Â Â Â Â if (from == FRAME_POINTER_REGNUM && to == HARD_FRAME_POINTER_REGNUM)
> -Â Â Â Â Â Â return true;
> -
> -Â Â Â Â Â return false;
> -Â Â Â }
> -
> +Â Â Â return to == HARD_FRAME_POINTER_REGNUM;
> Â Â return true;
> Â }
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-07 17:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-07 14:13 [PATCH][AArch64] Simplify aarch64_can_eliminate Wilco Dijkstra
2017-08-15 16:27 ` Wilco Dijkstra
2017-11-07 17:27 ` James Greenhalgh
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).