[PATCH] D125316: [AMDGPU] gfx11 Decode wider instructions. NFC
Joe Nash via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 10 10:34:35 PDT 2022
Joe_Nash updated this revision to Diff 428432.
Joe_Nash marked 3 inline comments as done.
Joe_Nash added a comment.
removed DecoderUInt128 from patch. removed explicit template arguments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125316/new/
https://reviews.llvm.org/D125316
Files:
llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h
Index: llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h
===================================================================
--- llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h
+++ llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.h
@@ -17,6 +17,7 @@
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/MC/MCInstrInfo.h"
+#include "llvm/MC/MCInst.h"
#include "llvm/Support/DataExtractor.h"
#include <memory>
@@ -57,8 +58,21 @@
MCOperand errOperand(unsigned V, const Twine& ErrMsg) const;
- DecodeStatus tryDecodeInst(const uint8_t* Table, MCInst &MI, uint64_t Inst,
- uint64_t Address) const;
+ template <typename InsnType>
+ DecodeStatus tryDecodeInst(const uint8_t *Table, MCInst &MI, InsnType Inst,
+ uint64_t Address) const {
+ assert(MI.getOpcode() == 0);
+ assert(MI.getNumOperands() == 0);
+ MCInst TmpInst;
+ HasLiteral = false;
+ const auto SavedBytes = Bytes;
+ if (decodeInstruction(Table, TmpInst, Inst, Address, this, STI)) {
+ MI = TmpInst;
+ return MCDisassembler::Success;
+ }
+ Bytes = SavedBytes;
+ return MCDisassembler::Fail;
+ }
Optional<DecodeStatus> onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size,
ArrayRef<uint8_t> Bytes,
Index: llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
+++ llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
@@ -388,23 +388,6 @@
return Res;
}
-DecodeStatus AMDGPUDisassembler::tryDecodeInst(const uint8_t* Table,
- MCInst &MI,
- uint64_t Inst,
- uint64_t Address) const {
- assert(MI.getOpcode() == 0);
- assert(MI.getNumOperands() == 0);
- MCInst TmpInst;
- HasLiteral = false;
- const auto SavedBytes = Bytes;
- if (decodeInstruction(Table, TmpInst, Inst, Address, this, STI)) {
- MI = TmpInst;
- return MCDisassembler::Success;
- }
- Bytes = SavedBytes;
- return MCDisassembler::Fail;
-}
-
// The disassembler is greedy, so we need to check FI operand value to
// not parse a dpp if the correct literal is not set. For dpp16 the
// autogenerated decoder checks the dpp literal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125316.428432.patch
Type: text/x-patch
Size: 2436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220510/cdb6a1cd/attachment.bin>
More information about the llvm-commits
mailing list