public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-4737] rtl-ssa: Add drop_memory_access helper
@ 2023-10-19 10:14 Alex Coplan
  0 siblings, 0 replies; only message in thread
From: Alex Coplan @ 2023-10-19 10:14 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c95aab23c152115cd567541dd134f3fab6f45e78

commit r14-4737-gc95aab23c152115cd567541dd134f3fab6f45e78
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Tue Aug 22 13:37:53 2023 +0100

    rtl-ssa: Add drop_memory_access helper
    
    Add a helper routine to access-utils.h which removes the memory access
    from an access_array, if it has one.
    
    gcc/ChangeLog:
    
            * rtl-ssa/access-utils.h (drop_memory_access): New.

Diff:
---
 gcc/rtl-ssa/access-utils.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gcc/rtl-ssa/access-utils.h b/gcc/rtl-ssa/access-utils.h
index fbaaaa2c2d3a..84d386b7d8bd 100644
--- a/gcc/rtl-ssa/access-utils.h
+++ b/gcc/rtl-ssa/access-utils.h
@@ -51,6 +51,19 @@ memory_access (T accesses) -> decltype (accesses[0])
   return nullptr;
 }
 
+// If ACCESSES has a memory access, drop it.  Otherwise, return ACCESSES
+// unchanged.
+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] only message in thread

only message in thread, other threads:[~2023-10-19 10:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-19 10:14 [gcc r14-4737] rtl-ssa: Add drop_memory_access helper Alex Coplan

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).