summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
authorSergei Barannikov <barannikov88@gmail.com>2025-09-04 17:48:36 +0300
committerGitHub <noreply@github.com>2025-09-04 14:48:36 +0000
commited3597e2f7c4a5ae1ad70de81032f2addf78e267 (patch)
treed3773a575917d198978ab1e744383cec5cea4851 /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
parent238c2a925bc4d8e315bb715ade50e7a1fd970a9e (diff)
[TableGen][Decoder] Decode operands with zero width or all bits known (#156358)
There are two classes of operands that DecoderEmitter cannot currently handle: 1. Operands that do not participate in instruction encoding. 2. Operands whose encoding contains only 1s and 0s. Because of this, targets developed various workarounds. Some targets insert missing operands after an instruction has been (incompletely) decoded, other take into account the missing operands when printing the instruction. Some targets do neither of that and fail to correctly disassemble some instructions. This patch makes it possible to decode both classes of operands and allows to remove existing workarounds. For the case of operand with no contribution to instruction encoding, one should now add `bits<0> OpName` field to instruction encoding record. This will make DecoderEmitter generate a call to the decoder function specified by the operand's DecoderMethod. The function has a signature different from the usual one and looks like this: ``` static DecodeStatus DecodeImm42Operand(MCInst &Inst, const MCDisassembler *Decoder) { Inst.addOperand(MCOperand::createImm(42)); return DecodeStatus::Success; } ``` Notably, encoding bits are not passed to it (since there are none). There is nothing special about the second case, the operand bits are passed as usual. The difference is that before this change, the function was not called if all the bits of the operand were known (no '?' in the operand encoding). There are two options controlling the behavior. Passing an option enables the old behavior. They exist to allow smooth transition to the new behavior. They are temporary (yeah, I know) and will be removed once all targets migrate, possibly giving some more time to downstream targets. Subsequent patches in the stack enable the new behavior on some in-tree targets.
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
0 files changed, 0 insertions, 0 deletions