public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alex Coplan <acoplan@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-4737] rtl-ssa: Add drop_memory_access helper
Date: Thu, 19 Oct 2023 10:14:49 +0000 (GMT)	[thread overview]
Message-ID: <20231019101449.77396385843E@sourceware.org> (raw)

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>

                 reply	other threads:[~2023-10-19 10:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231019101449.77396385843E@sourceware.org \
    --to=acoplan@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).