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-4738] rtl-ssa: Add entry point to allow re-parenting uses
Date: Thu, 19 Oct 2023 10:14:54 +0000 (GMT)	[thread overview]
Message-ID: <20231019101454.908FC3858404@sourceware.org> (raw)

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

commit r14-4738-gba230aa1b855c32d5414183b604e45ce836fb532
Author: Alex Coplan <alex.coplan@arm.com>
Date:   Thu Aug 17 16:16:46 2023 +0100

    rtl-ssa: Add entry point to allow re-parenting uses
    
    This is needed by the upcoming aarch64 load pair pass, as it can
    re-order stores (when alias analysis determines this is safe) and thus
    change which mem def a given use consumes (in the RTL-SSA view, there is
    no alias disambiguation of memory).
    
    gcc/ChangeLog:
    
            * rtl-ssa/accesses.cc (function_info::reparent_use): New.
            * rtl-ssa/functions.h (function_info): Declare new member
            function reparent_use.

Diff:
---
 gcc/rtl-ssa/accesses.cc | 8 ++++++++
 gcc/rtl-ssa/functions.h | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/gcc/rtl-ssa/accesses.cc b/gcc/rtl-ssa/accesses.cc
index f12b5f4dd775..774ab9d99eea 100644
--- a/gcc/rtl-ssa/accesses.cc
+++ b/gcc/rtl-ssa/accesses.cc
@@ -1239,6 +1239,14 @@ function_info::add_use (use_info *use)
     insert_use_before (use, neighbor->value ());
 }
 
+void
+function_info::reparent_use (use_info *use, set_info *new_def)
+{
+  remove_use (use);
+  use->set_def (new_def);
+  add_use (use);
+}
+
 // If USE has a known definition, remove USE from that definition's list
 // of uses.  Also remove if it from the associated splay tree, if any.
 void
diff --git a/gcc/rtl-ssa/functions.h b/gcc/rtl-ssa/functions.h
index 8b53b2640642..d7da9774213c 100644
--- a/gcc/rtl-ssa/functions.h
+++ b/gcc/rtl-ssa/functions.h
@@ -159,6 +159,9 @@ public:
   // Like change_insns, but for a single change CHANGE.
   void change_insn (insn_change &change);
 
+  // Given a use USE, re-parent it to get its def from NEW_DEF.
+  void reparent_use (use_info *use, set_info *new_def);
+
   // If the changes that have been made to instructions require updates
   // to the CFG, perform those updates now.  Return true if something changed.
   // If it did:

                 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=20231019101454.908FC3858404@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).