[llvm] [TableGen][NFC] Use `decodeULEB128AndIncUnsafe` in `decodeInstruction` (PR #98619)

Piotr Fusik via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 04:13:11 PDT 2024


https://github.com/pfusik created https://github.com/llvm/llvm-project/pull/98619

None

>From 574a731a0487f922a3e42b0f253988d15cf8b5a9 Mon Sep 17 00:00:00 2001
From: Piotr Fusik <p.fusik at samsung.com>
Date: Fri, 12 Jul 2024 11:58:11 +0200
Subject: [PATCH] [TableGen][NFC] Use `decodeULEB128AndIncUnsafe` in
 `decodeInstruction`

---
 llvm/utils/TableGen/DecoderEmitter.cpp | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index c303322e63b44..9591f7ca4dec2 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -2268,9 +2268,7 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
       return MCDisassembler::Fail;
     case MCD::OPC_ExtractField: {
       // Decode the start value.
-      unsigned DecodedLen;
-      unsigned Start = decodeULEB128(++Ptr, &DecodedLen);
-      Ptr += DecodedLen;
+      unsigned Start = decodeULEB128AndIncUnsafe(++Ptr);
       unsigned Len = *Ptr++;)";
   if (IsVarLenInst)
     OS << "\n      makeUp(insn, Start + Len);";
@@ -2282,9 +2280,7 @@ static DecodeStatus decodeInstruction(const uint8_t DecodeTable[], MCInst &MI,
     }
     case MCD::OPC_FilterValue: {
       // Decode the field value.
-      unsigned Len;
-      uint64_t Val = decodeULEB128(++Ptr, &Len);
-      Ptr += Len;
+      uint64_t Val = decodeULEB128AndIncUnsafe(++Ptr);
       // NumToSkip is a plain 24-bit integer.
       unsigned NumToSkip = *Ptr++;
       NumToSkip |= (*Ptr++) << 8;



More information about the llvm-commits mailing list