This is an archive of the discontinued LLVM Phabricator instance.

[WIP][TableGen] Add support for variable length instruction in DecoderGen.
AbandonedPublic

Authored by 0x59616e on Feb 25 2022, 7:07 PM.

Details

Reviewers
myhsu
Summary

This adds support for variable length encoding infrastructure in DecoderGen.

It thinks of the variable length instructions as fixed length by pretending they all have the same maximum length.

For example, given three instructions with length 2, 4 and 8 bytes, it just pretends them all have 8 bytes length.

In that way, we can use the algorithm for fixed length instructions to generate automaton for variable length instructions.

Also, since we can't know the instruction length before decoding, it adds an instruction length table and a callback function to let the disassembler to adjust the encoding of the instruction.

You can see example usage in D120606

Diff Detail

Event Timeline

0x59616e requested review of this revision.Feb 25 2022, 7:07 PM
0x59616e created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2022, 7:07 PM
0x59616e edited the summary of this revision. (Show Details)Feb 25 2022, 7:20 PM
0x59616e edited the summary of this revision. (Show Details)
0x59616e edited the summary of this revision. (Show Details)Feb 25 2022, 7:35 PM
0x59616e edited the summary of this revision. (Show Details)
0x59616e edited the summary of this revision. (Show Details)
0x59616e edited the summary of this revision. (Show Details)
myhsu added a reviewer: myhsu.Feb 25 2022, 8:30 PM
0x59616e updated this revision to Diff 411609.Feb 26 2022, 7:14 AM

addressed a bug when handling slice

0x59616e updated this revision to Diff 411653.Feb 26 2022, 9:09 PM
0x59616e edited the summary of this revision. (Show Details)

update diff. I forgot the context

0x59616e abandoned this revision.Feb 28 2022, 6:38 PM