[llvm] [TableGen][DecoderEmitter] Analyze encodings once (PR #154309)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 04:17:47 PDT 2025


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 HEAD~1 HEAD --extensions cpp -- llvm/utils/TableGen/DecoderEmitter.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index ab67fc03e..5c5d38099 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -2482,9 +2482,8 @@ static bool isValidEncoding(const Record *EncodingDef) {
     // Variable-length encoding.
     // At least one of the encoding bits must be complete (not '?').
     VarLenInst VLI(InstInit, InstField);
-    return !all_of(VLI, [](const EncodingSegment &S) {
-      return isa<UnsetInit>(S.Value);
-    });
+    return !all_of(
+        VLI, [](const EncodingSegment &S) { return isa<UnsetInit>(S.Value); });
   }
 
   // Inst field is neither BitsInit nor DagInit. This is something unsupported.
@@ -2603,9 +2602,8 @@ namespace {
   for (auto [EncodingID, Encoding] : enumerate(Encodings)) {
     const Record *EncodingDef = Encoding.EncodingDef;
     const CodeGenInstruction *Inst = Encoding.Inst;
-    unsigned BitWidth =
-        populateInstruction(Target, *EncodingDef, *Inst, EncodingID,
-                            Operands, IsVarLenInst);
+    unsigned BitWidth = populateInstruction(Target, *EncodingDef, *Inst,
+                                            EncodingID, Operands, IsVarLenInst);
     assert(BitWidth && "Invalid encodings should have been filtered out");
     if (IsVarLenInst) {
       MaxInstLen = std::max(MaxInstLen, BitWidth);

``````````

</details>


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


More information about the llvm-commits mailing list