diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2023-09-29 09:24:43 +0100 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2023-09-29 09:24:43 +0100 |
commit | bcc97edf8c9e40232fa30e7f0070057b6516fd77 (patch) | |
tree | 4457e05d3703a635195bde481715f7045391da0a /gcc/builtins.h | |
parent | a561369743025fd64a3d87bc571d0503b17a82c8 (diff) | |
download | gcc-bcc97edf8c9e40232fa30e7f0070057b6516fd77.zip gcc-bcc97edf8c9e40232fa30e7f0070057b6516fd77.tar.gz gcc-bcc97edf8c9e40232fa30e7f0070057b6516fd77.tar.bz2 |
Simplify & expand c_readstr
c_readstr only operated on integer modes. It worked by reading
the source string into an array of HOST_WIDE_INTs, converting
that array into a wide_int, and from there to an rtx.
It's simpler to do this by building a target memory image and
using native_decode_rtx to convert that memory image into an rtx.
It avoids all the endianness shenanigans because both the string and
native_decode_rtx follow target memory order. It also means that the
function can handle all fixed-size modes, which simplifies callers
and allows vector modes to be used more widely.
gcc/
* builtins.h (c_readstr): Take a fixed_size_mode rather than a
scalar_int_mode.
* builtins.cc (c_readstr): Likewise. Build a local array of
bytes and use native_decode_rtx to get the rtx image.
(builtin_memcpy_read_str): Simplify accordingly.
(builtin_strncpy_read_str): Likewise.
(builtin_memset_read_str): Likewise.
(builtin_memset_gen_str): Likewise.
* expr.cc (string_cst_read_str): Likewise.
Diffstat (limited to 'gcc/builtins.h')
-rw-r--r-- | gcc/builtins.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/builtins.h b/gcc/builtins.h index 3b5c34c..88a26d7 100644 --- a/gcc/builtins.h +++ b/gcc/builtins.h @@ -105,7 +105,7 @@ struct c_strlen_data }; extern tree c_strlen (tree, int, c_strlen_data * = NULL, unsigned = 1); -extern rtx c_readstr (const char *, scalar_int_mode, bool = true); +extern rtx c_readstr (const char *, fixed_size_mode, bool = true); extern void expand_builtin_setjmp_setup (rtx, rtx); extern void expand_builtin_setjmp_receiver (rtx); extern void expand_builtin_update_setjmp_buf (rtx); |