[PATCH] D155329: [TableGen][CodeEmitterGen] Add support for querying operand bit offsets

Ilya Leoshkevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 12:23:02 PDT 2023


iii created this revision.
iii added reviewers: craig.topper, uweigand.
Herald added a subscriber: hiraditya.
Herald added a project: All.
iii requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In order to generate relocations or to apply fixups after the layout
has been computed, the targets need to know the offsets of the
respective operands. There are indirect ways to figure them out in some
cases, for example, on SystemZ, the first memory operand is always at
offset 2, and the second one is always at offset 4. But there are no
such tricks for the immediate operands on SystemZ, so one has to refer
to individual instruction encodings.

This information, however, is available to TableGen. Generate
the getOperandBitOffset() method to access it, and use it to simplify
getting memory operand offsets on SystemZ. This also paves the way for
implementing symbolic immediates on this platform.

For the multi-lit operands, getOperandBitOffset() returns the offset of
the first lit.

An alternative way to obtain offsets would be to pass them to the
encoder methods, but this would require reworking all targets. Also,
VarLenCodeEmitter already does this, but adopting it requires
reworking the respective targets without other significant benefits.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155329

Files:
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCCodeEmitter.cpp
  llvm/utils/TableGen/CodeEmitterGen.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155329.540532.patch
Type: text/x-patch
Size: 13200 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230714/cc0d80db/attachment-0001.bin>


More information about the llvm-commits mailing list