aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@sifive.com>2025-07-01 21:45:02 -0700
committerGitHub <noreply@github.com>2025-07-01 21:45:02 -0700
commitc9bfdae62002545db2de76e967da245048908284 (patch)
tree95cb0eeecafe8a4c0fe34ad368bebff26a6b9981 /llvm/lib
parentf1a4bb62452d88a0edd9340b3ca7c9b11ad9193f (diff)
downloadllvm-c9bfdae62002545db2de76e967da245048908284.zip
llvm-c9bfdae62002545db2de76e967da245048908284.tar.gz
llvm-c9bfdae62002545db2de76e967da245048908284.tar.bz2
[RISCV] Use uint64_t for Insn in getInstruction32 and getInstruction16. NFC (#146619)
Insn is passed to decodeInstruction which is a template function based on the type of Insn. By using uint64_t we ensure only one version of decodeInstruction is created. This reduces the file size of RISCVDisassembler.cpp.o by ~25% in my local build.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
index 27e04c0..52061e9 100644
--- a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
+++ b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
@@ -811,7 +811,9 @@ DecodeStatus RISCVDisassembler::getInstruction32(MCInst &MI, uint64_t &Size,
}
Size = 4;
- uint32_t Insn = support::endian::read32le(Bytes.data());
+ // Use uint64_t to match getInstruction48. decodeInstruction is templated
+ // on the Insn type.
+ uint64_t Insn = support::endian::read32le(Bytes.data());
for (const DecoderListEntry &Entry : DecoderList32) {
if (!Entry.haveContainedFeatures(STI.getFeatureBits()))
@@ -857,7 +859,9 @@ DecodeStatus RISCVDisassembler::getInstruction16(MCInst &MI, uint64_t &Size,
}
Size = 2;
- uint32_t Insn = support::endian::read16le(Bytes.data());
+ // Use uint64_t to match getInstruction48. decodeInstruction is templated
+ // on the Insn type.
+ uint64_t Insn = support::endian::read16le(Bytes.data());
for (const DecoderListEntry &Entry : DecoderList16) {
if (!Entry.haveContainedFeatures(STI.getFeatureBits()))