[clang] [lld] [llvm] [RISCV] Split code that tablegen needs out of RISCVISAInfo. (PR #89684)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 22 16:08:57 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 92631a4824a91f3268a5716dd3459df8dc6bfb63 ee9180aff45af55797d2e97c1b65f9c35b5c8a24 -- llvm/include/llvm/Support/RISCVISAUtils.h llvm/lib/Support/RISCVISAUtils.cpp clang/lib/Basic/Targets/RISCV.h clang/lib/CodeGen/CodeGenModule.cpp clang/lib/Driver/Driver.cpp clang/lib/Driver/ToolChains/Arch/RISCV.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/Flang.cpp clang/lib/Driver/ToolChains/Gnu.cpp clang/tools/driver/cc1_main.cpp lld/ELF/Arch/RISCV.cpp llvm/lib/Object/ELFObjectFile.cpp llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp llvm/lib/TargetParser/RISCVTargetParser.cpp llvm/unittests/Support/RISCVISAInfoTest.cpp llvm/utils/TableGen/RISCVTargetDefEmitter.cpp llvm/include/llvm/TargetParser/RISCVISAInfo.h llvm/lib/TargetParser/RISCVISAInfo.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index c103449f80..30fb35ce70 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -43,9 +43,8 @@ struct RISCVProfile {
 
 } // end anonymous namespace
 
-static const char *RISCVGImplications[] = {
-  "i", "m", "a", "f", "d", "zicsr", "zifencei"
-};
+static const char *RISCVGImplications[] = {"i", "m",     "a",       "f",
+                                           "d", "zicsr", "zifencei"};
 
 // NOTE: This table should be sorted alphabetically by extension name.
 static const RISCVSupportedExtension SupportedExtensions[] = {
@@ -1018,11 +1017,11 @@ Error RISCVISAInfo::checkDependency() {
 
   if ((HasZcmt || Exts.count("zcmp")) && Exts.count("d") &&
       (HasC || Exts.count("zcd")))
-    return createStringError(
-        errc::invalid_argument,
-        Twine("'") + (HasZcmt ? "zcmt" : "zcmp") +
-        "' extension is incompatible with '" + (HasC ? "c" : "zcd") +
-        "' extension when 'd' extension is enabled");
+    return createStringError(errc::invalid_argument,
+                             Twine("'") + (HasZcmt ? "zcmt" : "zcmp") +
+                                 "' extension is incompatible with '" +
+                                 (HasC ? "c" : "zcd") +
+                                 "' extension when 'd' extension is enabled");
 
   if (XLen != 32 && Exts.count("zcf"))
     return createStringError(errc::invalid_argument,
@@ -1217,14 +1216,10 @@ struct CombinedExtsEntry {
 };
 
 static constexpr CombinedExtsEntry CombineIntoExts[] = {
-    {{"zk"}, {ImpliedExtsZk}},
-    {{"zkn"}, {ImpliedExtsZkn}},
-    {{"zks"}, {ImpliedExtsZks}},
-    {{"zvkn"}, {ImpliedExtsZvkn}},
-    {{"zvknc"}, {ImpliedExtsZvknc}},
-    {{"zvkng"}, {ImpliedExtsZvkng}},
-    {{"zvks"}, {ImpliedExtsZvks}},
-    {{"zvksc"}, {ImpliedExtsZvksc}},
+    {{"zk"}, {ImpliedExtsZk}},       {{"zkn"}, {ImpliedExtsZkn}},
+    {{"zks"}, {ImpliedExtsZks}},     {{"zvkn"}, {ImpliedExtsZvkn}},
+    {{"zvknc"}, {ImpliedExtsZvknc}}, {{"zvkng"}, {ImpliedExtsZvkng}},
+    {{"zvks"}, {ImpliedExtsZvks}},   {{"zvksc"}, {ImpliedExtsZvksc}},
     {{"zvksg"}, {ImpliedExtsZvksg}},
 };
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/89684


More information about the cfe-commits mailing list