-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[TableGen][Decoder] Decode operands with zero width or all bits known #156358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ With the latest revision this PR passed the C/C++ code formatter. |
Something went wrong with the graphite -_- |
3e6a846
to
d950e97
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
1230672
to
2c96e18
Compare
Overall, the decoder emitter changes LGTM. I'll let other folks here chime in on the individual target changes. |
3e5abcd
to
99327a7
Compare
Would it also make sense to add this comment?
If you want to incorporate it here, or I can create a separate PR as well. |
Please create a separate PR and also borrow that comment we discussed so that this PR gets smaller after rebasing. |
Sounds good, will do, |
Borrowed the comment, if you want to revert that part. |
The `$asr18` operand is not decoded/encoded/printed, and ASR18 is already in the `Uses` list. Extracted from #156358, where the extra operand causes DecoderEmitter to emit an error about an operand with a missing encoding.
99327a7
to
743d22e
Compare
The operand is not encoded, decoded, or printed and would break MCInst verification if we had one. Extracted from #156358, where the extra operand causes DecoderEmitter to emit an error about an operand with a missing encoding.
743d22e
to
a4624de
Compare
Can I get an approval here? I've extracted most of the target-specific changes into separate PRs, and the ones that remain should be trivial. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/26729 Here is the relevant piece of the build log for the reference
|
There are two classes of operands that DecoderEmitter cannot currently handle:
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 post-decoding instruction adjustments.
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: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.