[PATCH] D113341: [SystemZ] Support symbolic displacements.

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 11 17:06:43 PST 2021


jonpa updated this revision to Diff 386694.
jonpa added a comment.

- Mapping of MI:OperandIndex to fixup byte offset: I added a TSFlags bit 'MemMem' which is checked for in getDispOpValue(). From this flag it is known that there are two memory operands, with displacements starting at bit 20 and 36. For the matter of choosing which one of these are in question in getDispOpValue(), based on the OpNum, I was not sure if this could be hard coded as well in the formats file, or if it would be simpler to check this at compile time the way that is currently done..?

- Instead of in the AsmParser allowing specifically an MCSymbolRefExpr as displacement (which does not work with 'b-a'), the patch now allows any MCExpr if a symbol allowed as displacement. It seems unrelocatable expressions are caught by evaluateAsRelocatable().

- Removed previous changes in applyFixup(). It seems the bit offset is actually not needed there during the insertion of reversed bytes... Test added for this as well (reloc-absolute.s). Is there a need for a range check here (for a too-big displacement)? Handle the value for a FK_390_20 displacement by putting the high byte first - I hope that holds true for all uses...?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113341/new/

https://reviews.llvm.org/D113341

Files:
  llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.cpp
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZInstPrinter.h
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCCodeEmitter.cpp
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCFixups.h
  llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp
  llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
  llvm/lib/Target/SystemZ/SystemZInstrFormats.td
  llvm/lib/Target/SystemZ/SystemZInstrInfo.h
  llvm/test/MC/SystemZ/fixups.s
  llvm/test/MC/SystemZ/reloc-absolute.s
  llvm/test/MC/SystemZ/reloc-directive.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113341.386694.patch
Type: text/x-patch
Size: 22793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211112/c8ae9bde/attachment-0001.bin>


More information about the llvm-commits mailing list