[llvm] [Xtensa] Implement Code Density Option. (PR #119639)

Andrei Safronov via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 14:41:35 PST 2024


================
@@ -269,13 +316,31 @@ DecodeStatus XtensaDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
                                                 ArrayRef<uint8_t> Bytes,
                                                 uint64_t Address,
                                                 raw_ostream &CS) const {
-  uint32_t Insn;
+  uint64_t Insn;
   DecodeStatus Result;
 
+  // Parse 16-bit instructions
+  if (hasDensity()) {
+    Result = readInstruction16(Bytes, Address, Size, Insn, IsLittleEndian);
+    if (Result == MCDisassembler::Fail)
+      return MCDisassembler::Fail;
+    LLVM_DEBUG(dbgs() << "Trying Xtensa 16-bit instruction table :\n");
+    Result = decodeInstruction(DecoderTable16, MI, Insn, Address, this, STI);
----------------
andreisfr wrote:

Do you mean try to disassemble 16-bit code with the hasDensity option disabled and check that it produces erroneous decoding?

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


More information about the llvm-commits mailing list