@@ -566,7 +566,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)
{
}
@@ -812,6 +813,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;
@@ -1586,9 +1588,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 ());
@@ -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 *,
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 <gaofei@eswincomputing.com> --- gcc/common/config/riscv/riscv-common.cc | 14 +++++++++++--- gcc/config/riscv/riscv-subset.h | 3 +++ 2 files changed, 14 insertions(+), 3 deletions(-)