]> gcc.gnu.org Git - gcc.git/commit
AVR: target 113927 - Simple code triggers stack frame for Reduced Tiny.
authorGeorg-Johann Lay <avr@gjlay.de>
Thu, 15 Feb 2024 12:53:34 +0000 (13:53 +0100)
committerGeorg-Johann Lay <avr@gjlay.de>
Thu, 15 Feb 2024 13:29:32 +0000 (14:29 +0100)
commit0f0ca42fb5556f2c6b76b017fbbd90820a728ce0
treec4d131d859f0829b9fb373bfd60a125ba3df3533
parentf8214bfe50a334d238a41fc336bff067a3f44b2e
AVR: target 113927 - Simple code triggers stack frame for Reduced Tiny.

The -mmcu=avrtiny cores have no ADIW and SBIW instructions.  This was
implemented by clearing all regs out of regclass ADDW_REGS so that
constraint "w" never matched.  This corrupted the subset relations of
the register classes as they appear in enum reg_class.

This patch keeps ADDW_REGS like for all other cores, i.e. it contains
R24...R31.  Instead of tests like  test_hard_reg_class (ADDW_REGS, *)
the code now uses  avr_adiw_reg_p (*).  And all insns with constraint "w"
get "isa" insn attribute value of "adiw".

Plus, a new built-in macro __AVR_HAVE_ADIW__ is provided, which is more
specific than __AVR_TINY__.

gcc/
PR target/113927
* config/avr/avr.h (AVR_HAVE_ADIW): New macro.
* config/avr/avr-protos.h (avr_adiw_reg_p): New proto.
* config/avr/avr.cc (avr_adiw_reg_p): New function.
(avr_conditional_register_usage) [AVR_TINY]: Don't clear ADDW_REGS.
Replace test_hard_reg_class (ADDW_REGS, ...) with calls to
* config/avr/avr.md: Same.
(attr "isa") <tiny, no_tiny>: Remove.
<adiw, no_adiw>: Add.
(define_insn, define_insn_and_split): When an alternative has
constraint "w", then set attribute "isa" to "adiw".
* config/avr/avr-c.cc (avr_cpu_cpp_builtins) [AVR_HAVE_ADIW]:
Built-in define __AVR_HAVE_ADIW__.
* doc/invoke.texi (AVR Options): Document it.

(cherry picked from commit 5cff288c2dae4ea709df067cf398f23e214b2e80)
gcc/config/avr/avr-c.cc
gcc/config/avr/avr-protos.h
gcc/config/avr/avr.cc
gcc/config/avr/avr.h
gcc/config/avr/avr.md
gcc/doc/invoke.texi
This page took 0.066133 seconds and 6 git commands to generate.