diff options
author | Alex Coplan <alex.coplan@arm.com> | 2023-08-22 13:37:53 +0100 |
---|---|---|
committer | Alex Coplan <alex.coplan@arm.com> | 2023-10-19 11:12:22 +0100 |
commit | c95aab23c152115cd567541dd134f3fab6f45e78 (patch) | |
tree | 1a92ebe24303f03a2d006c7b88973ec052583ccb | |
parent | c338083377021d27ce625fcd312c316e20e1792c (diff) | |
download | gcc-c95aab23c152115cd567541dd134f3fab6f45e78.zip gcc-c95aab23c152115cd567541dd134f3fab6f45e78.tar.gz gcc-c95aab23c152115cd567541dd134f3fab6f45e78.tar.bz2 |
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.
-rw-r--r-- | gcc/rtl-ssa/access-utils.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/rtl-ssa/access-utils.h b/gcc/rtl-ssa/access-utils.h index fbaaaa2..84d386b 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> |