This is an archive of the discontinued LLVM Phabricator instance.

[TableGen] Add a new `encoder` directive into VarLenCodeEmitterGen
ClosedPublic

Authored by myhsu on Feb 6 2022, 6:19 PM.

Details

Summary

The new encoder directive can be used to specify custom encoder for a single operand or slice. This is different from the EncoderMethod field within an Operand, which affects every operands in the target.

In addition, this patch also changes the function signature of the encoder method -- a new argument, InsertPost, is added to both the default one (i.e. getMachineValue) and the custom one. This argument provides the bit position where the operand will eventually be inserted.

An example usage can be seen in D119101

Diff Detail

Event Timeline

myhsu created this revision.Feb 6 2022, 6:19 PM
myhsu requested review of this revision.Feb 6 2022, 6:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 6 2022, 6:19 PM
myhsu edited the summary of this revision. (Show Details)Feb 6 2022, 8:51 PM
ricky26 accepted this revision.Feb 14 2022, 4:11 AM

This LGTM. I can't spot any code style issues and it should only affect the 68k for now. I like how it looks in the tablegen files. Nice work. :)

This revision is now accepted and ready to land.Feb 14 2022, 4:11 AM
0x59616e added a comment.EditedFeb 14 2022, 5:45 PM

Just wondering: what about the decoder method ? Add a decoder dag operand and use it in the same way as encoder e.g. (operand "$123", 4, (encoder ...), (decoder ...)) ?

myhsu added a comment.Feb 14 2022, 8:27 PM

Just wondering: what about the decoder method ? Add a decoder dag operand and use it in the same way as encoder e.g. (operand "$123", 4, (encoder ...), (decoder ...)) ?

I guess that will be related to disassembling. If that's the case it should go into a separate patch and we can discuss there.

Just wondering: what about the decoder method ? Add a decoder dag operand and use it in the same way as encoder e.g. (operand "$123", 4, (encoder ...), (decoder ...)) ?

I guess that will be related to disassembling. If that's the case it should go into a separate patch and we can discuss there.

Alright then.

This revision was landed with ongoing or failed builds.Feb 14 2022, 8:44 PM
This revision was automatically updated to reflect the committed changes.