Skip to content

Commit

Permalink
[RISC-V] add implied extension repeatly until stable
Browse files Browse the repository at this point in the history
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>
(cherry picked from commit 682731d)
  • Loading branch information
GaoFei-ESWIN authored and kito-cheng committed Jul 19, 2024
1 parent a2a2916 commit b218c42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 11 additions & 3 deletions gcc/common/config/riscv/riscv-common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,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)
{
}

Expand Down Expand Up @@ -709,6 +710,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;

Expand Down Expand Up @@ -1472,9 +1474,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 ());

Expand Down
3 changes: 3 additions & 0 deletions gcc/config/riscv/riscv-subset.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class riscv_subset_list
/* Allow adding the same extension more than once. */
bool m_allow_adding_dup;

/* Number of subsets. */
unsigned m_subset_num;

riscv_subset_list (const char *, location_t);

const char *parsing_subset_version (const char *, const char *, unsigned *,
Expand Down

0 comments on commit b218c42

Please sign in to comment.