]> git.ipfire.org Git - thirdparty/gcc.git/commit
Allow targets to add USEs to asms
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 5 Dec 2023 09:52:41 +0000 (09:52 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 5 Dec 2023 09:52:41 +0000 (09:52 +0000)
commit414d795d8a365b6e72a84257caa36cb3bed7e0ba
treefbd30c69660bcce0aa8eefbe27683cc52eae2ef8
parent672fad57c1f99ff893019e2da4620e26b9b31dd2
Allow targets to add USEs to asms

Arm's SME has an array called ZA that for inline asm purposes
is effectively a form of special-purpose memory.  It doesn't
have an associated storage type and so can't be passed and
returned in normal C/C++ objects.

We'd therefore like "za" in a clobber list to mean that an inline
asm can read from and write to ZA.  (Just reading or writing
individually is unlikely to be useful, but we could add syntax
for that too if necessary.)

There is currently a TARGET_MD_ASM_ADJUST target hook that allows
targets to add clobbers to an asm instruction.  This patch
extends that to allow targets to add USEs as well.

gcc/
* target.def (md_asm_adjust): Add a uses parameter.
* doc/tm.texi: Regenerate.
* cfgexpand.cc (expand_asm_loc): Update call to md_asm_adjust.
Handle any USEs created by the target.
(expand_asm_stmt): Likewise.
* recog.cc (asm_noperands): Handle asms with USEs.
(decode_asm_operands): Likewise.
* config/arm/aarch-common-protos.h (arm_md_asm_adjust): Add uses
parameter.
* config/arm/aarch-common.cc (arm_md_asm_adjust): Likewise.
* config/arm/arm.cc (thumb1_md_asm_adjust): Likewise.
* config/avr/avr.cc (avr_md_asm_adjust): Likewise.
* config/cris/cris.cc (cris_md_asm_adjust): Likewise.
* config/i386/i386.cc (ix86_md_asm_adjust): Likewise.
* config/mn10300/mn10300.cc (mn10300_md_asm_adjust): Likewise.
* config/nds32/nds32.cc (nds32_md_asm_adjust): Likewise.
* config/pdp11/pdp11.cc (pdp11_md_asm_adjust): Likewise.
* config/rs6000/rs6000.cc (rs6000_md_asm_adjust): Likewise.
* config/s390/s390.cc (s390_md_asm_adjust): Likewise.
* config/vax/vax.cc (vax_md_asm_adjust): Likewise.
* config/visium/visium.cc (visium_md_asm_adjust): Likewise.
17 files changed:
gcc/cfgexpand.cc
gcc/config/arm/aarch-common-protos.h
gcc/config/arm/aarch-common.cc
gcc/config/arm/arm.cc
gcc/config/avr/avr.cc
gcc/config/cris/cris.cc
gcc/config/i386/i386.cc
gcc/config/mn10300/mn10300.cc
gcc/config/nds32/nds32.cc
gcc/config/pdp11/pdp11.cc
gcc/config/rs6000/rs6000.cc
gcc/config/s390/s390.cc
gcc/config/vax/vax.cc
gcc/config/visium/visium.cc
gcc/doc/tm.texi
gcc/recog.cc
gcc/target.def