[gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] rtl-ssa: Add drop_memory_access helper
Jeff Law
law@gcc.gnu.org
Mon Oct 30 18:34:34 GMT 2023
https://gcc.gnu.org/g:b1a1b35b4dbc6489753dc190b8a0450c94713eb3
commit b1a1b35b4dbc6489753dc190b8a0450c94713eb3
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.
(cherry picked from commit c95aab23c152115cd567541dd134f3fab6f45e78)
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 f10776ac507e..f078625babfa 100644
--- a/gcc/rtl-ssa/access-utils.h
+++ b/gcc/rtl-ssa/access-utils.h
@@ -65,6 +65,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>
More information about the Gcc-cvs
mailing list