https://gcc.gnu.org/g:682731d11f9c02b24358d1af1e2bf6fca0221ee7
commit r15-1892-g682731d11f9c02b24358d1af1e2bf6fca0221ee7 Author: Fei Gao <gao...@eswincomputing.com> Date: Fri Jul 5 09:56:30 2024 +0000 [RISC-V] add implied extension repeatly until stable Call handle_implied_ext repeatly until there's no new subset added into the subset list. gcc/ChangeLog: * common/config/riscv/riscv-common.cc (riscv_subset_list::riscv_subset_list): init m_subset_num to 0. (riscv_subset_list::add): increase m_subset_num once a subset added. (riscv_subset_list::finalize): call handle_implied_ext repeatly until no change in m_subset_num. * config/riscv/riscv-subset.h: add m_subset_num member. Signed-off-by: Fei Gao <gao...@eswincomputing.com> Diff: --- gcc/common/config/riscv/riscv-common.cc | 14 +++++++++++--- gcc/config/riscv/riscv-subset.h | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc index 16bdb3fd2259..b9bda3e110a2 100644 --- a/gcc/common/config/riscv/riscv-common.cc +++ b/gcc/common/config/riscv/riscv-common.cc @@ -569,7 +569,8 @@ riscv_subset_t::riscv_subset_t () } riscv_subset_list::riscv_subset_list (const char *arch, location_t loc) - : m_arch (arch), m_loc (loc), m_head (NULL), m_tail (NULL), m_xlen (0) + : m_arch (arch), m_loc (loc), m_head (NULL), m_tail (NULL), m_xlen (0), + m_subset_num (0) { } @@ -815,6 +816,7 @@ riscv_subset_list::add (const char *subset, int major_version, return; } + m_subset_num++; riscv_subset_t *s = new riscv_subset_t (); riscv_subset_t *itr; @@ -1597,9 +1599,15 @@ void riscv_subset_list::finalize () { riscv_subset_t *subset; + unsigned pre_subset_num; - for (subset = m_head; subset != NULL; subset = subset->next) - handle_implied_ext (subset->name.c_str ()); + do + { + pre_subset_num = m_subset_num; + for (subset = m_head; subset != NULL; subset = subset->next) + handle_implied_ext (subset->name.c_str ()); + } + while (pre_subset_num != m_subset_num); gcc_assert (check_implied_ext ()); diff --git a/gcc/config/riscv/riscv-subset.h b/gcc/config/riscv/riscv-subset.h index fe7f54d8bc57..7dc196a20074 100644 --- a/gcc/config/riscv/riscv-subset.h +++ b/gcc/config/riscv/riscv-subset.h @@ -62,6 +62,9 @@ private: /* X-len of m_arch. */ unsigned m_xlen; + /* Number of subsets. */ + unsigned m_subset_num; + riscv_subset_list (const char *, location_t); const char *parsing_subset_version (const char *, const char *, unsigned *,