diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2023-11-10 15:46:21 +0000 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2023-11-10 15:46:21 +0000 |
commit | 5dbaf4851bbf56b6176dca1f1e7d38a16b5b84ee (patch) | |
tree | c4a66c071d5b3401e1893fd4036e6ae425beb627 /gcc/read-rtl.cc | |
parent | 1ae921db2fbe0aed5860f560d52bf8920bd8e0f9 (diff) | |
download | gcc-5dbaf4851bbf56b6176dca1f1e7d38a16b5b84ee.zip gcc-5dbaf4851bbf56b6176dca1f1e7d38a16b5b84ee.tar.gz gcc-5dbaf4851bbf56b6176dca1f1e7d38a16b5b84ee.tar.bz2 |
Allow md iterators to include other iterators
This patch allows an .md iterator to include the contents of
previous iterators, possibly with an extra condition attached.
Too much indirection might become hard to follow, so for the
AArch64 changes I tried to stick to things that seemed likely
to be uncontroversial:
(a) structure iterators that combine modes for different sizes
and vector counts
(b) iterators that explicitly duplicate another iterator
(for iterating over the cross product)
gcc/
* read-rtl.cc (md_reader::read_mapping): Allow iterators to
include other iterators.
* doc/md.texi: Document the change.
* config/aarch64/iterators.md (DREG2, VQ2, TX2, DX2, SX2): Include
the iterator that is being duplicated, rather than reproducing it.
(VSTRUCT_D): Redefine using VSTRUCT_[234]D.
(VSTRUCT_Q): Likewise VSTRUCT_[234]Q.
(VSTRUCT_2QD, VSTRUCT_3QD, VSTRUCT_4QD, VSTRUCT_QD): Redefine using
the individual D and Q iterators.
Diffstat (limited to 'gcc/read-rtl.cc')
-rw-r--r-- | gcc/read-rtl.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/read-rtl.cc b/gcc/read-rtl.cc index f3b5613..00bf4ab 100644 --- a/gcc/read-rtl.cc +++ b/gcc/read-rtl.cc @@ -1293,8 +1293,25 @@ md_reader::read_mapping (struct iterator_group *group, htab_t table) string = read_string (false); require_char_ws (')'); } - number = group->find_builtin (name.string); - end_ptr = add_map_value (end_ptr, number, string); + auto *subm = (struct mapping *) htab_find (group->iterators, + &name.string); + if (subm) + { + if (m == subm) + fatal_with_file_and_line ("recursive definition of `%s'", + name.string); + for (map_value *v = subm->values; v; v = v->next) + { + auto *joined = rtx_reader_ptr->join_c_conditions (v->string, + string); + end_ptr = add_map_value (end_ptr, v->number, joined); + } + } + else + { + number = group->find_builtin (name.string); + end_ptr = add_map_value (end_ptr, number, string); + } c = read_skip_spaces (); } while (c != ']'); |