]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Read extension data from riscv-ext*.def for arch-canonicalize
authorKito Cheng <kito.cheng@sifive.com>
Thu, 31 Jul 2025 08:25:52 +0000 (16:25 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Wed, 6 Aug 2025 06:52:50 +0000 (14:52 +0800)
commit0c517ddf9b136c9077b21142ec4118451d394bdb
tree0f6770752802195682373c5ad75707d7b50ddd09
parentaa1ae5284da3377190c7dd1e0dbd865bb41c46e6
RISC-V: Read extension data from riscv-ext*.def for arch-canonicalize

Previously, arch-canonicalize used hardcoded data to handle IMPLIED_EXT.
But this data often got out of sync with the actual C++ implementation.
Earlier, we introduced riscv-ext.def to keep track of all extension info
and generate docs. Now, arch-canonicalize also uses this same data to handle
extension implication rules directly.

One limitation is that conditional implication rules still need to be written
manually. Luckily, there aren't many of them for now, so it's still manageable.
I really wanted to avoid writing a C++ + Python binding or trying to parse C++
logic in Python...

This version also adds a `--selftest` option to run some unit tests.

gcc/ChangeLog:

* config/riscv/arch-canonicalize: Read extension data from
riscv-ext*.def and adding unittest.
gcc/config/riscv/arch-canonicalize