* [PATCH 02/11] rtl-ssa: Add drop_memory_access helper
@ 2023-10-17 20:46 Alex Coplan
2023-10-18 17:55 ` Richard Sandiford
0 siblings, 1 reply; 2+ messages in thread
From: Alex Coplan @ 2023-10-17 20:46 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Sandiford
[-- Attachment #1: Type: text/plain, Size: 334 bytes --]
Add a helper routine to access-utils.h which removes the memory access
from an access_array, if it has one.
Bootstrapped/regtested as a series on aarch64-linux-gnu, OK for trunk?
gcc/ChangeLog:
* rtl-ssa/access-utils.h (drop_memory_access): New.
---
gcc/rtl-ssa/access-utils.h | 11 +++++++++++
1 file changed, 11 insertions(+)
[-- Attachment #2: 0002-rtl-ssa-Add-drop_memory_access-helper.patch --]
[-- Type: text/x-patch, Size: 610 bytes --]
diff --git a/gcc/rtl-ssa/access-utils.h b/gcc/rtl-ssa/access-utils.h
index fbaaaa2c2d3..0c108b18bb8 100644
--- a/gcc/rtl-ssa/access-utils.h
+++ b/gcc/rtl-ssa/access-utils.h
@@ -51,6 +51,17 @@ memory_access (T accesses) -> decltype (accesses[0])
return nullptr;
}
+template<typename T>
+inline T
+drop_memory_access (T accesses)
+{
+ if (!memory_access (accesses))
+ return accesses;
+
+ access_array arr (accesses);
+ return T (arr.begin (), accesses.size () - 1);
+}
+
// If sorted array ACCESSES includes a reference to REGNO, return the
// access, otherwise return null.
template<typename T>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 02/11] rtl-ssa: Add drop_memory_access helper
2023-10-17 20:46 [PATCH 02/11] rtl-ssa: Add drop_memory_access helper Alex Coplan
@ 2023-10-18 17:55 ` Richard Sandiford
0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2023-10-18 17:55 UTC (permalink / raw)
To: Alex Coplan; +Cc: gcc-patches
Alex Coplan <alex.coplan@arm.com> writes:
> Add a helper routine to access-utils.h which removes the memory access
> from an access_array, if it has one.
>
> Bootstrapped/regtested as a series on aarch64-linux-gnu, OK for trunk?
>
> gcc/ChangeLog:
>
> * rtl-ssa/access-utils.h (drop_memory_access): New.
> ---
> gcc/rtl-ssa/access-utils.h | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/gcc/rtl-ssa/access-utils.h b/gcc/rtl-ssa/access-utils.h
> index fbaaaa2c2d3..0c108b18bb8 100644
> --- a/gcc/rtl-ssa/access-utils.h
> +++ b/gcc/rtl-ssa/access-utils.h
> @@ -51,6 +51,17 @@ memory_access (T accesses) -> decltype (accesses[0])
> return nullptr;
> }
>
> +template<typename T>
> +inline T
> +drop_memory_access (T accesses)
> +{
> + if (!memory_access (accesses))
> + return accesses;
> +
> + access_array arr (accesses);
> + return T (arr.begin (), accesses.size () - 1);
> +}
There ought to be a comment above the function. OK with that change, thanks.
Richard
> +
> // If sorted array ACCESSES includes a reference to REGNO, return the
> // access, otherwise return null.
> template<typename T>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-18 17:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-17 20:46 [PATCH 02/11] rtl-ssa: Add drop_memory_access helper Alex Coplan
2023-10-18 17:55 ` Richard Sandiford
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).