[all-commits] [llvm/llvm-project] 8b655e: [TableGen][CodeEmitterGen] Add support for queryin...
Ilya Leoshkevich via All-commits
all-commits at lists.llvm.org
Thu Jul 20 01:11:06 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 8b655e1f0a70aeff26c25798eb1951d6b9b9e236
https://github.com/llvm/llvm-project/commit/8b655e1f0a70aeff26c25798eb1951d6b9b9e236
Author: Ilya Leoshkevich <iii at linux.ibm.com>
Date: 2023-07-20 (Thu, 20 Jul 2023)
Changed paths:
M llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCCodeEmitter.cpp
M llvm/utils/TableGen/CodeEmitterGen.cpp
Log Message:
-----------
[TableGen][CodeEmitterGen] Add support for querying operand bit offsets
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.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D155329
More information about the All-commits
mailing list