This is an archive of the discontinued LLVM Phabricator instance.

[MC] Store operand info immediately after the TargetInsts table. NFC.
ClosedPublic

Authored by foad on Jan 20 2023, 7:16 AM.

Details

Summary

This shrinks MCInstrDesc (and hence the whole TargetInsts table) because
we can store a 16-bit offset value to access the operands info, instead
of a pointer. This also reduces the number of relocs that need to be
applied when LLVM is compiled as position-independent code.

Diff Detail

Event Timeline

foad created this revision.Jan 20 2023, 7:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 7:16 AM
foad requested review of this revision.Jan 20 2023, 7:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 20 2023, 7:16 AM
barannikov88 added inline comments.
llvm/include/llvm/MC/MCInstrDesc.h
580–581

ImplicitOps -> OpInfo (this is where it points now)

foad updated this revision to Diff 492039.Jan 25 2023, 2:16 AM

Rebase.

foad added inline comments.Feb 9 2023, 2:36 AM
llvm/include/llvm/MC/MCInstrDesc.h
580–581

You're right that it points to the start of the OpInfo, but I'm not sure that's important. It's also the "origin" from which implicit op list offsets are measured. So maybe ImplicitOpOrigin?

barannikov88 added inline comments.Feb 10 2023, 1:17 PM
llvm/include/llvm/MC/MCInstrDesc.h
580–581

I mean that it now points to explicit ops. Implicit ops follow explicit ops (offseted by ImplicitOffset).
Please correct me if I'm wrong.

foad added inline comments.Mar 24 2023, 7:18 AM
llvm/include/llvm/MC/MCInstrDesc.h
580–581

Yes, you are correct, it points to explicit ops. I just meant that that does not necessarily mean the variable has to be called "OpInfo".

foad updated this revision to Diff 508094.Mar 24 2023, 7:41 AM

Rebase. Tweak ImplicitOps calculation to avoid misleading variable name.

foad marked 2 inline comments as done.Mar 24 2023, 7:42 AM
foad added inline comments.
llvm/include/llvm/MC/MCInstrDesc.h
580–581

Rather than change the name, I tweaked the expression so that ImplicitOps now points to the first list of implicit ops for this instruction.

barannikov88 accepted this revision.Mar 24 2023, 8:01 AM

Still LGTM

This revision is now accepted and ready to land.Mar 24 2023, 8:01 AM
This revision was landed with ongoing or failed builds.Mar 27 2023, 3:40 AM
This revision was automatically updated to reflect the committed changes.