This is an archive of the discontinued LLVM Phabricator instance.

[MC][AVR] Implement decoding STD/LDD
ClosedPublic

Authored by benshi001 on Apr 8 2022, 9:47 PM.

Diff Detail

Event Timeline

benshi001 created this revision.Apr 8 2022, 9:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2022, 9:47 PM
Herald added subscribers: Jim, hiraditya. · View Herald Transcript
benshi001 requested review of this revision.Apr 8 2022, 9:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2022, 9:47 PM
This comment was removed by benshi001.
benshi001 updated this revision to Diff 421711.Apr 9 2022, 4:07 AM
benshi001 retitled this revision from [MC][AVR] Fix a crash when decoding the STD/LDD instructions to [MC][AVR] Implement decoding STD/LDD.
benshi001 added a comment.EditedApr 9 2022, 4:21 AM
This comment has been deleted.
llvm/lib/Target/AVR/Disassembler/AVRDisassembler.cpp
275

LDD/STD should be fully decoded by decodeMemri, but due to very complex reason, decodeMemri only correctly decodes LDD/STD with offset > 7, and the case offset <= 7 falls into decodeLoadStore (decoder method of LD/ST).

We should re-think the organization of definition of LD/ST/LDD/STD in TD files to avoid that. But currently I can not figure out a proper way, it invloves register allocation.

benshi001 added a comment.EditedApr 9 2022, 4:23 AM

This patch fixes the crash reported in https://github.com/llvm/llvm-project/issues/54776.

But properly decoding LD/ST with postinc/predec will be fixed in a new patch.

aykevl accepted this revision.May 4 2022, 2:15 PM

Looks good to me.

llvm/test/MC/AVR/inst-ldd.s
12

This instruction is not tested with an INST: line, is that intentional?

Same for std in the next file.

This revision is now accepted and ready to land.May 4 2022, 2:15 PM
benshi001 marked an inline comment as done.May 4 2022, 6:56 PM
benshi001 added inline comments.
llvm/test/MC/AVR/inst-ldd.s
12

That is intentional, since foo is an unresolved symbol.

This revision was landed with ongoing or failed builds.May 4 2022, 7:08 PM
This revision was automatically updated to reflect the committed changes.
benshi001 marked an inline comment as done.