[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
Loading
Please sign in to comment