- Add decoder for relative branch target operands.
- Add decoder for memri (reg + imm) operands.
- Change the way FSTLD instruction format is handled to be more compatible with disassembly. Instead of setting the inconsistent bit in a post encoder method, have it be part of the ptrreg operand so the LDSTDPtrReg encoder/decoder can handle it.
- Implement MCInstrAnalysis for AVR so llvm-objdump can show (some) branch targets.
Details
- Reviewers
dylanmckay
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The code is looking nice, thanks for the patch @amikhalev!
I've checked over everything except the bitmasks/bit positions and left a few comments. I intend to validate the bitmasks sometime in the next few days.
llvm/lib/Target/AVR/AVRInstrInfo.td | ||
---|---|---|
170 | Add a LLVM unit test that covers this (suggest somewhere in test/MC/AVR), perhaps using something like inst-sts.s as an example. | |
186 | Add a unit test for this new instruction decoder | |
194 | Add a unit test for this new instruction decoder | |
254 | Add a unit test for this new instruction decoder | |
258 | I hadn't seen this TableGen flag before, nice | |
270 | Add a unit test for this new instruction decoder | |
llvm/lib/Target/AVR/Disassembler/AVRDisassembler.cpp | ||
95 | I too love using binary literal notation, but sadly I believe it is not fully supported by the minimum C++ toolchain versions LLVM supports. Specifically, binary literals are not mentioned in the C++ feature "whitelist"[1], nor can I spot any existing uses in LLVM via a quick grep, plus I remember committing a change that included binary literals not too long ago that failed on the buildbots due to lack of support. Replace these binary literals with hex or decimal equivalents. If you want the binary representation to be shown, then it will have to be relegated to a code comment
| |
158 | Nitpick: YOrZ variable implies a boolean value. It is fairly clear in the definition and usage that it is always treated like a boolean value, but I recommend moving the == 0 check up to the definition of YOrZ to make it clear right at the site of its initial declaration/definition. For example bool YOrZ = fieldFromInstruction(Insn, 6, 1) == 0 | |
163 | Nitpick: Captialize Displacement | |
209 | I haven't looked deep into this sign extension implementation yet but recommend replacing the hand rolled SExt with a call to one of the generalized methods in MathExtras.h, for example, SignExtend64 | |
235 | Add some kind of assertion here to validate that you're covering all possible cases of input opcode without incorrectly falling back to IsPredec==false && isPostinc==false. The simplest solution might be done with switch but perhaps there is a more terse way to do it as this current code reads very nicely | |
llvm/lib/Target/AVR/MCTargetDesc/AVRMCTargetDesc.cpp | ||
13 | Nitpick: Either place a new line after this "primary" include to give it special vertical positioning, or order it alphabetically along with the other includes |
Add a LLVM unit test that covers this (suggest somewhere in test/MC/AVR), perhaps using something like inst-sts.s as an example.