[llvm] [RISCV] Add list of supported profiles to -print-supported-extensions (PR #90757)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 11:46:59 PDT 2024


https://github.com/topperc created https://github.com/llvm/llvm-project/pull/90757

I tried also printing the -march they correspond to, but it seemed overly verbose and caused line wraps. It might be better if we remove the versions numbers from the string or did a more intelligent line wrap.

>From 99449db654bb02b914b8882095e240f487473fb3 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Wed, 1 May 2024 11:39:56 -0700
Subject: [PATCH] [RISCV] Add list of supported profiles to
 -print-supported-extensions

I tried also printing the -march they correspond to, but it seemed
overly verbose and caused line wraps. It might be better if we remove
the versions numbers from the string or did a more intelligent line
wrap.
---
 llvm/lib/TargetParser/RISCVISAInfo.cpp           |  4 ++++
 llvm/unittests/TargetParser/RISCVISAInfoTest.cpp | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index 64405ca8cb9ff1..13c3cb5750ddc1 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -98,6 +98,10 @@ void llvm::riscvExtensionsHelp(StringMap<StringRef> DescMap) {
     PrintExtension(E.first, Version, DescMap["experimental-" + E.first]);
   }
 
+  outs() << "\nSupported Profiles\n";
+  for (const auto &P : SupportedProfiles)
+    outs().indent(4) << P.Name << "\n";
+
   outs() << "\nUse -march to specify the target's extension.\n"
             "For example, clang -march=rv32i_v1p0\n";
 }
diff --git a/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp b/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp
index 3aa0178100abf4..e3b056a0ff7f81 100644
--- a/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp
+++ b/llvm/unittests/TargetParser/RISCVISAInfoTest.cpp
@@ -906,6 +906,19 @@ Experimental extensions
     ssqosid              1.0
     supm                 0.8
 
+Supported Profiles
+    rva20s64
+    rva20u64
+    rva22s64
+    rva22u64
+    rva23s64
+    rva23u64
+    rvb23s64
+    rvb23u64
+    rvi20u32
+    rvi20u64
+    rvm23u32
+
 Use -march to specify the target's extension.
 For example, clang -march=rv32i_v1p0)";
   // clang-format on



More information about the llvm-commits mailing list