]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rtl-ssa: Add entry point to allow re-parenting uses
authorAlex Coplan <alex.coplan@arm.com>
Thu, 17 Aug 2023 15:16:46 +0000 (16:16 +0100)
committerAlex Coplan <alex.coplan@arm.com>
Thu, 19 Oct 2023 10:12:22 +0000 (11:12 +0100)
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.

gcc/rtl-ssa/accesses.cc
gcc/rtl-ssa/functions.h

index f12b5f4dd775878daa1b06f4ec9e2b294ba3a2b9..774ab9d99eea0e2f8e2b1a6a1b3068b091a752da 100644 (file)
@@ -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
index 8b53b2640642b8897ce3754be6c1512af8eb1d5f..d7da9774213c738e2efc0767706c9084c8cc542d 100644 (file)
@@ -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: