]> git.ipfire.org Git - thirdparty/gcc.git/commit
Determine CONSTRAINT_LEN at run-time [PR121214]
authorStefan Schulze Frielinghaus <stefansf@gcc.gnu.org>
Fri, 25 Jul 2025 09:04:38 +0000 (11:04 +0200)
committerStefan Schulze Frielinghaus <stefansf@gcc.gnu.org>
Fri, 25 Jul 2025 09:04:38 +0000 (11:04 +0200)
commit94f896c7c6c0329077271487219e345bcdcec6ab
treeb15d3c769ecce9ccde8a0f9a6c59cab85664ba2a
parent6cc6bfcdbda57e24d9b9556c72068bcb76612cf2
Determine CONSTRAINT_LEN at run-time [PR121214]

Tests gcc.dg/asm-hard-reg-error-{4,5}.c ICE on sparc*-sun-solaris2.11
since in tm-preds.h we end up with

  #define CONSTRAINT_LEN(c_,s_) 1

and, therefore, do not parse hard register constraints correctly.
Hard register constraints are non-single character constraints and
require insn_constraint_len() in order to determine the length.

In write_tm_preds_h() from genpreds.cc, previously variable
constraint_max_namelen was used in order to decide whether we have
single or non-single character constraints.  The distinction shouldn't
be done anymore and we always must call into insn_constraint_len().

While being on it, remove guard constraint_max_namelen>0 since we always
have some constraints coming from common.md.  This leaves
constraint_max_namelen without users so remove it.

gcc/ChangeLog:

PR middle-end/121214
* genpreds.cc (constraint_max_namelen): Delete.
(write_tm_preds_h): Always write insn_constraint_len() and
define CONSTRAINT_LEN to it, i.e., remove guard
constraint_max_namelen>1.  Remove outer guard
constraint_max_namelen>0 and re-indent.
(write_insn_preds_c): Remove guard
constraint_max_namelen>0 and re-indent.
gcc/genpreds.cc