diff options
author | Richard Biener <rguenther@suse.de> | 2024-07-29 13:06:52 +0200 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2024-08-01 12:27:04 +0200 |
commit | b3974356b0981c7caf9694fe4c2faad902169c00 (patch) | |
tree | 85a0685a6c4fd47a96373a5a3e04abb1b3437a2b /gcc/target.h | |
parent | 3e4c47d1088417db599a0793a6d93707228e4f70 (diff) | |
download | gcc-b3974356b0981c7caf9694fe4c2faad902169c00.zip gcc-b3974356b0981c7caf9694fe4c2faad902169c00.tar.gz gcc-b3974356b0981c7caf9694fe4c2faad902169c00.tar.bz2 |
Add TARGET_MODE_CAN_TRANSFER_BITS
The following adds a target hook to specify whether regs of MODE can be
used to transfer bits. The hook is supposed to be used for value-numbering
to decide whether a value loaded in such mode can be punned to another
mode instead of re-loading the value in the other mode and for SRA to
decide whether MODE is suitable as container holding a value to be
used in different modes.
* target.def (mode_can_transfer_bits): New target hook.
* target.h (mode_can_transfer_bits): New function wrapping the
hook and providing default behavior.
* doc/tm.texi.in: Update.
* doc/tm.texi: Re-generate.
Diffstat (limited to 'gcc/target.h')
-rw-r--r-- | gcc/target.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/target.h b/gcc/target.h index c1f99b9..837651d 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -312,6 +312,22 @@ estimated_poly_value (poly_int64 x, return targetm.estimated_poly_value (x, kind); } +/* Return true when MODE can be used to copy GET_MODE_BITSIZE bits + unchanged. */ + +inline bool +mode_can_transfer_bits (machine_mode mode) +{ + if (mode == BLKmode) + return true; + if (maybe_ne (GET_MODE_BITSIZE (mode), + GET_MODE_UNIT_PRECISION (mode) * GET_MODE_NUNITS (mode))) + return false; + if (targetm.mode_can_transfer_bits) + return targetm.mode_can_transfer_bits (mode); + return true; +} + #ifdef GCC_TM_H #ifndef CUMULATIVE_ARGS_MAGIC |