[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Generate extension table in documentation from riscv-ext.def
https://gcc.gnu.org/g:65dd6358c9e8acfa7b8af57f54730d9415d47bd8
commit 65dd6358c9e8acfa7b8af57f54730d9415d47bd8
Author: Kito Cheng
Date: Wed May 7 21:10:53 2025 +0800
RISC-V: Generate extension table in documentation from riscv-ext.def
Automatically build the ISA extension reference table in invoke.texi from
the unified riscv-ext.def metadata, ensuring documentation stays in sync
with extension definitions and reducing manual maintenance.
gcc/ChangeLog:
* doc/invoke.texi: Replace hand‑written extension table with
`@include riscv-ext.texi` to pull in auto‑generated entries.
* doc/riscv-ext.texi: New generated definition file
containing formatted documentation entries for each extension.
* Makefile.in: Add riscv-ext.texi to the list of files to be
processed by the Texinfo generator.
* config/riscv/gen-riscv-ext-texi.cc: New.
* config/riscv/t-riscv: Add rule for generating riscv-ext.texi.
(cherry picked from commit 124cbbbed5b8f7454f93f9a87e57fd4f3f2f78d2)
Diff:
---
gcc/Makefile.in| 2 +-
gcc/config/riscv/gen-riscv-ext-texi.cc | 88 +
gcc/config/riscv/t-riscv | 34 +-
gcc/doc/invoke.texi| 495 +
gcc/doc/riscv-ext.texi | 637 +
5 files changed, 759 insertions(+), 497 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4cd7dbed3..0fa5d0c925af 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3702,7 +3702,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi
frontends.texi\
contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi \
fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi \
implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi \
-lto-dump.texi
+lto-dump.texi riscv-ext.texi
# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
# the generated tm.texi; the latter might have a more recent timestamp,
diff --git a/gcc/config/riscv/gen-riscv-ext-texi.cc
b/gcc/config/riscv/gen-riscv-ext-texi.cc
new file mode 100644
index ..e15fdbf36f6e
--- /dev/null
+++ b/gcc/config/riscv/gen-riscv-ext-texi.cc
@@ -0,0 +1,88 @@
+#include
+#include
+#include
+#include
+#include "riscv-opts.h"
+
+struct version_t
+{
+ int major;
+ int minor;
+ version_t (int major, int minor,
+enum riscv_isa_spec_class spec = ISA_SPEC_CLASS_NONE)
+: major (major), minor (minor)
+ {}
+ bool operator<(const version_t &other) const
+ {
+if (major != other.major)
+ return major < other.major;
+return minor < other.minor;
+ }
+
+ bool operator== (const version_t &other) const
+ {
+return major == other.major && minor == other.minor;
+ }
+};
+
+static void
+print_ext_doc_entry (const std::string &ext_name, const std::string &full_name,
+const std::string &desc,
+const std::vector &supported_versions)
+{
+ // Implementation of the function to print the documentation entry
+ // for the extension.
+ std::set unique_versions;
+ for (const auto &version : supported_versions)
+unique_versions.insert (version);
+ printf ("@item %s\n", ext_name.c_str ());
+ printf ("@tab");
+ for (const auto &version : unique_versions)
+{
+ printf (" %d.%d", version.major, version.minor);
+}
+ printf ("\n");
+ printf ("@tab %s", full_name.c_str ());
+ if (desc.size ())
+printf (", %s", desc.c_str ());
+ printf ("\n\n");
+}
+
+int
+main ()
+{
+ puts ("@c Copyright (C) 2025 Free Software Foundation, Inc.");
+ puts ("@c This is part of the GCC manual.");
+ puts ("@c For copying conditions, see the file gcc/doc/include/fdl.texi.");
+ puts ("");
+ puts ("@c This file is generated automatically using");
+ puts ("@c gcc/config/riscv/gen-riscv-ext-texi.cc from:");
+ puts ("@c gcc/config/riscv/riscv-ext.def");
+ puts ("@c gcc/config/riscv/riscv-opts.h");
+ puts ("");
+ puts ("@c Please *DO NOT* edit manually.");
+ puts ("");
+ puts ("@multitable @columnfractions .10 .10 .80");
+ puts ("@headitem Extension Name @tab Supported Version @tab Description");
+ puts ("");
+
+ /* g extension is a very speical extension that no clear version... */
+ puts ("@item g");
+ puts ("@tab -");
+ puts (
+"@tab General-purpose computing base extension, @samp{g} will expand to");
+ puts ("@samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and");
+ puts ("@samp{zifencei}.");
+ puts ("");
+
+#define DEFINE_RISCV_EXT(NAME, UPPERCAE_NAME, FULL_NAME, DESC, URL, DEP_EXTS,
\
+SUPPORTED_VERSIONS, FLAG_GROUP, BITMASK_GROUP_ID, \
+BITMASK_BIT_POSITION, EXTRA_EXTENSION_FLAGS) \
+ print_ext_doc_entry (#NAME, FULL_NAME, DESC,
\
+
[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Generate extension table in documentation from riscv-ext.def
https://gcc.gnu.org/g:d6568795e4b6d8de826b9284879cc528b077163f
commit d6568795e4b6d8de826b9284879cc528b077163f
Author: Kito Cheng
Date: Wed May 7 21:10:53 2025 +0800
RISC-V: Generate extension table in documentation from riscv-ext.def
Automatically build the ISA extension reference table in invoke.texi from
the unified riscv-ext.def metadata, ensuring documentation stays in sync
with extension definitions and reducing manual maintenance.
gcc/ChangeLog:
* doc/invoke.texi: Replace hand‑written extension table with
`@include riscv-ext.texi` to pull in auto‑generated entries.
* doc/riscv-ext.texi: New generated definition file
containing formatted documentation entries for each extension.
* Makefile.in: Add riscv-ext.texi to the list of files to be
processed by the Texinfo generator.
* config/riscv/gen-riscv-ext-texi.cc: New.
* config/riscv/t-riscv: Add rule for generating riscv-ext.texi.
(cherry picked from commit 124cbbbed5b8f7454f93f9a87e57fd4f3f2f78d2)
Diff:
---
gcc/Makefile.in| 2 +-
gcc/config/riscv/gen-riscv-ext-texi.cc | 88 +
gcc/config/riscv/t-riscv | 34 +-
gcc/doc/invoke.texi| 495 +
gcc/doc/riscv-ext.texi | 637 +
5 files changed, 759 insertions(+), 497 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4cd7dbed3..0fa5d0c925af 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3702,7 +3702,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi
frontends.texi\
contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi \
fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi \
implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi \
-lto-dump.texi
+lto-dump.texi riscv-ext.texi
# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
# the generated tm.texi; the latter might have a more recent timestamp,
diff --git a/gcc/config/riscv/gen-riscv-ext-texi.cc
b/gcc/config/riscv/gen-riscv-ext-texi.cc
new file mode 100644
index ..e15fdbf36f6e
--- /dev/null
+++ b/gcc/config/riscv/gen-riscv-ext-texi.cc
@@ -0,0 +1,88 @@
+#include
+#include
+#include
+#include
+#include "riscv-opts.h"
+
+struct version_t
+{
+ int major;
+ int minor;
+ version_t (int major, int minor,
+enum riscv_isa_spec_class spec = ISA_SPEC_CLASS_NONE)
+: major (major), minor (minor)
+ {}
+ bool operator<(const version_t &other) const
+ {
+if (major != other.major)
+ return major < other.major;
+return minor < other.minor;
+ }
+
+ bool operator== (const version_t &other) const
+ {
+return major == other.major && minor == other.minor;
+ }
+};
+
+static void
+print_ext_doc_entry (const std::string &ext_name, const std::string &full_name,
+const std::string &desc,
+const std::vector &supported_versions)
+{
+ // Implementation of the function to print the documentation entry
+ // for the extension.
+ std::set unique_versions;
+ for (const auto &version : supported_versions)
+unique_versions.insert (version);
+ printf ("@item %s\n", ext_name.c_str ());
+ printf ("@tab");
+ for (const auto &version : unique_versions)
+{
+ printf (" %d.%d", version.major, version.minor);
+}
+ printf ("\n");
+ printf ("@tab %s", full_name.c_str ());
+ if (desc.size ())
+printf (", %s", desc.c_str ());
+ printf ("\n\n");
+}
+
+int
+main ()
+{
+ puts ("@c Copyright (C) 2025 Free Software Foundation, Inc.");
+ puts ("@c This is part of the GCC manual.");
+ puts ("@c For copying conditions, see the file gcc/doc/include/fdl.texi.");
+ puts ("");
+ puts ("@c This file is generated automatically using");
+ puts ("@c gcc/config/riscv/gen-riscv-ext-texi.cc from:");
+ puts ("@c gcc/config/riscv/riscv-ext.def");
+ puts ("@c gcc/config/riscv/riscv-opts.h");
+ puts ("");
+ puts ("@c Please *DO NOT* edit manually.");
+ puts ("");
+ puts ("@multitable @columnfractions .10 .10 .80");
+ puts ("@headitem Extension Name @tab Supported Version @tab Description");
+ puts ("");
+
+ /* g extension is a very speical extension that no clear version... */
+ puts ("@item g");
+ puts ("@tab -");
+ puts (
+"@tab General-purpose computing base extension, @samp{g} will expand to");
+ puts ("@samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and");
+ puts ("@samp{zifencei}.");
+ puts ("");
+
+#define DEFINE_RISCV_EXT(NAME, UPPERCAE_NAME, FULL_NAME, DESC, URL, DEP_EXTS,
\
+SUPPORTED_VERSIONS, FLAG_GROUP, BITMASK_GROUP_ID, \
+BITMASK_BIT_POSITION, EXTRA_EXTENSION_FLAGS) \
+ print_ext_doc_entry (#NAME, FULL_NAME, DESC,
\
+
[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Generate extension table in documentation from riscv-ext.def
https://gcc.gnu.org/g:a84a47c12de0104579257a4c96d96d8ec4da848a
commit a84a47c12de0104579257a4c96d96d8ec4da848a
Author: Kito Cheng
Date: Wed May 7 21:10:53 2025 +0800
RISC-V: Generate extension table in documentation from riscv-ext.def
Automatically build the ISA extension reference table in invoke.texi from
the unified riscv-ext.def metadata, ensuring documentation stays in sync
with extension definitions and reducing manual maintenance.
gcc/ChangeLog:
* doc/invoke.texi: Replace hand‑written extension table with
`@include riscv-ext.texi` to pull in auto‑generated entries.
* doc/riscv-ext.texi: New generated definition file
containing formatted documentation entries for each extension.
* Makefile.in: Add riscv-ext.texi to the list of files to be
processed by the Texinfo generator.
* config/riscv/gen-riscv-ext-texi.cc: New.
* config/riscv/t-riscv: Add rule for generating riscv-ext.texi.
(cherry picked from commit 124cbbbed5b8f7454f93f9a87e57fd4f3f2f78d2)
Diff:
---
gcc/Makefile.in| 2 +-
gcc/config/riscv/gen-riscv-ext-texi.cc | 88 +
gcc/config/riscv/t-riscv | 34 +-
gcc/doc/invoke.texi| 495 +
gcc/doc/riscv-ext.texi | 637 +
5 files changed, 759 insertions(+), 497 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4cd7dbed3..0fa5d0c925af 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3702,7 +3702,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi
frontends.texi\
contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi \
fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi \
implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi \
-lto-dump.texi
+lto-dump.texi riscv-ext.texi
# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
# the generated tm.texi; the latter might have a more recent timestamp,
diff --git a/gcc/config/riscv/gen-riscv-ext-texi.cc
b/gcc/config/riscv/gen-riscv-ext-texi.cc
new file mode 100644
index ..e15fdbf36f6e
--- /dev/null
+++ b/gcc/config/riscv/gen-riscv-ext-texi.cc
@@ -0,0 +1,88 @@
+#include
+#include
+#include
+#include
+#include "riscv-opts.h"
+
+struct version_t
+{
+ int major;
+ int minor;
+ version_t (int major, int minor,
+enum riscv_isa_spec_class spec = ISA_SPEC_CLASS_NONE)
+: major (major), minor (minor)
+ {}
+ bool operator<(const version_t &other) const
+ {
+if (major != other.major)
+ return major < other.major;
+return minor < other.minor;
+ }
+
+ bool operator== (const version_t &other) const
+ {
+return major == other.major && minor == other.minor;
+ }
+};
+
+static void
+print_ext_doc_entry (const std::string &ext_name, const std::string &full_name,
+const std::string &desc,
+const std::vector &supported_versions)
+{
+ // Implementation of the function to print the documentation entry
+ // for the extension.
+ std::set unique_versions;
+ for (const auto &version : supported_versions)
+unique_versions.insert (version);
+ printf ("@item %s\n", ext_name.c_str ());
+ printf ("@tab");
+ for (const auto &version : unique_versions)
+{
+ printf (" %d.%d", version.major, version.minor);
+}
+ printf ("\n");
+ printf ("@tab %s", full_name.c_str ());
+ if (desc.size ())
+printf (", %s", desc.c_str ());
+ printf ("\n\n");
+}
+
+int
+main ()
+{
+ puts ("@c Copyright (C) 2025 Free Software Foundation, Inc.");
+ puts ("@c This is part of the GCC manual.");
+ puts ("@c For copying conditions, see the file gcc/doc/include/fdl.texi.");
+ puts ("");
+ puts ("@c This file is generated automatically using");
+ puts ("@c gcc/config/riscv/gen-riscv-ext-texi.cc from:");
+ puts ("@c gcc/config/riscv/riscv-ext.def");
+ puts ("@c gcc/config/riscv/riscv-opts.h");
+ puts ("");
+ puts ("@c Please *DO NOT* edit manually.");
+ puts ("");
+ puts ("@multitable @columnfractions .10 .10 .80");
+ puts ("@headitem Extension Name @tab Supported Version @tab Description");
+ puts ("");
+
+ /* g extension is a very speical extension that no clear version... */
+ puts ("@item g");
+ puts ("@tab -");
+ puts (
+"@tab General-purpose computing base extension, @samp{g} will expand to");
+ puts ("@samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and");
+ puts ("@samp{zifencei}.");
+ puts ("");
+
+#define DEFINE_RISCV_EXT(NAME, UPPERCAE_NAME, FULL_NAME, DESC, URL, DEP_EXTS,
\
+SUPPORTED_VERSIONS, FLAG_GROUP, BITMASK_GROUP_ID, \
+BITMASK_BIT_POSITION, EXTRA_EXTENSION_FLAGS) \
+ print_ext_doc_entry (#NAME, FULL_NAME, DESC,
\
+
[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Generate extension table in documentation from riscv-ext.def
https://gcc.gnu.org/g:7b8c03deb02fe4167785a7ddc47193cc75671048
commit 7b8c03deb02fe4167785a7ddc47193cc75671048
Author: Kito Cheng
Date: Wed May 7 21:10:53 2025 +0800
RISC-V: Generate extension table in documentation from riscv-ext.def
Automatically build the ISA extension reference table in invoke.texi from
the unified riscv-ext.def metadata, ensuring documentation stays in sync
with extension definitions and reducing manual maintenance.
gcc/ChangeLog:
* doc/invoke.texi: Replace hand‑written extension table with
`@include riscv-ext.texi` to pull in auto‑generated entries.
* doc/riscv-ext.texi: New generated definition file
containing formatted documentation entries for each extension.
* Makefile.in: Add riscv-ext.texi to the list of files to be
processed by the Texinfo generator.
* config/riscv/gen-riscv-ext-texi.cc: New.
* config/riscv/t-riscv: Add rule for generating riscv-ext.texi.
(cherry picked from commit 124cbbbed5b8f7454f93f9a87e57fd4f3f2f78d2)
Diff:
---
gcc/Makefile.in| 2 +-
gcc/config/riscv/gen-riscv-ext-texi.cc | 88 +
gcc/config/riscv/t-riscv | 34 +-
gcc/doc/invoke.texi| 495 +
gcc/doc/riscv-ext.texi | 637 +
5 files changed, 759 insertions(+), 497 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4cd7dbed3..0fa5d0c925af 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3702,7 +3702,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi
frontends.texi\
contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi \
fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi \
implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi \
-lto-dump.texi
+lto-dump.texi riscv-ext.texi
# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
# the generated tm.texi; the latter might have a more recent timestamp,
diff --git a/gcc/config/riscv/gen-riscv-ext-texi.cc
b/gcc/config/riscv/gen-riscv-ext-texi.cc
new file mode 100644
index ..e15fdbf36f6e
--- /dev/null
+++ b/gcc/config/riscv/gen-riscv-ext-texi.cc
@@ -0,0 +1,88 @@
+#include
+#include
+#include
+#include
+#include "riscv-opts.h"
+
+struct version_t
+{
+ int major;
+ int minor;
+ version_t (int major, int minor,
+enum riscv_isa_spec_class spec = ISA_SPEC_CLASS_NONE)
+: major (major), minor (minor)
+ {}
+ bool operator<(const version_t &other) const
+ {
+if (major != other.major)
+ return major < other.major;
+return minor < other.minor;
+ }
+
+ bool operator== (const version_t &other) const
+ {
+return major == other.major && minor == other.minor;
+ }
+};
+
+static void
+print_ext_doc_entry (const std::string &ext_name, const std::string &full_name,
+const std::string &desc,
+const std::vector &supported_versions)
+{
+ // Implementation of the function to print the documentation entry
+ // for the extension.
+ std::set unique_versions;
+ for (const auto &version : supported_versions)
+unique_versions.insert (version);
+ printf ("@item %s\n", ext_name.c_str ());
+ printf ("@tab");
+ for (const auto &version : unique_versions)
+{
+ printf (" %d.%d", version.major, version.minor);
+}
+ printf ("\n");
+ printf ("@tab %s", full_name.c_str ());
+ if (desc.size ())
+printf (", %s", desc.c_str ());
+ printf ("\n\n");
+}
+
+int
+main ()
+{
+ puts ("@c Copyright (C) 2025 Free Software Foundation, Inc.");
+ puts ("@c This is part of the GCC manual.");
+ puts ("@c For copying conditions, see the file gcc/doc/include/fdl.texi.");
+ puts ("");
+ puts ("@c This file is generated automatically using");
+ puts ("@c gcc/config/riscv/gen-riscv-ext-texi.cc from:");
+ puts ("@c gcc/config/riscv/riscv-ext.def");
+ puts ("@c gcc/config/riscv/riscv-opts.h");
+ puts ("");
+ puts ("@c Please *DO NOT* edit manually.");
+ puts ("");
+ puts ("@multitable @columnfractions .10 .10 .80");
+ puts ("@headitem Extension Name @tab Supported Version @tab Description");
+ puts ("");
+
+ /* g extension is a very speical extension that no clear version... */
+ puts ("@item g");
+ puts ("@tab -");
+ puts (
+"@tab General-purpose computing base extension, @samp{g} will expand to");
+ puts ("@samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and");
+ puts ("@samp{zifencei}.");
+ puts ("");
+
+#define DEFINE_RISCV_EXT(NAME, UPPERCAE_NAME, FULL_NAME, DESC, URL, DEP_EXTS,
\
+SUPPORTED_VERSIONS, FLAG_GROUP, BITMASK_GROUP_ID, \
+BITMASK_BIT_POSITION, EXTRA_EXTENSION_FLAGS) \
+ print_ext_doc_entry (#NAME, FULL_NAME, DESC,
\
+
[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Generate extension table in documentation from riscv-ext.def
https://gcc.gnu.org/g:a430ef0bd86ed3fe98102347c4b1378a95b6397a
commit a430ef0bd86ed3fe98102347c4b1378a95b6397a
Author: Kito Cheng
Date: Wed May 7 21:10:53 2025 +0800
RISC-V: Generate extension table in documentation from riscv-ext.def
Automatically build the ISA extension reference table in invoke.texi from
the unified riscv-ext.def metadata, ensuring documentation stays in sync
with extension definitions and reducing manual maintenance.
gcc/ChangeLog:
* doc/invoke.texi: Replace hand‑written extension table with
`@include riscv-ext.texi` to pull in auto‑generated entries.
* doc/riscv-ext.texi: New generated definition file
containing formatted documentation entries for each extension.
* Makefile.in: Add riscv-ext.texi to the list of files to be
processed by the Texinfo generator.
* config/riscv/gen-riscv-ext-texi.cc: New.
* config/riscv/t-riscv: Add rule for generating riscv-ext.texi.
(cherry picked from commit 124cbbbed5b8f7454f93f9a87e57fd4f3f2f78d2)
Diff:
---
gcc/Makefile.in| 2 +-
gcc/config/riscv/gen-riscv-ext-texi.cc | 88 +
gcc/config/riscv/t-riscv | 34 +-
gcc/doc/invoke.texi| 495 +
gcc/doc/riscv-ext.texi | 637 +
5 files changed, 759 insertions(+), 497 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4cd7dbed3..0fa5d0c925af 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3702,7 +3702,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi
frontends.texi\
contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi \
fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi \
implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi \
-lto-dump.texi
+lto-dump.texi riscv-ext.texi
# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
# the generated tm.texi; the latter might have a more recent timestamp,
diff --git a/gcc/config/riscv/gen-riscv-ext-texi.cc
b/gcc/config/riscv/gen-riscv-ext-texi.cc
new file mode 100644
index ..e15fdbf36f6e
--- /dev/null
+++ b/gcc/config/riscv/gen-riscv-ext-texi.cc
@@ -0,0 +1,88 @@
+#include
+#include
+#include
+#include
+#include "riscv-opts.h"
+
+struct version_t
+{
+ int major;
+ int minor;
+ version_t (int major, int minor,
+enum riscv_isa_spec_class spec = ISA_SPEC_CLASS_NONE)
+: major (major), minor (minor)
+ {}
+ bool operator<(const version_t &other) const
+ {
+if (major != other.major)
+ return major < other.major;
+return minor < other.minor;
+ }
+
+ bool operator== (const version_t &other) const
+ {
+return major == other.major && minor == other.minor;
+ }
+};
+
+static void
+print_ext_doc_entry (const std::string &ext_name, const std::string &full_name,
+const std::string &desc,
+const std::vector &supported_versions)
+{
+ // Implementation of the function to print the documentation entry
+ // for the extension.
+ std::set unique_versions;
+ for (const auto &version : supported_versions)
+unique_versions.insert (version);
+ printf ("@item %s\n", ext_name.c_str ());
+ printf ("@tab");
+ for (const auto &version : unique_versions)
+{
+ printf (" %d.%d", version.major, version.minor);
+}
+ printf ("\n");
+ printf ("@tab %s", full_name.c_str ());
+ if (desc.size ())
+printf (", %s", desc.c_str ());
+ printf ("\n\n");
+}
+
+int
+main ()
+{
+ puts ("@c Copyright (C) 2025 Free Software Foundation, Inc.");
+ puts ("@c This is part of the GCC manual.");
+ puts ("@c For copying conditions, see the file gcc/doc/include/fdl.texi.");
+ puts ("");
+ puts ("@c This file is generated automatically using");
+ puts ("@c gcc/config/riscv/gen-riscv-ext-texi.cc from:");
+ puts ("@c gcc/config/riscv/riscv-ext.def");
+ puts ("@c gcc/config/riscv/riscv-opts.h");
+ puts ("");
+ puts ("@c Please *DO NOT* edit manually.");
+ puts ("");
+ puts ("@multitable @columnfractions .10 .10 .80");
+ puts ("@headitem Extension Name @tab Supported Version @tab Description");
+ puts ("");
+
+ /* g extension is a very speical extension that no clear version... */
+ puts ("@item g");
+ puts ("@tab -");
+ puts (
+"@tab General-purpose computing base extension, @samp{g} will expand to");
+ puts ("@samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and");
+ puts ("@samp{zifencei}.");
+ puts ("");
+
+#define DEFINE_RISCV_EXT(NAME, UPPERCAE_NAME, FULL_NAME, DESC, URL, DEP_EXTS,
\
+SUPPORTED_VERSIONS, FLAG_GROUP, BITMASK_GROUP_ID, \
+BITMASK_BIT_POSITION, EXTRA_EXTENSION_FLAGS) \
+ print_ext_doc_entry (#NAME, FULL_NAME, DESC,
\
+
[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Generate extension table in documentation from riscv-ext.def
https://gcc.gnu.org/g:9265ed289fb8cdb826ea378ce8c2a01c4ab83e3f
commit 9265ed289fb8cdb826ea378ce8c2a01c4ab83e3f
Author: Kito Cheng
Date: Wed May 7 21:10:53 2025 +0800
RISC-V: Generate extension table in documentation from riscv-ext.def
Automatically build the ISA extension reference table in invoke.texi from
the unified riscv-ext.def metadata, ensuring documentation stays in sync
with extension definitions and reducing manual maintenance.
gcc/ChangeLog:
* doc/invoke.texi: Replace hand‑written extension table with
`@include riscv-ext.texi` to pull in auto‑generated entries.
* doc/riscv-ext.texi: New generated definition file
containing formatted documentation entries for each extension.
* Makefile.in: Add riscv-ext.texi to the list of files to be
processed by the Texinfo generator.
* config/riscv/gen-riscv-ext-texi.cc: New.
* config/riscv/t-riscv: Add rule for generating riscv-ext.texi.
(cherry picked from commit 124cbbbed5b8f7454f93f9a87e57fd4f3f2f78d2)
Diff:
---
gcc/Makefile.in| 2 +-
gcc/config/riscv/gen-riscv-ext-texi.cc | 88 +
gcc/config/riscv/t-riscv | 34 +-
gcc/doc/invoke.texi| 495 +
gcc/doc/riscv-ext.texi | 637 +
5 files changed, 759 insertions(+), 497 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4cd7dbed3..0fa5d0c925af 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3702,7 +3702,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi
frontends.texi\
contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi \
fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi \
implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi \
-lto-dump.texi
+lto-dump.texi riscv-ext.texi
# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
# the generated tm.texi; the latter might have a more recent timestamp,
diff --git a/gcc/config/riscv/gen-riscv-ext-texi.cc
b/gcc/config/riscv/gen-riscv-ext-texi.cc
new file mode 100644
index ..e15fdbf36f6e
--- /dev/null
+++ b/gcc/config/riscv/gen-riscv-ext-texi.cc
@@ -0,0 +1,88 @@
+#include
+#include
+#include
+#include
+#include "riscv-opts.h"
+
+struct version_t
+{
+ int major;
+ int minor;
+ version_t (int major, int minor,
+enum riscv_isa_spec_class spec = ISA_SPEC_CLASS_NONE)
+: major (major), minor (minor)
+ {}
+ bool operator<(const version_t &other) const
+ {
+if (major != other.major)
+ return major < other.major;
+return minor < other.minor;
+ }
+
+ bool operator== (const version_t &other) const
+ {
+return major == other.major && minor == other.minor;
+ }
+};
+
+static void
+print_ext_doc_entry (const std::string &ext_name, const std::string &full_name,
+const std::string &desc,
+const std::vector &supported_versions)
+{
+ // Implementation of the function to print the documentation entry
+ // for the extension.
+ std::set unique_versions;
+ for (const auto &version : supported_versions)
+unique_versions.insert (version);
+ printf ("@item %s\n", ext_name.c_str ());
+ printf ("@tab");
+ for (const auto &version : unique_versions)
+{
+ printf (" %d.%d", version.major, version.minor);
+}
+ printf ("\n");
+ printf ("@tab %s", full_name.c_str ());
+ if (desc.size ())
+printf (", %s", desc.c_str ());
+ printf ("\n\n");
+}
+
+int
+main ()
+{
+ puts ("@c Copyright (C) 2025 Free Software Foundation, Inc.");
+ puts ("@c This is part of the GCC manual.");
+ puts ("@c For copying conditions, see the file gcc/doc/include/fdl.texi.");
+ puts ("");
+ puts ("@c This file is generated automatically using");
+ puts ("@c gcc/config/riscv/gen-riscv-ext-texi.cc from:");
+ puts ("@c gcc/config/riscv/riscv-ext.def");
+ puts ("@c gcc/config/riscv/riscv-opts.h");
+ puts ("");
+ puts ("@c Please *DO NOT* edit manually.");
+ puts ("");
+ puts ("@multitable @columnfractions .10 .10 .80");
+ puts ("@headitem Extension Name @tab Supported Version @tab Description");
+ puts ("");
+
+ /* g extension is a very speical extension that no clear version... */
+ puts ("@item g");
+ puts ("@tab -");
+ puts (
+"@tab General-purpose computing base extension, @samp{g} will expand to");
+ puts ("@samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and");
+ puts ("@samp{zifencei}.");
+ puts ("");
+
+#define DEFINE_RISCV_EXT(NAME, UPPERCAE_NAME, FULL_NAME, DESC, URL, DEP_EXTS,
\
+SUPPORTED_VERSIONS, FLAG_GROUP, BITMASK_GROUP_ID, \
+BITMASK_BIT_POSITION, EXTRA_EXTENSION_FLAGS) \
+ print_ext_doc_entry (#NAME, FULL_NAME, DESC,
\
+
[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Generate extension table in documentation from riscv-ext.def
https://gcc.gnu.org/g:bd4ece04fb86876b07a93dfa3319d59173ac4e70
commit bd4ece04fb86876b07a93dfa3319d59173ac4e70
Author: Kito Cheng
Date: Wed May 7 21:10:53 2025 +0800
RISC-V: Generate extension table in documentation from riscv-ext.def
Automatically build the ISA extension reference table in invoke.texi from
the unified riscv-ext.def metadata, ensuring documentation stays in sync
with extension definitions and reducing manual maintenance.
gcc/ChangeLog:
* doc/invoke.texi: Replace hand‑written extension table with
`@include riscv-ext.texi` to pull in auto‑generated entries.
* doc/riscv-ext.texi: New generated definition file
containing formatted documentation entries for each extension.
* Makefile.in: Add riscv-ext.texi to the list of files to be
processed by the Texinfo generator.
* config/riscv/gen-riscv-ext-texi.cc: New.
* config/riscv/t-riscv: Add rule for generating riscv-ext.texi.
(cherry picked from commit 124cbbbed5b8f7454f93f9a87e57fd4f3f2f78d2)
Diff:
---
gcc/Makefile.in| 2 +-
gcc/config/riscv/gen-riscv-ext-texi.cc | 88 +
gcc/config/riscv/t-riscv | 34 +-
gcc/doc/invoke.texi| 495 +
gcc/doc/riscv-ext.texi | 637 +
5 files changed, 759 insertions(+), 497 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4cd7dbed3..0fa5d0c925af 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3702,7 +3702,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi
frontends.texi\
contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi \
fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi \
implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi \
-lto-dump.texi
+lto-dump.texi riscv-ext.texi
# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
# the generated tm.texi; the latter might have a more recent timestamp,
diff --git a/gcc/config/riscv/gen-riscv-ext-texi.cc
b/gcc/config/riscv/gen-riscv-ext-texi.cc
new file mode 100644
index ..e15fdbf36f6e
--- /dev/null
+++ b/gcc/config/riscv/gen-riscv-ext-texi.cc
@@ -0,0 +1,88 @@
+#include
+#include
+#include
+#include
+#include "riscv-opts.h"
+
+struct version_t
+{
+ int major;
+ int minor;
+ version_t (int major, int minor,
+enum riscv_isa_spec_class spec = ISA_SPEC_CLASS_NONE)
+: major (major), minor (minor)
+ {}
+ bool operator<(const version_t &other) const
+ {
+if (major != other.major)
+ return major < other.major;
+return minor < other.minor;
+ }
+
+ bool operator== (const version_t &other) const
+ {
+return major == other.major && minor == other.minor;
+ }
+};
+
+static void
+print_ext_doc_entry (const std::string &ext_name, const std::string &full_name,
+const std::string &desc,
+const std::vector &supported_versions)
+{
+ // Implementation of the function to print the documentation entry
+ // for the extension.
+ std::set unique_versions;
+ for (const auto &version : supported_versions)
+unique_versions.insert (version);
+ printf ("@item %s\n", ext_name.c_str ());
+ printf ("@tab");
+ for (const auto &version : unique_versions)
+{
+ printf (" %d.%d", version.major, version.minor);
+}
+ printf ("\n");
+ printf ("@tab %s", full_name.c_str ());
+ if (desc.size ())
+printf (", %s", desc.c_str ());
+ printf ("\n\n");
+}
+
+int
+main ()
+{
+ puts ("@c Copyright (C) 2025 Free Software Foundation, Inc.");
+ puts ("@c This is part of the GCC manual.");
+ puts ("@c For copying conditions, see the file gcc/doc/include/fdl.texi.");
+ puts ("");
+ puts ("@c This file is generated automatically using");
+ puts ("@c gcc/config/riscv/gen-riscv-ext-texi.cc from:");
+ puts ("@c gcc/config/riscv/riscv-ext.def");
+ puts ("@c gcc/config/riscv/riscv-opts.h");
+ puts ("");
+ puts ("@c Please *DO NOT* edit manually.");
+ puts ("");
+ puts ("@multitable @columnfractions .10 .10 .80");
+ puts ("@headitem Extension Name @tab Supported Version @tab Description");
+ puts ("");
+
+ /* g extension is a very speical extension that no clear version... */
+ puts ("@item g");
+ puts ("@tab -");
+ puts (
+"@tab General-purpose computing base extension, @samp{g} will expand to");
+ puts ("@samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and");
+ puts ("@samp{zifencei}.");
+ puts ("");
+
+#define DEFINE_RISCV_EXT(NAME, UPPERCAE_NAME, FULL_NAME, DESC, URL, DEP_EXTS,
\
+SUPPORTED_VERSIONS, FLAG_GROUP, BITMASK_GROUP_ID, \
+BITMASK_BIT_POSITION, EXTRA_EXTENSION_FLAGS) \
+ print_ext_doc_entry (#NAME, FULL_NAME, DESC,
\
+
[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Generate extension table in documentation from riscv-ext.def
https://gcc.gnu.org/g:efeece875331c102d54b452113840efb85aef459
commit efeece875331c102d54b452113840efb85aef459
Author: Kito Cheng
Date: Wed May 7 21:10:53 2025 +0800
RISC-V: Generate extension table in documentation from riscv-ext.def
Automatically build the ISA extension reference table in invoke.texi from
the unified riscv-ext.def metadata, ensuring documentation stays in sync
with extension definitions and reducing manual maintenance.
gcc/ChangeLog:
* doc/invoke.texi: Replace hand‑written extension table with
`@include riscv-ext.texi` to pull in auto‑generated entries.
* doc/riscv-ext.texi: New generated definition file
containing formatted documentation entries for each extension.
* Makefile.in: Add riscv-ext.texi to the list of files to be
processed by the Texinfo generator.
* config/riscv/gen-riscv-ext-texi.cc: New.
* config/riscv/t-riscv: Add rule for generating riscv-ext.texi.
(cherry picked from commit 124cbbbed5b8f7454f93f9a87e57fd4f3f2f78d2)
Diff:
---
gcc/Makefile.in| 2 +-
gcc/config/riscv/gen-riscv-ext-texi.cc | 88 +
gcc/config/riscv/t-riscv | 34 +-
gcc/doc/invoke.texi| 495 +
gcc/doc/riscv-ext.texi | 637 +
5 files changed, 759 insertions(+), 497 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4cd7dbed3..0fa5d0c925af 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3702,7 +3702,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi
frontends.texi\
contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi \
fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi \
implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi \
-lto-dump.texi
+lto-dump.texi riscv-ext.texi
# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
# the generated tm.texi; the latter might have a more recent timestamp,
diff --git a/gcc/config/riscv/gen-riscv-ext-texi.cc
b/gcc/config/riscv/gen-riscv-ext-texi.cc
new file mode 100644
index ..e15fdbf36f6e
--- /dev/null
+++ b/gcc/config/riscv/gen-riscv-ext-texi.cc
@@ -0,0 +1,88 @@
+#include
+#include
+#include
+#include
+#include "riscv-opts.h"
+
+struct version_t
+{
+ int major;
+ int minor;
+ version_t (int major, int minor,
+enum riscv_isa_spec_class spec = ISA_SPEC_CLASS_NONE)
+: major (major), minor (minor)
+ {}
+ bool operator<(const version_t &other) const
+ {
+if (major != other.major)
+ return major < other.major;
+return minor < other.minor;
+ }
+
+ bool operator== (const version_t &other) const
+ {
+return major == other.major && minor == other.minor;
+ }
+};
+
+static void
+print_ext_doc_entry (const std::string &ext_name, const std::string &full_name,
+const std::string &desc,
+const std::vector &supported_versions)
+{
+ // Implementation of the function to print the documentation entry
+ // for the extension.
+ std::set unique_versions;
+ for (const auto &version : supported_versions)
+unique_versions.insert (version);
+ printf ("@item %s\n", ext_name.c_str ());
+ printf ("@tab");
+ for (const auto &version : unique_versions)
+{
+ printf (" %d.%d", version.major, version.minor);
+}
+ printf ("\n");
+ printf ("@tab %s", full_name.c_str ());
+ if (desc.size ())
+printf (", %s", desc.c_str ());
+ printf ("\n\n");
+}
+
+int
+main ()
+{
+ puts ("@c Copyright (C) 2025 Free Software Foundation, Inc.");
+ puts ("@c This is part of the GCC manual.");
+ puts ("@c For copying conditions, see the file gcc/doc/include/fdl.texi.");
+ puts ("");
+ puts ("@c This file is generated automatically using");
+ puts ("@c gcc/config/riscv/gen-riscv-ext-texi.cc from:");
+ puts ("@c gcc/config/riscv/riscv-ext.def");
+ puts ("@c gcc/config/riscv/riscv-opts.h");
+ puts ("");
+ puts ("@c Please *DO NOT* edit manually.");
+ puts ("");
+ puts ("@multitable @columnfractions .10 .10 .80");
+ puts ("@headitem Extension Name @tab Supported Version @tab Description");
+ puts ("");
+
+ /* g extension is a very speical extension that no clear version... */
+ puts ("@item g");
+ puts ("@tab -");
+ puts (
+"@tab General-purpose computing base extension, @samp{g} will expand to");
+ puts ("@samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and");
+ puts ("@samp{zifencei}.");
+ puts ("");
+
+#define DEFINE_RISCV_EXT(NAME, UPPERCAE_NAME, FULL_NAME, DESC, URL, DEP_EXTS,
\
+SUPPORTED_VERSIONS, FLAG_GROUP, BITMASK_GROUP_ID, \
+BITMASK_BIT_POSITION, EXTRA_EXTENSION_FLAGS) \
+ print_ext_doc_entry (#NAME, FULL_NAME, DESC,
\
+
[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Generate extension table in documentation from riscv-ext.def
https://gcc.gnu.org/g:5a3297a5b21bf0f43238f64499fd2016a309d9fe
commit 5a3297a5b21bf0f43238f64499fd2016a309d9fe
Author: Kito Cheng
Date: Wed May 7 21:10:53 2025 +0800
RISC-V: Generate extension table in documentation from riscv-ext.def
Automatically build the ISA extension reference table in invoke.texi from
the unified riscv-ext.def metadata, ensuring documentation stays in sync
with extension definitions and reducing manual maintenance.
gcc/ChangeLog:
* doc/invoke.texi: Replace hand‑written extension table with
`@include riscv-ext.texi` to pull in auto‑generated entries.
* doc/riscv-ext.texi: New generated definition file
containing formatted documentation entries for each extension.
* Makefile.in: Add riscv-ext.texi to the list of files to be
processed by the Texinfo generator.
* config/riscv/gen-riscv-ext-texi.cc: New.
* config/riscv/t-riscv: Add rule for generating riscv-ext.texi.
(cherry picked from commit 124cbbbed5b8f7454f93f9a87e57fd4f3f2f78d2)
Diff:
---
gcc/Makefile.in| 2 +-
gcc/config/riscv/gen-riscv-ext-texi.cc | 88 +
gcc/config/riscv/t-riscv | 34 +-
gcc/doc/invoke.texi| 495 +
gcc/doc/riscv-ext.texi | 637 +
5 files changed, 759 insertions(+), 497 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4cd7dbed3..0fa5d0c925af 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3702,7 +3702,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi
frontends.texi\
contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi \
fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi \
implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi \
-lto-dump.texi
+lto-dump.texi riscv-ext.texi
# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
# the generated tm.texi; the latter might have a more recent timestamp,
diff --git a/gcc/config/riscv/gen-riscv-ext-texi.cc
b/gcc/config/riscv/gen-riscv-ext-texi.cc
new file mode 100644
index ..e15fdbf36f6e
--- /dev/null
+++ b/gcc/config/riscv/gen-riscv-ext-texi.cc
@@ -0,0 +1,88 @@
+#include
+#include
+#include
+#include
+#include "riscv-opts.h"
+
+struct version_t
+{
+ int major;
+ int minor;
+ version_t (int major, int minor,
+enum riscv_isa_spec_class spec = ISA_SPEC_CLASS_NONE)
+: major (major), minor (minor)
+ {}
+ bool operator<(const version_t &other) const
+ {
+if (major != other.major)
+ return major < other.major;
+return minor < other.minor;
+ }
+
+ bool operator== (const version_t &other) const
+ {
+return major == other.major && minor == other.minor;
+ }
+};
+
+static void
+print_ext_doc_entry (const std::string &ext_name, const std::string &full_name,
+const std::string &desc,
+const std::vector &supported_versions)
+{
+ // Implementation of the function to print the documentation entry
+ // for the extension.
+ std::set unique_versions;
+ for (const auto &version : supported_versions)
+unique_versions.insert (version);
+ printf ("@item %s\n", ext_name.c_str ());
+ printf ("@tab");
+ for (const auto &version : unique_versions)
+{
+ printf (" %d.%d", version.major, version.minor);
+}
+ printf ("\n");
+ printf ("@tab %s", full_name.c_str ());
+ if (desc.size ())
+printf (", %s", desc.c_str ());
+ printf ("\n\n");
+}
+
+int
+main ()
+{
+ puts ("@c Copyright (C) 2025 Free Software Foundation, Inc.");
+ puts ("@c This is part of the GCC manual.");
+ puts ("@c For copying conditions, see the file gcc/doc/include/fdl.texi.");
+ puts ("");
+ puts ("@c This file is generated automatically using");
+ puts ("@c gcc/config/riscv/gen-riscv-ext-texi.cc from:");
+ puts ("@c gcc/config/riscv/riscv-ext.def");
+ puts ("@c gcc/config/riscv/riscv-opts.h");
+ puts ("");
+ puts ("@c Please *DO NOT* edit manually.");
+ puts ("");
+ puts ("@multitable @columnfractions .10 .10 .80");
+ puts ("@headitem Extension Name @tab Supported Version @tab Description");
+ puts ("");
+
+ /* g extension is a very speical extension that no clear version... */
+ puts ("@item g");
+ puts ("@tab -");
+ puts (
+"@tab General-purpose computing base extension, @samp{g} will expand to");
+ puts ("@samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and");
+ puts ("@samp{zifencei}.");
+ puts ("");
+
+#define DEFINE_RISCV_EXT(NAME, UPPERCAE_NAME, FULL_NAME, DESC, URL, DEP_EXTS,
\
+SUPPORTED_VERSIONS, FLAG_GROUP, BITMASK_GROUP_ID, \
+BITMASK_BIT_POSITION, EXTRA_EXTENSION_FLAGS) \
+ print_ext_doc_entry (#NAME, FULL_NAME, DESC,
\
+
[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Generate extension table in documentation from riscv-ext.def
https://gcc.gnu.org/g:0c85dfe40c1ba1ba157e21d1120e6569623b1253
commit 0c85dfe40c1ba1ba157e21d1120e6569623b1253
Author: Kito Cheng
Date: Wed May 7 21:10:53 2025 +0800
RISC-V: Generate extension table in documentation from riscv-ext.def
Automatically build the ISA extension reference table in invoke.texi from
the unified riscv-ext.def metadata, ensuring documentation stays in sync
with extension definitions and reducing manual maintenance.
gcc/ChangeLog:
* doc/invoke.texi: Replace hand‑written extension table with
`@include riscv-ext.texi` to pull in auto‑generated entries.
* doc/riscv-ext.texi: New generated definition file
containing formatted documentation entries for each extension.
* Makefile.in: Add riscv-ext.texi to the list of files to be
processed by the Texinfo generator.
* config/riscv/gen-riscv-ext-texi.cc: New.
* config/riscv/t-riscv: Add rule for generating riscv-ext.texi.
(cherry picked from commit 124cbbbed5b8f7454f93f9a87e57fd4f3f2f78d2)
Diff:
---
gcc/Makefile.in| 2 +-
gcc/config/riscv/gen-riscv-ext-texi.cc | 88 +
gcc/config/riscv/t-riscv | 34 +-
gcc/doc/invoke.texi| 495 +
gcc/doc/riscv-ext.texi | 637 +
5 files changed, 759 insertions(+), 497 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4cd7dbed3..0fa5d0c925af 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3702,7 +3702,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi
frontends.texi\
contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi \
fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi \
implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi \
-lto-dump.texi
+lto-dump.texi riscv-ext.texi
# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
# the generated tm.texi; the latter might have a more recent timestamp,
diff --git a/gcc/config/riscv/gen-riscv-ext-texi.cc
b/gcc/config/riscv/gen-riscv-ext-texi.cc
new file mode 100644
index ..e15fdbf36f6e
--- /dev/null
+++ b/gcc/config/riscv/gen-riscv-ext-texi.cc
@@ -0,0 +1,88 @@
+#include
+#include
+#include
+#include
+#include "riscv-opts.h"
+
+struct version_t
+{
+ int major;
+ int minor;
+ version_t (int major, int minor,
+enum riscv_isa_spec_class spec = ISA_SPEC_CLASS_NONE)
+: major (major), minor (minor)
+ {}
+ bool operator<(const version_t &other) const
+ {
+if (major != other.major)
+ return major < other.major;
+return minor < other.minor;
+ }
+
+ bool operator== (const version_t &other) const
+ {
+return major == other.major && minor == other.minor;
+ }
+};
+
+static void
+print_ext_doc_entry (const std::string &ext_name, const std::string &full_name,
+const std::string &desc,
+const std::vector &supported_versions)
+{
+ // Implementation of the function to print the documentation entry
+ // for the extension.
+ std::set unique_versions;
+ for (const auto &version : supported_versions)
+unique_versions.insert (version);
+ printf ("@item %s\n", ext_name.c_str ());
+ printf ("@tab");
+ for (const auto &version : unique_versions)
+{
+ printf (" %d.%d", version.major, version.minor);
+}
+ printf ("\n");
+ printf ("@tab %s", full_name.c_str ());
+ if (desc.size ())
+printf (", %s", desc.c_str ());
+ printf ("\n\n");
+}
+
+int
+main ()
+{
+ puts ("@c Copyright (C) 2025 Free Software Foundation, Inc.");
+ puts ("@c This is part of the GCC manual.");
+ puts ("@c For copying conditions, see the file gcc/doc/include/fdl.texi.");
+ puts ("");
+ puts ("@c This file is generated automatically using");
+ puts ("@c gcc/config/riscv/gen-riscv-ext-texi.cc from:");
+ puts ("@c gcc/config/riscv/riscv-ext.def");
+ puts ("@c gcc/config/riscv/riscv-opts.h");
+ puts ("");
+ puts ("@c Please *DO NOT* edit manually.");
+ puts ("");
+ puts ("@multitable @columnfractions .10 .10 .80");
+ puts ("@headitem Extension Name @tab Supported Version @tab Description");
+ puts ("");
+
+ /* g extension is a very speical extension that no clear version... */
+ puts ("@item g");
+ puts ("@tab -");
+ puts (
+"@tab General-purpose computing base extension, @samp{g} will expand to");
+ puts ("@samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and");
+ puts ("@samp{zifencei}.");
+ puts ("");
+
+#define DEFINE_RISCV_EXT(NAME, UPPERCAE_NAME, FULL_NAME, DESC, URL, DEP_EXTS,
\
+SUPPORTED_VERSIONS, FLAG_GROUP, BITMASK_GROUP_ID, \
+BITMASK_BIT_POSITION, EXTRA_EXTENSION_FLAGS) \
+ print_ext_doc_entry (#NAME, FULL_NAME, DESC,
\
+
[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Generate extension table in documentation from riscv-ext.def
https://gcc.gnu.org/g:ac1cfc515717bb6f3dfb5d1c9da88e3b132be6c2
commit ac1cfc515717bb6f3dfb5d1c9da88e3b132be6c2
Author: Kito Cheng
Date: Wed May 7 21:10:53 2025 +0800
RISC-V: Generate extension table in documentation from riscv-ext.def
Automatically build the ISA extension reference table in invoke.texi from
the unified riscv-ext.def metadata, ensuring documentation stays in sync
with extension definitions and reducing manual maintenance.
gcc/ChangeLog:
* doc/invoke.texi: Replace hand‑written extension table with
`@include riscv-ext.texi` to pull in auto‑generated entries.
* doc/riscv-ext.texi: New generated definition file
containing formatted documentation entries for each extension.
* Makefile.in: Add riscv-ext.texi to the list of files to be
processed by the Texinfo generator.
* config/riscv/gen-riscv-ext-texi.cc: New.
* config/riscv/t-riscv: Add rule for generating riscv-ext.texi.
(cherry picked from commit 124cbbbed5b8f7454f93f9a87e57fd4f3f2f78d2)
Diff:
---
gcc/Makefile.in| 2 +-
gcc/config/riscv/gen-riscv-ext-texi.cc | 88 +
gcc/config/riscv/t-riscv | 34 +-
gcc/doc/invoke.texi| 495 +
gcc/doc/riscv-ext.texi | 637 +
5 files changed, 759 insertions(+), 497 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4cd7dbed3..0fa5d0c925af 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3702,7 +3702,7 @@ TEXI_GCC_FILES = gcc.texi gcc-common.texi gcc-vers.texi
frontends.texi\
contribute.texi compat.texi funding.texi gnu.texi gpl_v3.texi \
fdl.texi contrib.texi cppenv.texi cppopts.texi avr-mmcu.texi \
implement-c.texi implement-cxx.texi gcov-tool.texi gcov-dump.texi \
-lto-dump.texi
+lto-dump.texi riscv-ext.texi
# we explicitly use $(srcdir)/doc/tm.texi here to avoid confusion with
# the generated tm.texi; the latter might have a more recent timestamp,
diff --git a/gcc/config/riscv/gen-riscv-ext-texi.cc
b/gcc/config/riscv/gen-riscv-ext-texi.cc
new file mode 100644
index ..e15fdbf36f6e
--- /dev/null
+++ b/gcc/config/riscv/gen-riscv-ext-texi.cc
@@ -0,0 +1,88 @@
+#include
+#include
+#include
+#include
+#include "riscv-opts.h"
+
+struct version_t
+{
+ int major;
+ int minor;
+ version_t (int major, int minor,
+enum riscv_isa_spec_class spec = ISA_SPEC_CLASS_NONE)
+: major (major), minor (minor)
+ {}
+ bool operator<(const version_t &other) const
+ {
+if (major != other.major)
+ return major < other.major;
+return minor < other.minor;
+ }
+
+ bool operator== (const version_t &other) const
+ {
+return major == other.major && minor == other.minor;
+ }
+};
+
+static void
+print_ext_doc_entry (const std::string &ext_name, const std::string &full_name,
+const std::string &desc,
+const std::vector &supported_versions)
+{
+ // Implementation of the function to print the documentation entry
+ // for the extension.
+ std::set unique_versions;
+ for (const auto &version : supported_versions)
+unique_versions.insert (version);
+ printf ("@item %s\n", ext_name.c_str ());
+ printf ("@tab");
+ for (const auto &version : unique_versions)
+{
+ printf (" %d.%d", version.major, version.minor);
+}
+ printf ("\n");
+ printf ("@tab %s", full_name.c_str ());
+ if (desc.size ())
+printf (", %s", desc.c_str ());
+ printf ("\n\n");
+}
+
+int
+main ()
+{
+ puts ("@c Copyright (C) 2025 Free Software Foundation, Inc.");
+ puts ("@c This is part of the GCC manual.");
+ puts ("@c For copying conditions, see the file gcc/doc/include/fdl.texi.");
+ puts ("");
+ puts ("@c This file is generated automatically using");
+ puts ("@c gcc/config/riscv/gen-riscv-ext-texi.cc from:");
+ puts ("@c gcc/config/riscv/riscv-ext.def");
+ puts ("@c gcc/config/riscv/riscv-opts.h");
+ puts ("");
+ puts ("@c Please *DO NOT* edit manually.");
+ puts ("");
+ puts ("@multitable @columnfractions .10 .10 .80");
+ puts ("@headitem Extension Name @tab Supported Version @tab Description");
+ puts ("");
+
+ /* g extension is a very speical extension that no clear version... */
+ puts ("@item g");
+ puts ("@tab -");
+ puts (
+"@tab General-purpose computing base extension, @samp{g} will expand to");
+ puts ("@samp{i}, @samp{m}, @samp{a}, @samp{f}, @samp{d}, @samp{zicsr} and");
+ puts ("@samp{zifencei}.");
+ puts ("");
+
+#define DEFINE_RISCV_EXT(NAME, UPPERCAE_NAME, FULL_NAME, DESC, URL, DEP_EXTS,
\
+SUPPORTED_VERSIONS, FLAG_GROUP, BITMASK_GROUP_ID, \
+BITMASK_BIT_POSITION, EXTRA_EXTENSION_FLAGS) \
+ print_ext_doc_entry (#NAME, FULL_NAME, DESC,
\
+
